diff --git a/sdk/resourcemanager/apicenter/armapicenter/CHANGELOG.md b/sdk/resourcemanager/apicenter/armapicenter/CHANGELOG.md index d6854c1c213b..1264fe2cdfec 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/CHANGELOG.md +++ b/sdk/resourcemanager/apicenter/armapicenter/CHANGELOG.md @@ -1,5 +1,22 @@ # Release History +## 1.1.0-beta.1 (2024-08-09) +### Features Added + +- New function `*ClientFactory.NewDeletedServicesClient() *DeletedServicesClient` +- New function `NewDeletedServicesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeletedServicesClient, error)` +- New function `*DeletedServicesClient.Delete(context.Context, string, string, *DeletedServicesClientDeleteOptions) (DeletedServicesClientDeleteResponse, error)` +- New function `*DeletedServicesClient.Get(context.Context, string, string, *DeletedServicesClientGetOptions) (DeletedServicesClientGetResponse, error)` +- New function `*DeletedServicesClient.NewListBySubscriptionPager(*DeletedServicesClientListBySubscriptionOptions) *runtime.Pager[DeletedServicesClientListBySubscriptionResponse]` +- New function `*DeletedServicesClient.NewListPager(string, *DeletedServicesClientListOptions) *runtime.Pager[DeletedServicesClientListResponse]` +- New struct `DeletedService` +- New struct `DeletedServiceListResult` +- New struct `DeletedServiceProperties` +- New struct `ServiceUpdateProperties` +- New field `Restore` in struct `ServiceProperties` +- New field `Properties` in struct `ServiceUpdate` + + ## 1.0.0 (2024-02-23) ### Breaking Changes diff --git a/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client.go b/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client.go index e22f69a745ee..cb7646ef0937 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client.go @@ -46,7 +46,7 @@ func NewAPIDefinitionsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates new or updates existing API definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -114,7 +114,7 @@ func (client *APIDefinitionsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -138,7 +138,7 @@ func (client *APIDefinitionsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Deletes specified API definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -203,7 +203,7 @@ func (client *APIDefinitionsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *APIDefinitionsClient) deleteCreateRequest(ctx context.Context, res // BeginExportSpecification - Exports the API specification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -242,7 +242,7 @@ func (client *APIDefinitionsClient) BeginExportSpecification(ctx context.Context // ExportSpecification - Exports the API specification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview func (client *APIDefinitionsClient) exportSpecification(ctx context.Context, resourceGroupName string, serviceName string, workspaceName string, apiName string, versionName string, definitionName string, options *APIDefinitionsClientBeginExportSpecificationOptions) (*http.Response, error) { var err error const operationName = "APIDefinitionsClient.BeginExportSpecification" @@ -300,7 +300,7 @@ func (client *APIDefinitionsClient) exportSpecificationCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -309,7 +309,7 @@ func (client *APIDefinitionsClient) exportSpecificationCreateRequest(ctx context // Get - Returns details of the API definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -375,7 +375,7 @@ func (client *APIDefinitionsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -395,7 +395,7 @@ func (client *APIDefinitionsClient) getHandleResponse(resp *http.Response) (APID // Head - Checks if specified API definition exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -460,7 +460,7 @@ func (client *APIDefinitionsClient) headCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -469,7 +469,7 @@ func (client *APIDefinitionsClient) headCreateRequest(ctx context.Context, resou // BeginImportSpecification - Imports the API specification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -500,7 +500,7 @@ func (client *APIDefinitionsClient) BeginImportSpecification(ctx context.Context // ImportSpecification - Imports the API specification. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview func (client *APIDefinitionsClient) importSpecification(ctx context.Context, resourceGroupName string, serviceName string, workspaceName string, apiName string, versionName string, definitionName string, body APISpecImportRequest, options *APIDefinitionsClientBeginImportSpecificationOptions) (*http.Response, error) { var err error const operationName = "APIDefinitionsClient.BeginImportSpecification" @@ -558,7 +558,7 @@ func (client *APIDefinitionsClient) importSpecificationCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -569,7 +569,7 @@ func (client *APIDefinitionsClient) importSpecificationCreateRequest(ctx context // NewListPager - Returns a collection of API definitions. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -634,7 +634,7 @@ func (client *APIDefinitionsClient) listCreateRequest(ctx context.Context, resou if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client_example_test.go deleted file mode 100644 index 8f17a0abbaf9..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/apidefinitions_client_example_test.go +++ /dev/null @@ -1,220 +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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_List.json -func ExampleAPIDefinitionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIDefinitionsClient().NewListPager("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", &armapicenter.APIDefinitionsClientListOptions{Filter: 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.APIDefinitionListResult = armapicenter.APIDefinitionListResult{ - // Value: []*armapicenter.APIDefinition{ - // { - // Name: to.Ptr("openapi"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis/versions/definitions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIDefinitionProperties{ - // Description: to.Ptr("Default spec"), - // Specification: &armapicenter.APIDefinitionPropertiesSpecification{ - // Name: to.Ptr("openapi"), - // Version: to.Ptr("3.0.6"), - // }, - // Title: to.Ptr("OpenAPI"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Get.json -func ExampleAPIDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIDefinitionsClient().Get(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", "openapi", 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.APIDefinition = armapicenter.APIDefinition{ - // Name: to.Ptr("openapi"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis/versions/definitions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIDefinitionProperties{ - // Description: to.Ptr("Default spec"), - // Specification: &armapicenter.APIDefinitionPropertiesSpecification{ - // Name: to.Ptr("openapi"), - // Version: to.Ptr("3.0.6"), - // }, - // Title: to.Ptr("OpenAPI"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_CreateOrUpdate.json -func ExampleAPIDefinitionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIDefinitionsClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "default", "openapi", "2023-01-01", "openapi", armapicenter.APIDefinition{}, 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.APIDefinition = armapicenter.APIDefinition{ - // Name: to.Ptr("openapi"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis/versions/definitions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIDefinitionProperties{ - // Description: to.Ptr("Default spec"), - // Specification: &armapicenter.APIDefinitionPropertiesSpecification{ - // Name: to.Ptr("openapi"), - // Version: to.Ptr("3.0.6"), - // }, - // Title: to.Ptr("OpenAPI"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Delete.json -func ExampleAPIDefinitionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIDefinitionsClient().Delete(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", "openapi", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Head.json -func ExampleAPIDefinitionsClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIDefinitionsClient().Head(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", "openapi", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_ExportSpecification.json -func ExampleAPIDefinitionsClient_BeginExportSpecification() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIDefinitionsClient().BeginExportSpecification(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", "openapi", 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.APISpecExportResult = armapicenter.APISpecExportResult{ - // Format: to.Ptr(armapicenter.APISpecExportResultFormatInline), - // Value: to.Ptr("{ ... }"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_ImportSpecification.json -func ExampleAPIDefinitionsClient_BeginImportSpecification() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAPIDefinitionsClient().BeginImportSpecification(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", "openapi", armapicenter.APISpecImportRequest{}, 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/apicenter/armapicenter/apis_client.go b/sdk/resourcemanager/apicenter/armapicenter/apis_client.go index 67d1dba00a12..cdd6a6691713 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/apis_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/apis_client.go @@ -46,7 +46,7 @@ func NewApisClient(subscriptionID string, credential azcore.TokenCredential, opt // CreateOrUpdate - Creates new or updates existing API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -103,7 +103,7 @@ func (client *ApisClient) createOrUpdateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,7 @@ func (client *ApisClient) createOrUpdateHandleResponse(resp *http.Response) (Api // Delete - Deletes specified API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -182,7 +182,7 @@ func (client *ApisClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *ApisClient) deleteCreateRequest(ctx context.Context, resourceGroup // Get - Returns details of the API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -247,7 +247,7 @@ func (client *ApisClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *ApisClient) getHandleResponse(resp *http.Response) (ApisClientGetR // Head - Checks if specified API exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -322,7 +322,7 @@ func (client *ApisClient) headCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *ApisClient) headCreateRequest(ctx context.Context, resourceGroupNa // NewListPager - Returns a collection of APIs. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -385,7 +385,7 @@ func (client *ApisClient) listCreateRequest(ctx context.Context, resourceGroupNa if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/apis_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/apis_client_example_test.go deleted file mode 100644 index 6d977bf578ff..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/apis_client_example_test.go +++ /dev/null @@ -1,207 +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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_List.json -func ExampleApisClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApisClient().NewListPager("contoso-resources", "contoso", "default", &armapicenter.ApisClientListOptions{Filter: 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.APIListResult = armapicenter.APIListResult{ - // Value: []*armapicenter.API{ - // { - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.ApiCenter/services/environments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIProperties{ - // Description: to.Ptr("A simple HTTP request/response service."), - // CustomProperties: map[string]any{ - // "author": "John Doe", - // }, - // ExternalDocumentation: []*armapicenter.ExternalDocumentation{ - // { - // Title: to.Ptr("Onboarding docs"), - // URL: to.Ptr("https://docs.contoso.com"), - // }}, - // Kind: to.Ptr(armapicenter.APIKindRest), - // License: &armapicenter.License{ - // URL: to.Ptr("https://contoso.com/license"), - // }, - // LifecycleStage: to.Ptr(armapicenter.LifecycleStageDesign), - // TermsOfService: &armapicenter.TermsOfService{ - // URL: to.Ptr("https://contoso.com/terms-of-service"), - // }, - // Title: to.Ptr("Echo API"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Get.json -func ExampleApisClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApisClient().Get(ctx, "contoso-resources", "contoso", "default", "echo-api", 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.API = armapicenter.API{ - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIProperties{ - // Description: to.Ptr("A simple HTTP request/response service."), - // CustomProperties: map[string]any{ - // "author": "John Doe", - // }, - // ExternalDocumentation: []*armapicenter.ExternalDocumentation{ - // { - // Title: to.Ptr("Onboarding docs"), - // URL: to.Ptr("https://docs.contoso.com"), - // }}, - // Kind: to.Ptr(armapicenter.APIKindRest), - // License: &armapicenter.License{ - // URL: to.Ptr("https://contoso.com/license"), - // }, - // LifecycleStage: to.Ptr(armapicenter.LifecycleStageDesign), - // TermsOfService: &armapicenter.TermsOfService{ - // URL: to.Ptr("https://contoso.com/terms-of-service"), - // }, - // Title: to.Ptr("Echo API"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_CreateOrUpdate.json -func ExampleApisClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApisClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "default", "echo-api", armapicenter.API{}, 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.API = armapicenter.API{ - // Name: to.Ptr("echo-api"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIProperties{ - // Description: to.Ptr("A simple HTTP request/response service."), - // CustomProperties: map[string]any{ - // "author": "John Doe", - // }, - // ExternalDocumentation: []*armapicenter.ExternalDocumentation{ - // { - // Title: to.Ptr("Onboarding docs"), - // URL: to.Ptr("https://docs.contoso.com"), - // }}, - // Kind: to.Ptr(armapicenter.APIKindRest), - // License: &armapicenter.License{ - // URL: to.Ptr("https://contoso.com/license"), - // }, - // LifecycleStage: to.Ptr(armapicenter.LifecycleStageDesign), - // TermsOfService: &armapicenter.TermsOfService{ - // URL: to.Ptr("https://contoso.com/terms-of-service"), - // }, - // Title: to.Ptr("Echo API"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Delete.json -func ExampleApisClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewApisClient().Delete(ctx, "contoso-resources", "contoso", "default", "echo-api", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Head.json -func ExampleApisClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewApisClient().Head(ctx, "contoso-resources", "contoso", "default", "echo-api", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/apiversions_client.go b/sdk/resourcemanager/apicenter/armapicenter/apiversions_client.go index c9cefdb94644..798075cb709a 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/apiversions_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/apiversions_client.go @@ -46,7 +46,7 @@ func NewAPIVersionsClient(subscriptionID string, credential azcore.TokenCredenti // CreateOrUpdate - Creates new or updates existing API version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -109,7 +109,7 @@ func (client *APIVersionsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -133,7 +133,7 @@ func (client *APIVersionsClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Deletes specified API version // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -193,7 +193,7 @@ func (client *APIVersionsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *APIVersionsClient) deleteCreateRequest(ctx context.Context, resour // Get - Returns details of the API version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -263,7 +263,7 @@ func (client *APIVersionsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *APIVersionsClient) getHandleResponse(resp *http.Response) (APIVers // Head - Checks if specified API version exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -343,7 +343,7 @@ func (client *APIVersionsClient) headCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -351,7 +351,7 @@ func (client *APIVersionsClient) headCreateRequest(ctx context.Context, resource // NewListPager - Returns a collection of API versions. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -411,7 +411,7 @@ func (client *APIVersionsClient) listCreateRequest(ctx context.Context, resource if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/apiversions_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/apiversions_client_example_test.go deleted file mode 100644 index 785f1ca84c08..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/apiversions_client_example_test.go +++ /dev/null @@ -1,159 +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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_List.json -func ExampleAPIVersionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIVersionsClient().NewListPager("contoso-resources", "contoso", "default", "echo-api", &armapicenter.APIVersionsClientListOptions{Filter: 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.APIVersionListResult = armapicenter.APIVersionListResult{ - // Value: []*armapicenter.APIVersion{ - // { - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/environments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api/versions/2023-01-01"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIVersionProperties{ - // LifecycleStage: to.Ptr(armapicenter.LifecycleStageProduction), - // Title: to.Ptr("2023-01-01"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Get.json -func ExampleAPIVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIVersionsClient().Get(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-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.APIVersion = armapicenter.APIVersion{ - // Name: to.Ptr("2023-01-01"), - // Type: to.Ptr("Microsoft.ApiCenter/services/workspaces/apis/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api/versions/2023-01-01"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIVersionProperties{ - // LifecycleStage: to.Ptr(armapicenter.LifecycleStageProduction), - // Title: to.Ptr("2023-01-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_CreateOrUpdate.json -func ExampleAPIVersionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIVersionsClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", armapicenter.APIVersion{}, 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.APIVersion = armapicenter.APIVersion{ - // Name: to.Ptr("2023-01-01"), - // Type: to.Ptr("Microsoft.ApiCenter/services/workspaces/apis/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/apis/echo-api/versions/2023-01-01"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.APIVersionProperties{ - // LifecycleStage: to.Ptr(armapicenter.LifecycleStageProduction), - // Title: to.Ptr("2023-01-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Delete.json -func ExampleAPIVersionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIVersionsClient().Delete(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Head.json -func ExampleAPIVersionsClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAPIVersionsClient().Head(ctx, "contoso-resources", "contoso", "default", "echo-api", "2023-01-01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/autorest.md b/sdk/resourcemanager/apicenter/armapicenter/autorest.md index 4ea65431506d..bd1bec64d594 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/autorest.md +++ b/sdk/resourcemanager/apicenter/armapicenter/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apicenter/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apicenter/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-03 +module-version: 1.1.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/apicenter/armapicenter/client_factory.go b/sdk/resourcemanager/apicenter/armapicenter/client_factory.go index b4caba6c82ac..0d755c360226 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/client_factory.go +++ b/sdk/resourcemanager/apicenter/armapicenter/client_factory.go @@ -60,6 +60,14 @@ func (c *ClientFactory) NewApisClient() *ApisClient { } } +// NewDeletedServicesClient creates a new instance of DeletedServicesClient. +func (c *ClientFactory) NewDeletedServicesClient() *DeletedServicesClient { + return &DeletedServicesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewDeploymentsClient creates a new instance of DeploymentsClient. func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { return &DeploymentsClient{ diff --git a/sdk/resourcemanager/apicenter/armapicenter/constants.go b/sdk/resourcemanager/apicenter/armapicenter/constants.go index 89301d7903df..cb1038ccbb6f 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/constants.go +++ b/sdk/resourcemanager/apicenter/armapicenter/constants.go @@ -10,7 +10,7 @@ package armapicenter const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0-beta.1" ) // APIKind - The kind of the API diff --git a/sdk/resourcemanager/apicenter/armapicenter/deletedservices_client.go b/sdk/resourcemanager/apicenter/armapicenter/deletedservices_client.go new file mode 100644 index 000000000000..bcff585d4cc6 --- /dev/null +++ b/sdk/resourcemanager/apicenter/armapicenter/deletedservices_client.go @@ -0,0 +1,283 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armapicenter + +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" +) + +// DeletedServicesClient contains the methods for the DeletedServices group. +// Don't use this type directly, use NewDeletedServicesClient() instead. +type DeletedServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeletedServicesClient creates a new instance of DeletedServicesClient 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 NewDeletedServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeletedServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Permanently deletes specified service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deletedServiceName - The name of the deleted service. +// - options - DeletedServicesClientDeleteOptions contains the optional parameters for the DeletedServicesClient.Delete method. +func (client *DeletedServicesClient) Delete(ctx context.Context, resourceGroupName string, deletedServiceName string, options *DeletedServicesClientDeleteOptions) (DeletedServicesClientDeleteResponse, error) { + var err error + const operationName = "DeletedServicesClient.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, deletedServiceName, options) + if err != nil { + return DeletedServicesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeletedServicesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeletedServicesClientDeleteResponse{}, err + } + return DeletedServicesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DeletedServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deletedServiceName string, options *DeletedServicesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/deletedServices/{deletedServiceName}" + 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 deletedServiceName == "" { + return nil, errors.New("parameter deletedServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deletedServiceName}", url.PathEscape(deletedServiceName)) + 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-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns details of the soft-deleted service. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deletedServiceName - The name of the deleted service. +// - options - DeletedServicesClientGetOptions contains the optional parameters for the DeletedServicesClient.Get method. +func (client *DeletedServicesClient) Get(ctx context.Context, resourceGroupName string, deletedServiceName string, options *DeletedServicesClientGetOptions) (DeletedServicesClientGetResponse, error) { + var err error + const operationName = "DeletedServicesClient.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, deletedServiceName, options) + if err != nil { + return DeletedServicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeletedServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeletedServicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DeletedServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, deletedServiceName string, options *DeletedServicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/deletedServices/{deletedServiceName}" + 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 deletedServiceName == "" { + return nil, errors.New("parameter deletedServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deletedServiceName}", url.PathEscape(deletedServiceName)) + 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-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeletedServicesClient) getHandleResponse(resp *http.Response) (DeletedServicesClientGetResponse, error) { + result := DeletedServicesClientGetResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedService); err != nil { + return DeletedServicesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists soft-deleted services. +// +// Generated from API version 2024-03-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - DeletedServicesClientListOptions contains the optional parameters for the DeletedServicesClient.NewListPager +// method. +func (client *DeletedServicesClient) NewListPager(resourceGroupName string, options *DeletedServicesClientListOptions) *runtime.Pager[DeletedServicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DeletedServicesClientListResponse]{ + More: func(page DeletedServicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeletedServicesClientListResponse) (DeletedServicesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedServicesClient.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, options) + }, nil) + if err != nil { + return DeletedServicesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DeletedServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *DeletedServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/deletedServices" + 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.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2024-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DeletedServicesClient) listHandleResponse(resp *http.Response) (DeletedServicesClientListResponse, error) { + result := DeletedServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServiceListResult); err != nil { + return DeletedServicesClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists services within an Azure subscription. +// +// Generated from API version 2024-03-15-preview +// - options - DeletedServicesClientListBySubscriptionOptions contains the optional parameters for the DeletedServicesClient.NewListBySubscriptionPager +// method. +func (client *DeletedServicesClient) NewListBySubscriptionPager(options *DeletedServicesClientListBySubscriptionOptions) *runtime.Pager[DeletedServicesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[DeletedServicesClientListBySubscriptionResponse]{ + More: func(page DeletedServicesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeletedServicesClientListBySubscriptionResponse) (DeletedServicesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedServicesClient.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 DeletedServicesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DeletedServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DeletedServicesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/deletedServices" + 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-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DeletedServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DeletedServicesClientListBySubscriptionResponse, error) { + result := DeletedServicesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServiceListResult); err != nil { + return DeletedServicesClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/apicenter/armapicenter/deployments_client.go b/sdk/resourcemanager/apicenter/armapicenter/deployments_client.go index 4dc0086b4650..d6dcc85a8445 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/deployments_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/deployments_client.go @@ -46,7 +46,7 @@ func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredenti // CreateOrUpdate - Creates new or updates existing API deployment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -109,7 +109,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -133,7 +133,7 @@ func (client *DeploymentsClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Deletes API deployment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -193,7 +193,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour // Get - Returns details of the API deployment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -263,7 +263,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym // Head - Checks if specified API deployment exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -343,7 +343,7 @@ func (client *DeploymentsClient) headCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -351,7 +351,7 @@ func (client *DeploymentsClient) headCreateRequest(ctx context.Context, resource // NewListPager - Returns a collection of API deployments. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -411,7 +411,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/deployments_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/deployments_client_example_test.go deleted file mode 100644 index ce277f415027..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/deployments_client_example_test.go +++ /dev/null @@ -1,180 +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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_List.json -func ExampleDeploymentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeploymentsClient().NewListPager("contoso-resources", "contoso", "default", "echo-api", &armapicenter.DeploymentsClientListOptions{Filter: 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 = armapicenter.DeploymentListResult{ - // Value: []*armapicenter.Deployment{ - // { - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis/deployments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/deployments/production"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.DeploymentProperties{ - // Description: to.Ptr("Public cloud production deployment."), - // DefinitionID: to.Ptr("/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi"), - // EnvironmentID: to.Ptr("/workspaces/default/environments/production"), - // Server: &armapicenter.DeploymentServer{ - // RuntimeURI: []*string{ - // to.Ptr("https://api.contoso.com")}, - // }, - // State: to.Ptr(armapicenter.DeploymentStateActive), - // Title: to.Ptr("Development"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Get.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 := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeploymentsClient().Get(ctx, "contoso-resources", "contoso", "default", "echo-api", "production", 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 = armapicenter.Deployment{ - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis/deployments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/deployments/production"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.DeploymentProperties{ - // Description: to.Ptr("Public cloud production deployment."), - // DefinitionID: to.Ptr("/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi"), - // EnvironmentID: to.Ptr("/workspaces/default/environments/production"), - // Server: &armapicenter.DeploymentServer{ - // RuntimeURI: []*string{ - // to.Ptr("https://api.contoso.com")}, - // }, - // State: to.Ptr(armapicenter.DeploymentStateActive), - // Title: to.Ptr("Production deployment"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_CreateOrUpdate.json -func ExampleDeploymentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeploymentsClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "default", "echo-api", "production", armapicenter.Deployment{}, 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 = armapicenter.Deployment{ - // Name: to.Ptr("production"), - // Type: to.Ptr("Microsoft.ApiCenter/services/apis/deployments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/deployments/production"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.DeploymentProperties{ - // Description: to.Ptr("Public cloud production deployment."), - // DefinitionID: to.Ptr("/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi"), - // EnvironmentID: to.Ptr("/workspaces/default/environments/production"), - // Server: &armapicenter.DeploymentServer{ - // RuntimeURI: []*string{ - // to.Ptr("https://api.contoso.com")}, - // }, - // State: to.Ptr(armapicenter.DeploymentStateActive), - // Title: to.Ptr("Production deployment"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Delete.json -func ExampleDeploymentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDeploymentsClient().Delete(ctx, "contoso-resources", "contoso", "default", "echo-api", "production", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Head.json -func ExampleDeploymentsClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDeploymentsClient().Head(ctx, "contoso-resources", "contoso", "default", "echo-api", "production", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/environments_client.go b/sdk/resourcemanager/apicenter/armapicenter/environments_client.go index 2e2b38fc817a..3529e6ce42fc 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/environments_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/environments_client.go @@ -46,7 +46,7 @@ func NewEnvironmentsClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Creates new or updates existing environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -104,7 +104,7 @@ func (client *EnvironmentsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -128,7 +128,7 @@ func (client *EnvironmentsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes the environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -183,7 +183,7 @@ func (client *EnvironmentsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +192,7 @@ func (client *EnvironmentsClient) deleteCreateRequest(ctx context.Context, resou // Get - Returns details of the environment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -248,7 +248,7 @@ func (client *EnvironmentsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +268,7 @@ func (client *EnvironmentsClient) getHandleResponse(resp *http.Response) (Enviro // Head - Checks if specified environment exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -323,7 +323,7 @@ func (client *EnvironmentsClient) headCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +331,7 @@ func (client *EnvironmentsClient) headCreateRequest(ctx context.Context, resourc // NewListPager - Returns a collection of environments. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -386,7 +386,7 @@ func (client *EnvironmentsClient) listCreateRequest(ctx context.Context, resourc if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/environments_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/environments_client_example_test.go deleted file mode 100644 index dd397ccf205f..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/environments_client_example_test.go +++ /dev/null @@ -1,193 +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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_List.json -func ExampleEnvironmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEnvironmentsClient().NewListPager("contoso-resources", "contoso", "default", &armapicenter.EnvironmentsClientListOptions{Filter: 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.EnvironmentListResult = armapicenter.EnvironmentListResult{ - // Value: []*armapicenter.Environment{ - // { - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/environments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/environments/public"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.EnvironmentProperties{ - // Description: to.Ptr("The primary Azure API Management service for the European division of Contoso."), - // CustomProperties: map[string]any{ - // }, - // Kind: to.Ptr(armapicenter.EnvironmentKindProduction), - // Onboarding: &armapicenter.Onboarding{ - // DeveloperPortalURI: []*string{ - // }, - // }, - // Server: &armapicenter.EnvironmentServer{ - // Type: to.Ptr(armapicenter.EnvironmentServerTypeAzureAPIManagement), - // ManagementPortalURI: []*string{ - // }, - // }, - // Title: to.Ptr("Contoso Europe Azure API Management"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Get.json -func ExampleEnvironmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentsClient().Get(ctx, "contoso-resources", "contoso", "default", "public", 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.Environment = armapicenter.Environment{ - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/environments"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/environments/public"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.EnvironmentProperties{ - // CustomProperties: map[string]any{ - // }, - // Kind: to.Ptr(armapicenter.EnvironmentKindProduction), - // Onboarding: &armapicenter.Onboarding{ - // DeveloperPortalURI: []*string{ - // }, - // }, - // Server: &armapicenter.EnvironmentServer{ - // Type: to.Ptr(armapicenter.EnvironmentServerTypeAzureAPIManagement), - // ManagementPortalURI: []*string{ - // }, - // }, - // Title: to.Ptr("Public"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_CreateOrUpdate.json -func ExampleEnvironmentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentsClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "default", "public", armapicenter.Environment{}, 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.Environment = armapicenter.Environment{ - // Name: to.Ptr("public"), - // Type: to.Ptr("Microsoft.ApiCenter/services/workspaces/environments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default/environments/public"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.EnvironmentProperties{ - // Description: to.Ptr("The primary Azure API Management service for the European division of Contoso."), - // Kind: to.Ptr(armapicenter.EnvironmentKindProduction), - // Onboarding: &armapicenter.Onboarding{ - // DeveloperPortalURI: []*string{ - // to.Ptr("https://developer.contoso.com")}, - // Instructions: to.Ptr("Sign in or sign up in the specified developer portal to request API access. You must complete the internal privacy training for your account to be approved."), - // }, - // Server: &armapicenter.EnvironmentServer{ - // Type: to.Ptr(armapicenter.EnvironmentServerTypeAzureAPIManagement), - // ManagementPortalURI: []*string{ - // to.Ptr("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiManagement/service/contoso")}, - // }, - // Title: to.Ptr("Contoso Europe Azure API Management"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Delete.json -func ExampleEnvironmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEnvironmentsClient().Delete(ctx, "contoso-resources", "contoso", "default", "public", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Head.json -func ExampleEnvironmentsClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEnvironmentsClient().Head(ctx, "contoso-resources", "contoso", "default", "public", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/fake/deletedservices_server.go b/sdk/resourcemanager/apicenter/armapicenter/fake/deletedservices_server.go new file mode 100644 index 000000000000..5c3499e633f0 --- /dev/null +++ b/sdk/resourcemanager/apicenter/armapicenter/fake/deletedservices_server.go @@ -0,0 +1,243 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/apicenter/armapicenter" + "net/http" + "net/url" + "regexp" +) + +// DeletedServicesServer is a fake server for instances of the armapicenter.DeletedServicesClient type. +type DeletedServicesServer struct { + // Delete is the fake for method DeletedServicesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, deletedServiceName string, options *armapicenter.DeletedServicesClientDeleteOptions) (resp azfake.Responder[armapicenter.DeletedServicesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DeletedServicesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, deletedServiceName string, options *armapicenter.DeletedServicesClientGetOptions) (resp azfake.Responder[armapicenter.DeletedServicesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DeletedServicesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, options *armapicenter.DeletedServicesClientListOptions) (resp azfake.PagerResponder[armapicenter.DeletedServicesClientListResponse]) + + // NewListBySubscriptionPager is the fake for method DeletedServicesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armapicenter.DeletedServicesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armapicenter.DeletedServicesClientListBySubscriptionResponse]) +} + +// NewDeletedServicesServerTransport creates a new instance of DeletedServicesServerTransport with the provided implementation. +// The returned DeletedServicesServerTransport instance is connected to an instance of armapicenter.DeletedServicesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeletedServicesServerTransport(srv *DeletedServicesServer) *DeletedServicesServerTransport { + return &DeletedServicesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armapicenter.DeletedServicesClientListResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armapicenter.DeletedServicesClientListBySubscriptionResponse]](), + } +} + +// DeletedServicesServerTransport connects instances of armapicenter.DeletedServicesClient to instances of DeletedServicesServer. +// Don't use this type directly, use NewDeletedServicesServerTransport instead. +type DeletedServicesServerTransport struct { + srv *DeletedServicesServer + newListPager *tracker[azfake.PagerResponder[armapicenter.DeletedServicesClientListResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armapicenter.DeletedServicesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for DeletedServicesServerTransport. +func (d *DeletedServicesServerTransport) 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 "DeletedServicesClient.Delete": + resp, err = d.dispatchDelete(req) + case "DeletedServicesClient.Get": + resp, err = d.dispatchGet(req) + case "DeletedServicesClient.NewListPager": + resp, err = d.dispatchNewListPager(req) + case "DeletedServicesClient.NewListBySubscriptionPager": + resp, err = d.dispatchNewListBySubscriptionPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DeletedServicesServerTransport) 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\.ApiCenter/deletedServices/(?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 + } + deletedServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deletedServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, deletedServiceNameParam, 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 *DeletedServicesServerTransport) 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\.ApiCenter/deletedServices/(?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 + } + deletedServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deletedServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, deletedServiceNameParam, 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).DeletedService, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).ETag; val != nil { + resp.Header.Set("ETag", *val) + } + return resp, nil +} + +func (d *DeletedServicesServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ApiCenter/deletedServices` + 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 + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armapicenter.DeletedServicesClientListOptions + if filterParam != nil { + options = &armapicenter.DeletedServicesClientListOptions{ + Filter: filterParam, + } + } + resp := d.srv.NewListPager(resourceGroupNameParam, options) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armapicenter.DeletedServicesClientListResponse, 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) { + 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 +} + +func (d *DeletedServicesServerTransport) 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\.ApiCenter/deletedServices` + 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 *armapicenter.DeletedServicesClientListBySubscriptionResponse, 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 +} diff --git a/sdk/resourcemanager/apicenter/armapicenter/fake/server_factory.go b/sdk/resourcemanager/apicenter/armapicenter/fake/server_factory.go index b6506db18d8e..2c238177f1e7 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/fake/server_factory.go +++ b/sdk/resourcemanager/apicenter/armapicenter/fake/server_factory.go @@ -22,6 +22,7 @@ type ServerFactory struct { APIDefinitionsServer APIDefinitionsServer APIVersionsServer APIVersionsServer ApisServer ApisServer + DeletedServicesServer DeletedServicesServer DeploymentsServer DeploymentsServer EnvironmentsServer EnvironmentsServer MetadataSchemasServer MetadataSchemasServer @@ -47,6 +48,7 @@ type ServerFactoryTransport struct { trAPIDefinitionsServer *APIDefinitionsServerTransport trAPIVersionsServer *APIVersionsServerTransport trApisServer *ApisServerTransport + trDeletedServicesServer *DeletedServicesServerTransport trDeploymentsServer *DeploymentsServerTransport trEnvironmentsServer *EnvironmentsServerTransport trMetadataSchemasServer *MetadataSchemasServerTransport @@ -79,6 +81,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ApisClient": initServer(s, &s.trApisServer, func() *ApisServerTransport { return NewApisServerTransport(&s.srv.ApisServer) }) resp, err = s.trApisServer.Do(req) + case "DeletedServicesClient": + initServer(s, &s.trDeletedServicesServer, func() *DeletedServicesServerTransport { + return NewDeletedServicesServerTransport(&s.srv.DeletedServicesServer) + }) + resp, err = s.trDeletedServicesServer.Do(req) case "DeploymentsClient": initServer(s, &s.trDeploymentsServer, func() *DeploymentsServerTransport { return NewDeploymentsServerTransport(&s.srv.DeploymentsServer) }) resp, err = s.trDeploymentsServer.Do(req) diff --git a/sdk/resourcemanager/apicenter/armapicenter/go.mod b/sdk/resourcemanager/apicenter/armapicenter/go.mod index 5f320f2d5ac2..cc4ea4dbca20 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/go.mod +++ b/sdk/resourcemanager/apicenter/armapicenter/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.9.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // 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.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client.go b/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client.go index a65c76d753b9..f050f410c940 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client.go @@ -46,7 +46,7 @@ func NewMetadataSchemasClient(subscriptionID string, credential azcore.TokenCred // CreateOrUpdate - Creates new or updates existing metadata schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - metadataSchemaName - The name of the metadata schema. @@ -99,7 +99,7 @@ func (client *MetadataSchemasClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -123,7 +123,7 @@ func (client *MetadataSchemasClient) createOrUpdateHandleResponse(resp *http.Res // Delete - Deletes specified metadata schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - metadataSchemaName - The name of the metadata schema. @@ -173,7 +173,7 @@ func (client *MetadataSchemasClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *MetadataSchemasClient) deleteCreateRequest(ctx context.Context, re // Get - Returns details of the metadata schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - metadataSchemaName - The name of the metadata schema. @@ -233,7 +233,7 @@ func (client *MetadataSchemasClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +253,7 @@ func (client *MetadataSchemasClient) getHandleResponse(resp *http.Response) (Met // Head - Checks if specified metadata schema exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - metadataSchemaName - The name of the metadata schema. @@ -303,7 +303,7 @@ func (client *MetadataSchemasClient) headCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,7 +311,7 @@ func (client *MetadataSchemasClient) headCreateRequest(ctx context.Context, reso // NewListPager - Returns a collection of metadata schemas. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - options - MetadataSchemasClientListOptions contains the optional parameters for the MetadataSchemasClient.NewListPager @@ -362,7 +362,7 @@ func (client *MetadataSchemasClient) listCreateRequest(ctx context.Context, reso if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client_example_test.go deleted file mode 100644 index a2719de48396..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/metadataschemas_client_example_test.go +++ /dev/null @@ -1,171 +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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_List.json -func ExampleMetadataSchemasClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetadataSchemasClient().NewListPager("contoso-resources", "contoso", &armapicenter.MetadataSchemasClientListOptions{Filter: 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.MetadataSchemaListResult = armapicenter.MetadataSchemaListResult{ - // Value: []*armapicenter.MetadataSchema{ - // { - // Name: to.Ptr("author"), - // Type: to.Ptr("Microsoft.ApiCenter/services/metadataSchemas"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/metadataSchemas/author"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.MetadataSchemaProperties{ - // Schema: to.Ptr("{\"type\":\"string\", \"title\":\"Author\", pattern: \"^[a-zA-Z]+$\"}"), - // AssignedTo: []*armapicenter.MetadataAssignment{ - // { - // Deprecated: to.Ptr(true), - // Entity: to.Ptr(armapicenter.MetadataAssignmentEntityAPI), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Get.json -func ExampleMetadataSchemasClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetadataSchemasClient().Get(ctx, "contoso-resources", "contoso", "lastName", 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.MetadataSchema = armapicenter.MetadataSchema{ - // Name: to.Ptr("author"), - // Type: to.Ptr("Microsoft.ApiCenter/services/metadataSchemas"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/metadataSchemas/author"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.MetadataSchemaProperties{ - // Schema: to.Ptr("{\"type\":\"string\", \"title\":\"Author\", pattern: \"^[a-zA-Z]+$\"}"), - // AssignedTo: []*armapicenter.MetadataAssignment{ - // { - // Deprecated: to.Ptr(true), - // Entity: to.Ptr(armapicenter.MetadataAssignmentEntityAPI), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_CreateOrUpdate.json -func ExampleMetadataSchemasClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetadataSchemasClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "author", armapicenter.MetadataSchema{}, 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.MetadataSchema = armapicenter.MetadataSchema{ - // Name: to.Ptr("author"), - // Type: to.Ptr("Microsoft.ApiCenter/services/metadataSchemas"), - // ID: to.Ptr("/subscriptions/a200340d-6b82-494d-9dbf-687ba6e33f9e/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/metadataSchemas/author"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.MetadataSchemaProperties{ - // Schema: to.Ptr("{\"type\":\"string\", \"title\":\"Author\", pattern: \"^[a-zA-Z]+$\"}"), - // AssignedTo: []*armapicenter.MetadataAssignment{ - // { - // Deprecated: to.Ptr(true), - // Entity: to.Ptr(armapicenter.MetadataAssignmentEntityAPI), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Delete.json -func ExampleMetadataSchemasClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMetadataSchemasClient().Delete(ctx, "contoso-resources", "contoso", "author", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Head.json -func ExampleMetadataSchemasClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMetadataSchemasClient().Head(ctx, "contoso-resources", "contoso", "author", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/models.go b/sdk/resourcemanager/apicenter/armapicenter/models.go index c9b0738a5521..9a2a1a3be5a3 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/models.go +++ b/sdk/resourcemanager/apicenter/armapicenter/models.go @@ -196,6 +196,44 @@ type Contact struct { URL *string } +// DeletedService - Soft-deleted service entity. +type DeletedService struct { + // The resource-specific properties for this resource. + Properties *DeletedServiceProperties + + // 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 +} + +// DeletedServiceListResult - The response of a DeletedService list operation. +type DeletedServiceListResult struct { + // READ-ONLY; The DeletedService items on this page + Value []*DeletedService + + // READ-ONLY; The link to the next page of items + NextLink *string +} + +// DeletedServiceProperties - Deleted service properties. +type DeletedServiceProperties struct { + // UTC date and time when the service will be automatically purged. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ + // as specified by the ISO 8601 standard. + ScheduledPurgeDate *time.Time + + // UTC date and time when the service was soft-deleted. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as + // specified by the ISO 8601 standard. + SoftDeletionDate *time.Time +} + // Deployment - API deployment entity. type Deployment struct { // The resource-specific properties for this resource. @@ -513,6 +551,9 @@ type ServiceListResult struct { // ServiceProperties - The properties of the service. type ServiceProperties struct { + // Flag used to restore soft-deleted API Center service. If specified and set to 'true' all other properties will be ignored. + Restore *bool + // READ-ONLY; Provisioning state of the service. ProvisioningState *ProvisioningState } @@ -522,10 +563,19 @@ type ServiceUpdate struct { // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity + // The resource-specific properties for this resource. + Properties *ServiceUpdateProperties + // Resource tags. Tags map[string]*string } +// ServiceUpdateProperties - The updatable properties of the Service. +type ServiceUpdateProperties struct { + // Flag used to restore soft-deleted API Center service. If specified and set to 'true' all other properties will be ignored. + Restore *bool +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). diff --git a/sdk/resourcemanager/apicenter/armapicenter/models_serde.go b/sdk/resourcemanager/apicenter/armapicenter/models_serde.go index daf60b417e31..c65a0a1b3a71 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/models_serde.go +++ b/sdk/resourcemanager/apicenter/armapicenter/models_serde.go @@ -529,6 +529,111 @@ func (c *Contact) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeletedService. +func (d DeletedService) 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 DeletedService. +func (d *DeletedService) UnmarshalJSON(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 DeletedServiceListResult. +func (d DeletedServiceListResult) 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 DeletedServiceListResult. +func (d *DeletedServiceListResult) UnmarshalJSON(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 DeletedServiceProperties. +func (d DeletedServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) + populateDateTimeRFC3339(objectMap, "softDeletionDate", d.SoftDeletionDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServiceProperties. +func (d *DeletedServiceProperties) UnmarshalJSON(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 "scheduledPurgeDate": + err = unpopulateDateTimeRFC3339(val, "ScheduledPurgeDate", &d.ScheduledPurgeDate) + delete(rawMsg, key) + case "softDeletionDate": + err = unpopulateDateTimeRFC3339(val, "SoftDeletionDate", &d.SoftDeletionDate) + 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 Deployment. func (d Deployment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1374,6 +1479,7 @@ func (s *ServiceListResult) UnmarshalJSON(data []byte) error { func (s ServiceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "restore", s.Restore) return json.Marshal(objectMap) } @@ -1389,6 +1495,9 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) + case "restore": + err = unpopulate(val, "Restore", &s.Restore) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1401,6 +1510,7 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { func (s ServiceUpdate) 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) } @@ -1417,6 +1527,9 @@ func (s *ServiceUpdate) UnmarshalJSON(data []byte) error { 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) @@ -1428,6 +1541,33 @@ func (s *ServiceUpdate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServiceUpdateProperties. +func (s ServiceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "restore", s.Restore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceUpdateProperties. +func (s *ServiceUpdateProperties) UnmarshalJSON(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 "restore": + err = unpopulate(val, "Restore", &s.Restore) + 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) diff --git a/sdk/resourcemanager/apicenter/armapicenter/operations_client.go b/sdk/resourcemanager/apicenter/armapicenter/operations_client.go index ccfa9fd15c18..6e7324bdfcbd 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/operations_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/operations_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/operations_client_example_test.go deleted file mode 100644 index 6ddc58d5824d..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-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 := armapicenter.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 = armapicenter.OperationListResult{ - // Value: []*armapicenter.Operation{ - // { - // Name: to.Ptr("Microsoft.ApiCenter/services/read"), - // Display: &armapicenter.OperationDisplay{ - // Description: to.Ptr("Lists registered services"), - // Operation: to.Ptr("Lists services"), - // Provider: to.Ptr("Microsoft.ApiCenter"), - // Resource: to.Ptr("services"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/options.go b/sdk/resourcemanager/apicenter/armapicenter/options.go index 7bd7574e65a2..e554f9ccbb3d 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/options.go +++ b/sdk/resourcemanager/apicenter/armapicenter/options.go @@ -101,6 +101,28 @@ type ApisClientListOptions struct { Filter *string } +// DeletedServicesClientDeleteOptions contains the optional parameters for the DeletedServicesClient.Delete method. +type DeletedServicesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DeletedServicesClientGetOptions contains the optional parameters for the DeletedServicesClient.Get method. +type DeletedServicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeletedServicesClientListBySubscriptionOptions contains the optional parameters for the DeletedServicesClient.NewListBySubscriptionPager +// method. +type DeletedServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// DeletedServicesClientListOptions contains the optional parameters for the DeletedServicesClient.NewListPager method. +type DeletedServicesClientListOptions struct { + // OData filter parameter. + Filter *string +} + // DeploymentsClientCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.CreateOrUpdate method. type DeploymentsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/apicenter/armapicenter/responses.go b/sdk/resourcemanager/apicenter/armapicenter/responses.go index dd70dfd5b3f8..76653899e854 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/responses.go +++ b/sdk/resourcemanager/apicenter/armapicenter/responses.go @@ -124,6 +124,32 @@ type ApisClientListResponse struct { APIListResult } +// DeletedServicesClientDeleteResponse contains the response from method DeletedServicesClient.Delete. +type DeletedServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// DeletedServicesClientGetResponse contains the response from method DeletedServicesClient.Get. +type DeletedServicesClientGetResponse struct { + // Soft-deleted service entity. + DeletedService + + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// DeletedServicesClientListBySubscriptionResponse contains the response from method DeletedServicesClient.NewListBySubscriptionPager. +type DeletedServicesClientListBySubscriptionResponse struct { + // The response of a DeletedService list operation. + DeletedServiceListResult +} + +// DeletedServicesClientListResponse contains the response from method DeletedServicesClient.NewListPager. +type DeletedServicesClientListResponse struct { + // The response of a DeletedService list operation. + DeletedServiceListResult +} + // DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.CreateOrUpdate. type DeploymentsClientCreateOrUpdateResponse struct { // API deployment entity. diff --git a/sdk/resourcemanager/apicenter/armapicenter/services_client.go b/sdk/resourcemanager/apicenter/armapicenter/services_client.go index cadf0979e3e3..95e6bbef6e4b 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/services_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/services_client.go @@ -46,7 +46,7 @@ func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates new or updates existing API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - resource - Resource create parameters. @@ -93,7 +93,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -114,7 +114,7 @@ func (client *ServicesClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes specified service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - options - ServicesClientDeleteOptions contains the optional parameters for the ServicesClient.Delete method. @@ -159,7 +159,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -168,7 +168,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG // BeginExportMetadataSchema - Exports the effective metadata schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - body - The content of the action request @@ -195,7 +195,7 @@ func (client *ServicesClient) BeginExportMetadataSchema(ctx context.Context, res // ExportMetadataSchema - Exports the effective metadata schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview func (client *ServicesClient) exportMetadataSchema(ctx context.Context, resourceGroupName string, serviceName string, body MetadataSchemaExportRequest, options *ServicesClientBeginExportMetadataSchemaOptions) (*http.Response, error) { var err error const operationName = "ServicesClient.BeginExportMetadataSchema" @@ -237,7 +237,7 @@ func (client *ServicesClient) exportMetadataSchemaCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -249,7 +249,7 @@ func (client *ServicesClient) exportMetadataSchemaCreateRequest(ctx context.Cont // Get - Returns details of the service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. @@ -295,7 +295,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,7 +312,7 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl // NewListByResourceGroupPager - Returns a collection of services within the resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager // method. @@ -355,7 +355,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -372,7 +372,7 @@ func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Lists services within an Azure subscription. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager // method. func (client *ServicesClient) NewListBySubscriptionPager(options *ServicesClientListBySubscriptionOptions) *runtime.Pager[ServicesClientListBySubscriptionResponse] { @@ -410,7 +410,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -428,7 +428,7 @@ func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Updates existing service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - properties - The resource properties to be updated. @@ -475,7 +475,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") 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/apicenter/armapicenter/services_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/services_client_example_test.go deleted file mode 100644 index fb461dc0ea47..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/services_client_example_test.go +++ /dev/null @@ -1,300 +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 armapicenter_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/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ListBySubscription.json -func ExampleServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServicesClient().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.ServiceListResult = armapicenter.ServiceListResult{ - // Value: []*armapicenter.Service{ - // { - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.ApiCenter/services"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armapicenter.ManagedServiceIdentity{ - // Type: to.Ptr(armapicenter.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armapicenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armapicenter.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armapicenter.ServiceProperties{ - // ProvisioningState: to.Ptr(armapicenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ListByResourceGroup.json -func ExampleServicesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServicesClient().NewListByResourceGroupPager("contoso-resources", 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.ServiceListResult = armapicenter.ServiceListResult{ - // Value: []*armapicenter.Service{ - // { - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.ApiCenter/services"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armapicenter.ManagedServiceIdentity{ - // Type: to.Ptr(armapicenter.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armapicenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armapicenter.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armapicenter.ServiceProperties{ - // ProvisioningState: to.Ptr(armapicenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Get.json -func ExampleServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Get(ctx, "contoso-resources", "contoso", 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.Service = armapicenter.Service{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.ApiCenter/services"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armapicenter.ManagedServiceIdentity{ - // Type: to.Ptr(armapicenter.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armapicenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armapicenter.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armapicenter.ServiceProperties{ - // ProvisioningState: to.Ptr(armapicenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_CreateOrUpdate.json -func ExampleServicesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", armapicenter.Service{ - Location: to.Ptr("East US"), - Tags: map[string]*string{}, - Identity: &armapicenter.ManagedServiceIdentity{ - Type: to.Ptr(armapicenter.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - UserAssignedIdentities: map[string]*armapicenter.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}, - }, - }, - Properties: &armapicenter.ServiceProperties{}, - }, 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.Service = armapicenter.Service{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.ApiCenter/services"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armapicenter.ManagedServiceIdentity{ - // Type: to.Ptr(armapicenter.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armapicenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armapicenter.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armapicenter.ServiceProperties{ - // ProvisioningState: to.Ptr(armapicenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Update.json -func ExampleServicesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "contoso-resources", "contoso", armapicenter.ServiceUpdate{}, 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.Service = armapicenter.Service{ - // Name: to.Ptr("contoso"), - // Type: to.Ptr("Microsoft.ApiCenter/services"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armapicenter.ManagedServiceIdentity{ - // Type: to.Ptr(armapicenter.ManagedServiceIdentityType("SystemAssigned, UserAssigned")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armapicenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": &armapicenter.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armapicenter.ServiceProperties{ - // ProvisioningState: to.Ptr(armapicenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Delete.json -func ExampleServicesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServicesClient().Delete(ctx, "contoso-resources", "contoso", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ExportMetadataSchema.json -func ExampleServicesClient_BeginExportMetadataSchema() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().BeginExportMetadataSchema(ctx, "contoso-resources", "contoso", armapicenter.MetadataSchemaExportRequest{}, 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.MetadataSchemaExportResult = armapicenter.MetadataSchemaExportResult{ - // Format: to.Ptr(armapicenter.MetadataSchemaExportFormat("json-schema")), - // Value: to.Ptr("{\"type\":\"object\",\"properties\":{ ... }}"), - // } -} diff --git a/sdk/resourcemanager/apicenter/armapicenter/workspaces_client.go b/sdk/resourcemanager/apicenter/armapicenter/workspaces_client.go index 2a83f1c40101..cbda77109b8b 100644 --- a/sdk/resourcemanager/apicenter/armapicenter/workspaces_client.go +++ b/sdk/resourcemanager/apicenter/armapicenter/workspaces_client.go @@ -46,7 +46,7 @@ func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates new or updates existing workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -99,7 +99,7 @@ func (client *WorkspacesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -123,7 +123,7 @@ func (client *WorkspacesClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes specified workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -173,7 +173,7 @@ func (client *WorkspacesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *WorkspacesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Returns details of the workspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -233,7 +233,7 @@ func (client *WorkspacesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +253,7 @@ func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (Workspac // Head - Checks if specified workspace exists. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - workspaceName - The name of the workspace. @@ -303,7 +303,7 @@ func (client *WorkspacesClient) headCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,7 +311,7 @@ func (client *WorkspacesClient) headCreateRequest(ctx context.Context, resourceG // NewListPager - Returns a collection of workspaces. // -// Generated from API version 2024-03-01 +// Generated from API version 2024-03-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serviceName - The name of Azure API Center service. // - options - WorkspacesClientListOptions contains the optional parameters for the WorkspacesClient.NewListPager method. @@ -361,7 +361,7 @@ func (client *WorkspacesClient) listCreateRequest(ctx context.Context, resourceG if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2024-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/apicenter/armapicenter/workspaces_client_example_test.go b/sdk/resourcemanager/apicenter/armapicenter/workspaces_client_example_test.go deleted file mode 100644 index 10109a9fda0f..000000000000 --- a/sdk/resourcemanager/apicenter/armapicenter/workspaces_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 armapicenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apicenter/armapicenter" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_List.json -func ExampleWorkspacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkspacesClient().NewListPager("contoso-resources", "contoso", &armapicenter.WorkspacesClientListOptions{Filter: 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.WorkspaceListResult = armapicenter.WorkspaceListResult{ - // Value: []*armapicenter.Workspace{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiCenter/services/workspaces"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.WorkspaceProperties{ - // Title: to.Ptr("default"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Get.json -func ExampleWorkspacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspacesClient().Get(ctx, "contoso-resources", "contoso", "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.Workspace = armapicenter.Workspace{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiCenter/services/workspaces"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.WorkspaceProperties{ - // Title: to.Ptr("default"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_CreateOrUpdate.json -func ExampleWorkspacesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkspacesClient().CreateOrUpdate(ctx, "contoso-resources", "contoso", "default", armapicenter.Workspace{}, 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.Workspace = armapicenter.Workspace{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.ApiCenter/services/workspaces"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiCenter/services/contoso/workspaces/default"), - // SystemData: &armapicenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-03T18:27:09.128Z"); return t}()), - // }, - // Properties: &armapicenter.WorkspaceProperties{ - // Title: to.Ptr("default"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Delete.json -func ExampleWorkspacesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWorkspacesClient().Delete(ctx, "contoso-resources", "contoso", "default", 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/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Head.json -func ExampleWorkspacesClient_Head() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapicenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWorkspacesClient().Head(ctx, "contoso-resources", "contoso", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md index bd0c34b7f51f..7a313ab02c13 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-08-09) +### 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/constants.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/constants.go index 8669e3642a58..0a4e159d5e8c 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/constants.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/constants.go @@ -10,7 +10,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_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/go.mod b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.mod index 8b2b0d6e3f47..e4e7d558d758 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 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/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_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/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_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/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 1191639b0689..e8da26455f29 100644 --- a/sdk/resourcemanager/astro/armastro/CHANGELOG.md +++ b/sdk/resourcemanager/astro/armastro/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2024-08-09) +### Other Changes + + ## 0.1.0 (2024-02-23) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/astro/armastro` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). 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/constants.go b/sdk/resourcemanager/astro/armastro/constants.go index f2c943d2a871..6635e61b5b21 100644 --- a/sdk/resourcemanager/astro/armastro/constants.go +++ b/sdk/resourcemanager/astro/armastro/constants.go @@ -10,7 +10,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. diff --git a/sdk/resourcemanager/astro/armastro/go.mod b/sdk/resourcemanager/astro/armastro/go.mod index e2c1aa2450fc..6073a0f29852 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/astro/armastro/go.sum b/sdk/resourcemanager/astro/armastro/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/astro/armastro/go.sum +++ b/sdk/resourcemanager/astro/armastro/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= 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..19b9abaa6769 100644 --- a/sdk/resourcemanager/astro/armastro/models.go +++ b/sdk/resourcemanager/astro/armastro/models.go @@ -66,7 +66,7 @@ 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 @@ -258,7 +258,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. 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/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/avs/armavs/CHANGELOG.md b/sdk/resourcemanager/avs/armavs/CHANGELOG.md index ef37ed52dfbf..5cb0ad46c3ec 100644 --- a/sdk/resourcemanager/avs/armavs/CHANGELOG.md +++ b/sdk/resourcemanager/avs/armavs/CHANGELOG.md @@ -1,5 +1,91 @@ # Release History +## 2.0.0 (2024-08-09) +### Breaking Changes + +- Function `*WorkloadNetworksClient.Get` parameter(s) have been changed from `(context.Context, string, string, WorkloadNetworkName, *WorkloadNetworksClientGetOptions)` to `(context.Context, string, string, *WorkloadNetworksClientGetOptions)` +- Type of `Operation.Origin` has been changed from `*string` to `*Origin` +- Enum `WorkloadNetworkName` has been removed +- Struct `LogSpecification` has been removed +- Struct `MetricDimension` has been removed +- Struct `MetricSpecification` has been removed +- Struct `OperationList` has been removed +- Struct `OperationProperties` has been removed +- Struct `ServiceSpecification` has been removed +- Field `Properties` of struct `Operation` has been removed +- Field `OperationList` of struct `OperationsClientListResponse` has been removed + +### Features Added + +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `CloudLinkProvisioningState` with values `CloudLinkProvisioningStateCanceled`, `CloudLinkProvisioningStateFailed`, `CloudLinkProvisioningStateSucceeded` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `DNSZoneType` with values `DNSZoneTypePrivate`, `DNSZoneTypePublic` +- New enum type `HcxEnterpriseSiteProvisioningState` with values `HcxEnterpriseSiteProvisioningStateCanceled`, `HcxEnterpriseSiteProvisioningStateFailed`, `HcxEnterpriseSiteProvisioningStateSucceeded` +- New enum type `IscsiPathProvisioningState` with values `IscsiPathProvisioningStateBuilding`, `IscsiPathProvisioningStateCanceled`, `IscsiPathProvisioningStateDeleting`, `IscsiPathProvisioningStateFailed`, `IscsiPathProvisioningStatePending`, `IscsiPathProvisioningStateSucceeded`, `IscsiPathProvisioningStateUpdating` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `SKUTier` with values `SKUTierBasic`, `SKUTierFree`, `SKUTierPremium`, `SKUTierStandard` +- New enum type `ScriptCmdletAudience` with values `ScriptCmdletAudienceAny`, `ScriptCmdletAudienceAutomation` +- New enum type `ScriptCmdletProvisioningState` with values `ScriptCmdletProvisioningStateCanceled`, `ScriptCmdletProvisioningStateFailed`, `ScriptCmdletProvisioningStateSucceeded` +- New enum type `ScriptPackageProvisioningState` with values `ScriptPackageProvisioningStateCanceled`, `ScriptPackageProvisioningStateFailed`, `ScriptPackageProvisioningStateSucceeded` +- New enum type `VirtualMachineProvisioningState` with values `VirtualMachineProvisioningStateCanceled`, `VirtualMachineProvisioningStateFailed`, `VirtualMachineProvisioningStateSucceeded` +- New enum type `WorkloadNetworkProvisioningState` with values `WorkloadNetworkProvisioningStateBuilding`, `WorkloadNetworkProvisioningStateCanceled`, `WorkloadNetworkProvisioningStateDeleting`, `WorkloadNetworkProvisioningStateFailed`, `WorkloadNetworkProvisioningStateSucceeded`, `WorkloadNetworkProvisioningStateUpdating` +- New function `*ClientFactory.NewIscsiPathsClient() *IscsiPathsClient` +- New function `NewIscsiPathsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*IscsiPathsClient, error)` +- New function `*IscsiPathsClient.BeginCreateOrUpdate(context.Context, string, string, IscsiPath, *IscsiPathsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IscsiPathsClientCreateOrUpdateResponse], error)` +- New function `*IscsiPathsClient.BeginDelete(context.Context, string, string, *IscsiPathsClientBeginDeleteOptions) (*runtime.Poller[IscsiPathsClientDeleteResponse], error)` +- New function `*IscsiPathsClient.Get(context.Context, string, string, *IscsiPathsClientGetOptions) (IscsiPathsClientGetResponse, error)` +- New function `*IscsiPathsClient.NewListByPrivateCloudPager(string, string, *IscsiPathsClientListByPrivateCloudOptions) *runtime.Pager[IscsiPathsClientListByPrivateCloudResponse]` +- New struct `ElasticSanVolume` +- New struct `IscsiPath` +- New struct `IscsiPathListResult` +- New struct `IscsiPathProperties` +- New struct `OperationListResult` +- New struct `SystemData` +- New struct `WorkloadNetworkProperties` +- New field `SystemData` in struct `Addon` +- New field `SystemData` in struct `CloudLink` +- New field `ProvisioningState` in struct `CloudLinkProperties` +- New field `SystemData` in struct `Cluster` +- New field `VsanDatastoreName` in struct `ClusterProperties` +- New field `SKU` in struct `ClusterUpdate` +- New field `SystemData` in struct `Datastore` +- New field `ElasticSanVolume` in struct `DatastoreProperties` +- New field `HcxCloudManagerIP`, `NsxtManagerIP`, `VcenterIP` in struct `Endpoints` +- New field `SystemData` in struct `ExpressRouteAuthorization` +- New field `SystemData` in struct `GlobalReachConnection` +- New field `SystemData` in struct `HcxEnterpriseSite` +- New field `ProvisioningState` in struct `HcxEnterpriseSiteProperties` +- New field `VsanDatastoreName` in struct `ManagementCluster` +- New field `ActionType` in struct `Operation` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `PlacementPolicy` +- New field `SystemData` in struct `PrivateCloud` +- New field `DNSZoneType`, `VirtualNetworkID` in struct `PrivateCloudProperties` +- New field `SKU` in struct `PrivateCloudUpdate` +- New field `DNSZoneType` in struct `PrivateCloudUpdateProperties` +- New field `Capacity`, `Family`, `Size`, `Tier` in struct `SKU` +- New field `SystemData` in struct `ScriptCmdlet` +- New field `Audience`, `ProvisioningState` in struct `ScriptCmdletProperties` +- New field `SystemData` in struct `ScriptExecution` +- New field `SystemData` in struct `ScriptPackage` +- New field `ProvisioningState` in struct `ScriptPackageProperties` +- New field `SystemData` in struct `VirtualMachine` +- New field `ProvisioningState` in struct `VirtualMachineProperties` +- New field `Properties`, `SystemData` in struct `WorkloadNetwork` +- New field `SystemData` in struct `WorkloadNetworkDNSService` +- New field `SystemData` in struct `WorkloadNetworkDNSZone` +- New field `SystemData` in struct `WorkloadNetworkDhcp` +- New field `SystemData` in struct `WorkloadNetworkGateway` +- New field `ProvisioningState` in struct `WorkloadNetworkGatewayProperties` +- New field `SystemData` in struct `WorkloadNetworkPortMirroring` +- New field `SystemData` in struct `WorkloadNetworkPublicIP` +- New field `SystemData` in struct `WorkloadNetworkSegment` +- New field `SystemData` in struct `WorkloadNetworkVMGroup` +- New field `SystemData` in struct `WorkloadNetworkVirtualMachine` +- New field `ProvisioningState` in struct `WorkloadNetworkVirtualMachineProperties` + + ## 2.0.0-beta.1 (2024-06-28) ### Breaking Changes 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 69b6c58e6031..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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_example_test.go b/sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go deleted file mode 100644 index 027c658d6d60..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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 c8d756b205c0..95a2fd015e73 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/9f9d14b5db982b1d554651348adc9bef4b098bdb/specification/vmware/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9f9d14b5db982b1d554651348adc9bef4b098bdb/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-beta.1 -tag: package-2023-09-01 +module-version: 2.0.0 ``` \ No newline at end of file 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 9bbf34b5622a..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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_example_test.go b/sdk/resourcemanager/avs/armavs/clusters_client_example_test.go deleted file mode 100644 index 1a71bc6346b5..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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 9df0fbb4bd0b..6df69d74d1a7 100644 --- a/sdk/resourcemanager/avs/armavs/constants.go +++ b/sdk/resourcemanager/avs/armavs/constants.go @@ -10,7 +10,7 @@ package armavs const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" - moduleVersion = "v2.0.0-beta.1" + 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/avs/armavs/datastores_client_example_test.go b/sdk/resourcemanager/avs/armavs/datastores_client_example_test.go deleted file mode 100644 index 6d421c9892cd..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/globalreachconnections_client_example_test.go b/sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go deleted file mode 100644 index 8279b4880c85..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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 42d3fd7379df..a12cd6bc95f3 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/avs/armavs/go.sum b/sdk/resourcemanager/avs/armavs/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/avs/armavs/go.sum +++ b/sdk/resourcemanager/avs/armavs/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 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 5de08ce32c31..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/iscsipaths_client_example_test.go b/sdk/resourcemanager/avs/armavs/iscsipaths_client_example_test.go deleted file mode 100644 index 9c28fd2540ba..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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_example_test.go b/sdk/resourcemanager/avs/armavs/locations_client_example_test.go deleted file mode 100644 index 0bc340d094a1..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/operations_client_example_test.go b/sdk/resourcemanager/avs/armavs/operations_client_example_test.go deleted file mode 100644 index 59bba2cdedaf..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/placementpolicies_client_example_test.go b/sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go deleted file mode 100644 index e190dbf8d1ed..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/privateclouds_client_example_test.go b/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go deleted file mode 100644 index 7b75741cef63..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/scriptcmdlets_client_example_test.go b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go deleted file mode 100644 index 641cb1f8705b..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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_example_test.go b/sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go deleted file mode 100644 index 2fbc8e868539..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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_example_test.go b/sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go deleted file mode 100644 index e1ce55181982..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/virtualmachines_client_example_test.go b/sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go deleted file mode 100644 index 5c56d23e8099..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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_example_test.go b/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go deleted file mode 100644 index bbc478dad830..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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/9f9d14b5db982b1d554651348adc9bef4b098bdb/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/azurestackhci/armazurestackhci/CHANGELOG.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md index 352477f6afca..27bb7fedb3d5 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md @@ -1,5 +1,362 @@ # Release History +## 2.0.0 (2024-08-09) +### Breaking Changes + +- Function `*ExtensionsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, string, Extension, *ExtensionsClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, ExtensionPatch, *ExtensionsClientBeginUpdateOptions)` + +### Features Added + +- New value `ArcSettingAggregateStateAccepted`, `ArcSettingAggregateStateDisableInProgress`, `ArcSettingAggregateStateProvisioning` added to enum type `ArcSettingAggregateState` +- New value `ExtensionAggregateStateAccepted`, `ExtensionAggregateStateProvisioning`, `ExtensionAggregateStateUpgradeFailedRollbackSucceeded` added to enum type `ExtensionAggregateState` +- New value `NodeArcStateAccepted`, `NodeArcStateDisableInProgress`, `NodeArcStateInProgress`, `NodeArcStatePartiallyConnected`, `NodeArcStatePartiallySucceeded`, `NodeArcStateProvisioning` added to enum type `NodeArcState` +- New value `NodeExtensionStateAccepted`, `NodeExtensionStateInProgress`, `NodeExtensionStatePartiallyConnected`, `NodeExtensionStatePartiallySucceeded`, `NodeExtensionStateProvisioning` added to enum type `NodeExtensionState` +- New value `ProvisioningStateConnected`, `ProvisioningStateCreating`, `ProvisioningStateDeleted`, `ProvisioningStateDeleting`, `ProvisioningStateDisableInProgress`, `ProvisioningStateDisconnected`, `ProvisioningStateError`, `ProvisioningStateInProgress`, `ProvisioningStateMoving`, `ProvisioningStateNotSpecified`, `ProvisioningStatePartiallyConnected`, `ProvisioningStatePartiallySucceeded`, `ProvisioningStateUpdating` added to enum type `ProvisioningState` +- New value `StatusDeploymentFailed`, `StatusDeploymentInProgress`, `StatusDeploymentSuccess`, `StatusFailed`, `StatusInProgress`, `StatusNotSpecified`, `StatusSucceeded`, `StatusValidationFailed`, `StatusValidationInProgress`, `StatusValidationSuccess` added to enum type `Status` +- New enum type `AvailabilityType` with values `AvailabilityTypeLocal`, `AvailabilityTypeNotify`, `AvailabilityTypeOnline` +- New enum type `CloudInitDataSource` with values `CloudInitDataSourceAzure`, `CloudInitDataSourceNoCloud` +- New enum type `ClusterNodeType` with values `ClusterNodeTypeFirstParty`, `ClusterNodeTypeThirdParty` +- New enum type `ComplianceAssignmentType` with values `ComplianceAssignmentTypeApplyAndAutoCorrect`, `ComplianceAssignmentTypeAudit` +- New enum type `ComplianceStatus` with values `ComplianceStatusCompliant`, `ComplianceStatusNonCompliant`, `ComplianceStatusPending` +- New enum type `ConnectivityStatus` with values `ConnectivityStatusConnected`, `ConnectivityStatusDisconnected`, `ConnectivityStatusNotConnectedRecently`, `ConnectivityStatusNotSpecified`, `ConnectivityStatusNotYetRegistered`, `ConnectivityStatusPartiallyConnected` +- New enum type `DeploymentMode` with values `DeploymentModeDeploy`, `DeploymentModeValidate` +- New enum type `DiskFileFormat` with values `DiskFileFormatVhd`, `DiskFileFormatVhdx` +- New enum type `ExtendedLocationTypes` with values `ExtendedLocationTypesCustomLocation` +- New enum type `ExtensionManagedBy` with values `ExtensionManagedByAzure`, `ExtensionManagedByUser` +- New enum type `HealthState` with values `HealthStateError`, `HealthStateFailure`, `HealthStateInProgress`, `HealthStateSuccess`, `HealthStateUnknown`, `HealthStateWarning` +- New enum type `HyperVGeneration` with values `HyperVGenerationV1`, `HyperVGenerationV2` +- New enum type `IPAllocationMethodEnum` with values `IPAllocationMethodEnumDynamic`, `IPAllocationMethodEnumStatic` +- New enum type `IPPoolTypeEnum` with values `IPPoolTypeEnumVM`, `IPPoolTypeEnumVippool` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `OemActivation` with values `OemActivationDisabled`, `OemActivationEnabled` +- New enum type `OperatingSystemTypes` with values `OperatingSystemTypesLinux`, `OperatingSystemTypesWindows` +- New enum type `PowerStateEnum` with values `PowerStateEnumDeallocated`, `PowerStateEnumDeallocating`, `PowerStateEnumRunning`, `PowerStateEnumStarting`, `PowerStateEnumStopped`, `PowerStateEnumStopping`, `PowerStateEnumUnknown` +- New enum type `ProvisioningAction` with values `ProvisioningActionInstall`, `ProvisioningActionRepair`, `ProvisioningActionUninstall` +- New enum type `ProvisioningStateEnum` with values `ProvisioningStateEnumAccepted`, `ProvisioningStateEnumCanceled`, `ProvisioningStateEnumDeleting`, `ProvisioningStateEnumFailed`, `ProvisioningStateEnumInProgress`, `ProvisioningStateEnumSucceeded` +- New enum type `RebootRequirement` with values `RebootRequirementFalse`, `RebootRequirementTrue`, `RebootRequirementUnknown` +- New enum type `SecurityTypes` with values `SecurityTypesConfidentialVM`, `SecurityTypesTrustedLaunch` +- New enum type `Severity` with values `SeverityCritical`, `SeverityHidden`, `SeverityInformational`, `SeverityWarning` +- New enum type `SoftwareAssuranceIntent` with values `SoftwareAssuranceIntentDisable`, `SoftwareAssuranceIntentEnable` +- New enum type `SoftwareAssuranceStatus` with values `SoftwareAssuranceStatusDisabled`, `SoftwareAssuranceStatusEnabled` +- New enum type `State` with values `StateAdditionalContentRequired`, `StateDownloadFailed`, `StateDownloading`, `StateHasPrerequisite`, `StateHealthCheckFailed`, `StateHealthChecking`, `StateInstallationFailed`, `StateInstalled`, `StateInstalling`, `StateInvalid`, `StateNotApplicableBecauseAnotherUpdateIsInProgress`, `StateObsolete`, `StatePreparationFailed`, `StatePreparing`, `StateReady`, `StateReadyToInstall`, `StateRecalled`, `StateScanFailed`, `StateScanInProgress` +- New enum type `StatusLevelTypes` with values `StatusLevelTypesError`, `StatusLevelTypesInfo`, `StatusLevelTypesWarning` +- New enum type `StatusTypes` with values `StatusTypesFailed`, `StatusTypesInProgress`, `StatusTypesSucceeded` +- New enum type `UpdateRunPropertiesState` with values `UpdateRunPropertiesStateFailed`, `UpdateRunPropertiesStateInProgress`, `UpdateRunPropertiesStateSucceeded`, `UpdateRunPropertiesStateUnknown` +- New enum type `UpdateSummariesPropertiesState` with values `UpdateSummariesPropertiesStateAppliedSuccessfully`, `UpdateSummariesPropertiesStateNeedsAttention`, `UpdateSummariesPropertiesStatePreparationFailed`, `UpdateSummariesPropertiesStatePreparationInProgress`, `UpdateSummariesPropertiesStateUnknown`, `UpdateSummariesPropertiesStateUpdateAvailable`, `UpdateSummariesPropertiesStateUpdateFailed`, `UpdateSummariesPropertiesStateUpdateInProgress` +- New enum type `VMSizeEnum` with values `VMSizeEnumCustom`, `VMSizeEnumDefault`, `VMSizeEnumStandardA2V2`, `VMSizeEnumStandardA4V2`, `VMSizeEnumStandardD16SV3`, `VMSizeEnumStandardD2SV3`, `VMSizeEnumStandardD32SV3`, `VMSizeEnumStandardD4SV3`, `VMSizeEnumStandardD8SV3`, `VMSizeEnumStandardDS13V2`, `VMSizeEnumStandardDS2V2`, `VMSizeEnumStandardDS3V2`, `VMSizeEnumStandardDS4V2`, `VMSizeEnumStandardDS5V2`, `VMSizeEnumStandardK8S2V1`, `VMSizeEnumStandardK8S3V1`, `VMSizeEnumStandardK8S4V1`, `VMSizeEnumStandardK8S5V1`, `VMSizeEnumStandardK8SV1`, `VMSizeEnumStandardNK12`, `VMSizeEnumStandardNK6`, `VMSizeEnumStandardNV12`, `VMSizeEnumStandardNV6` +- New function `*ArcSettingsClient.ConsentAndInstallDefaultExtensions(context.Context, string, string, string, *ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (ArcSettingsClientConsentAndInstallDefaultExtensionsResponse, error)` +- New function `*ArcSettingsClient.BeginInitializeDisableProcess(context.Context, string, string, string, *ArcSettingsClientBeginInitializeDisableProcessOptions) (*runtime.Poller[ArcSettingsClientInitializeDisableProcessResponse], error)` +- New function `*ClientFactory.NewDeploymentSettingsClient() *DeploymentSettingsClient` +- New function `*ClientFactory.NewEdgeDevicesClient() *EdgeDevicesClient` +- New function `*ClientFactory.NewGalleryImagesClient() *GalleryImagesClient` +- New function `*ClientFactory.NewGuestAgentClient() *GuestAgentClient` +- New function `*ClientFactory.NewGuestAgentsClient() *GuestAgentsClient` +- New function `*ClientFactory.NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient` +- New function `*ClientFactory.NewLogicalNetworksClient() *LogicalNetworksClient` +- New function `*ClientFactory.NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient` +- New function `*ClientFactory.NewNetworkInterfacesClient() *NetworkInterfacesClient` +- New function `*ClientFactory.NewOffersClient() *OffersClient` +- New function `*ClientFactory.NewPublishersClient() *PublishersClient` +- New function `*ClientFactory.NewSKUsClient() *SKUsClient` +- New function `*ClientFactory.NewSecuritySettingsClient() *SecuritySettingsClient` +- New function `*ClientFactory.NewStorageContainersClient() *StorageContainersClient` +- New function `*ClientFactory.NewUpdateRunsClient() *UpdateRunsClient` +- New function `*ClientFactory.NewUpdateSummariesClient() *UpdateSummariesClient` +- New function `*ClientFactory.NewUpdatesClient() *UpdatesClient` +- New function `*ClientFactory.NewVirtualHardDisksClient() *VirtualHardDisksClient` +- New function `*ClientFactory.NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient` +- New function `*ClustersClient.BeginExtendSoftwareAssuranceBenefit(context.Context, string, string, SoftwareAssuranceChangeRequest, *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*runtime.Poller[ClustersClientExtendSoftwareAssuranceBenefitResponse], error)` +- New function `NewDeploymentSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeploymentSettingsClient, error)` +- New function `*DeploymentSettingsClient.BeginCreateOrUpdate(context.Context, string, string, string, DeploymentSetting, *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentSettingsClientCreateOrUpdateResponse], error)` +- New function `*DeploymentSettingsClient.BeginDelete(context.Context, string, string, string, *DeploymentSettingsClientBeginDeleteOptions) (*runtime.Poller[DeploymentSettingsClientDeleteResponse], error)` +- New function `*DeploymentSettingsClient.Get(context.Context, string, string, string, *DeploymentSettingsClientGetOptions) (DeploymentSettingsClientGetResponse, error)` +- New function `*DeploymentSettingsClient.NewListByClustersPager(string, string, *DeploymentSettingsClientListByClustersOptions) *runtime.Pager[DeploymentSettingsClientListByClustersResponse]` +- New function `NewEdgeDevicesClient(azcore.TokenCredential, *arm.ClientOptions) (*EdgeDevicesClient, error)` +- New function `*EdgeDevicesClient.BeginCreateOrUpdate(context.Context, string, string, EdgeDevice, *EdgeDevicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EdgeDevicesClientCreateOrUpdateResponse], error)` +- New function `*EdgeDevicesClient.BeginDelete(context.Context, string, string, *EdgeDevicesClientBeginDeleteOptions) (*runtime.Poller[EdgeDevicesClientDeleteResponse], error)` +- New function `*EdgeDevicesClient.Get(context.Context, string, string, *EdgeDevicesClientGetOptions) (EdgeDevicesClientGetResponse, error)` +- New function `*EdgeDevicesClient.NewListPager(string, *EdgeDevicesClientListOptions) *runtime.Pager[EdgeDevicesClientListResponse]` +- New function `*EdgeDevicesClient.BeginValidate(context.Context, string, string, ValidateRequest, *EdgeDevicesClientBeginValidateOptions) (*runtime.Poller[EdgeDevicesClientValidateResponse], error)` +- New function `*ExtensionsClient.BeginUpgrade(context.Context, string, string, string, string, ExtensionUpgradeParameters, *ExtensionsClientBeginUpgradeOptions) (*runtime.Poller[ExtensionsClientUpgradeResponse], error)` +- New function `NewGalleryImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GalleryImagesClient, error)` +- New function `*GalleryImagesClient.BeginCreateOrUpdate(context.Context, string, string, GalleryImages, *GalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImagesClientCreateOrUpdateResponse], error)` +- New function `*GalleryImagesClient.BeginDelete(context.Context, string, string, *GalleryImagesClientBeginDeleteOptions) (*runtime.Poller[GalleryImagesClientDeleteResponse], error)` +- New function `*GalleryImagesClient.Get(context.Context, string, string, *GalleryImagesClientGetOptions) (GalleryImagesClientGetResponse, error)` +- New function `*GalleryImagesClient.NewListAllPager(*GalleryImagesClientListAllOptions) *runtime.Pager[GalleryImagesClientListAllResponse]` +- New function `*GalleryImagesClient.NewListPager(string, *GalleryImagesClientListOptions) *runtime.Pager[GalleryImagesClientListResponse]` +- New function `*GalleryImagesClient.BeginUpdate(context.Context, string, string, GalleryImagesUpdateRequest, *GalleryImagesClientBeginUpdateOptions) (*runtime.Poller[GalleryImagesClientUpdateResponse], error)` +- New function `NewGuestAgentClient(azcore.TokenCredential, *arm.ClientOptions) (*GuestAgentClient, error)` +- New function `*GuestAgentClient.BeginCreate(context.Context, string, *GuestAgentClientBeginCreateOptions) (*runtime.Poller[GuestAgentClientCreateResponse], error)` +- New function `*GuestAgentClient.BeginDelete(context.Context, string, *GuestAgentClientBeginDeleteOptions) (*runtime.Poller[GuestAgentClientDeleteResponse], error)` +- New function `*GuestAgentClient.Get(context.Context, string, *GuestAgentClientGetOptions) (GuestAgentClientGetResponse, error)` +- New function `NewGuestAgentsClient(azcore.TokenCredential, *arm.ClientOptions) (*GuestAgentsClient, error)` +- New function `*GuestAgentsClient.NewListPager(string, *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse]` +- New function `NewHybridIdentityMetadataClient(azcore.TokenCredential, *arm.ClientOptions) (*HybridIdentityMetadataClient, error)` +- New function `*HybridIdentityMetadataClient.Get(context.Context, string, *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error)` +- New function `*HybridIdentityMetadataClient.NewListPager(string, *HybridIdentityMetadataClientListOptions) *runtime.Pager[HybridIdentityMetadataClientListResponse]` +- New function `NewLogicalNetworksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LogicalNetworksClient, error)` +- New function `*LogicalNetworksClient.BeginCreateOrUpdate(context.Context, string, string, LogicalNetworks, *LogicalNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[LogicalNetworksClientCreateOrUpdateResponse], error)` +- New function `*LogicalNetworksClient.BeginDelete(context.Context, string, string, *LogicalNetworksClientBeginDeleteOptions) (*runtime.Poller[LogicalNetworksClientDeleteResponse], error)` +- New function `*LogicalNetworksClient.Get(context.Context, string, string, *LogicalNetworksClientGetOptions) (LogicalNetworksClientGetResponse, error)` +- New function `*LogicalNetworksClient.NewListAllPager(*LogicalNetworksClientListAllOptions) *runtime.Pager[LogicalNetworksClientListAllResponse]` +- New function `*LogicalNetworksClient.NewListPager(string, *LogicalNetworksClientListOptions) *runtime.Pager[LogicalNetworksClientListResponse]` +- New function `*LogicalNetworksClient.BeginUpdate(context.Context, string, string, LogicalNetworksUpdateRequest, *LogicalNetworksClientBeginUpdateOptions) (*runtime.Poller[LogicalNetworksClientUpdateResponse], error)` +- New function `NewMarketplaceGalleryImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MarketplaceGalleryImagesClient, error)` +- New function `*MarketplaceGalleryImagesClient.BeginCreateOrUpdate(context.Context, string, string, MarketplaceGalleryImages, *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientCreateOrUpdateResponse], error)` +- New function `*MarketplaceGalleryImagesClient.BeginDelete(context.Context, string, string, *MarketplaceGalleryImagesClientBeginDeleteOptions) (*runtime.Poller[MarketplaceGalleryImagesClientDeleteResponse], error)` +- New function `*MarketplaceGalleryImagesClient.Get(context.Context, string, string, *MarketplaceGalleryImagesClientGetOptions) (MarketplaceGalleryImagesClientGetResponse, error)` +- New function `*MarketplaceGalleryImagesClient.NewListAllPager(*MarketplaceGalleryImagesClientListAllOptions) *runtime.Pager[MarketplaceGalleryImagesClientListAllResponse]` +- New function `*MarketplaceGalleryImagesClient.NewListPager(string, *MarketplaceGalleryImagesClientListOptions) *runtime.Pager[MarketplaceGalleryImagesClientListResponse]` +- New function `*MarketplaceGalleryImagesClient.BeginUpdate(context.Context, string, string, MarketplaceGalleryImagesUpdateRequest, *MarketplaceGalleryImagesClientBeginUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientUpdateResponse], error)` +- New function `NewOffersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OffersClient, error)` +- New function `*OffersClient.Get(context.Context, string, string, string, string, *OffersClientGetOptions) (OffersClientGetResponse, error)` +- New function `*OffersClient.NewListByClusterPager(string, string, *OffersClientListByClusterOptions) *runtime.Pager[OffersClientListByClusterResponse]` +- New function `*OffersClient.NewListByPublisherPager(string, string, string, *OffersClientListByPublisherOptions) *runtime.Pager[OffersClientListByPublisherResponse]` +- New function `NewPublishersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PublishersClient, error)` +- New function `*PublishersClient.Get(context.Context, string, string, string, *PublishersClientGetOptions) (PublishersClientGetResponse, error)` +- New function `*PublishersClient.NewListByClusterPager(string, string, *PublishersClientListByClusterOptions) *runtime.Pager[PublishersClientListByClusterResponse]` +- New function `NewSKUsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SKUsClient, error)` +- New function `*SKUsClient.Get(context.Context, string, string, string, string, string, *SKUsClientGetOptions) (SKUsClientGetResponse, error)` +- New function `*SKUsClient.NewListByOfferPager(string, string, string, string, *SKUsClientListByOfferOptions) *runtime.Pager[SKUsClientListByOfferResponse]` +- New function `NewSecuritySettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SecuritySettingsClient, error)` +- New function `*SecuritySettingsClient.BeginCreateOrUpdate(context.Context, string, string, string, SecuritySetting, *SecuritySettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecuritySettingsClientCreateOrUpdateResponse], error)` +- New function `*SecuritySettingsClient.BeginDelete(context.Context, string, string, string, *SecuritySettingsClientBeginDeleteOptions) (*runtime.Poller[SecuritySettingsClientDeleteResponse], error)` +- New function `*SecuritySettingsClient.Get(context.Context, string, string, string, *SecuritySettingsClientGetOptions) (SecuritySettingsClientGetResponse, error)` +- New function `*SecuritySettingsClient.NewListByClustersPager(string, string, *SecuritySettingsClientListByClustersOptions) *runtime.Pager[SecuritySettingsClientListByClustersResponse]` +- New function `NewStorageContainersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StorageContainersClient, error)` +- New function `*StorageContainersClient.BeginCreateOrUpdate(context.Context, string, string, StorageContainers, *StorageContainersClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageContainersClientCreateOrUpdateResponse], error)` +- New function `*StorageContainersClient.BeginDelete(context.Context, string, string, *StorageContainersClientBeginDeleteOptions) (*runtime.Poller[StorageContainersClientDeleteResponse], error)` +- New function `*StorageContainersClient.Get(context.Context, string, string, *StorageContainersClientGetOptions) (StorageContainersClientGetResponse, error)` +- New function `*StorageContainersClient.NewListAllPager(*StorageContainersClientListAllOptions) *runtime.Pager[StorageContainersClientListAllResponse]` +- New function `*StorageContainersClient.NewListPager(string, *StorageContainersClientListOptions) *runtime.Pager[StorageContainersClientListResponse]` +- New function `*StorageContainersClient.BeginUpdate(context.Context, string, string, StorageContainersUpdateRequest, *StorageContainersClientBeginUpdateOptions) (*runtime.Poller[StorageContainersClientUpdateResponse], error)` +- New function `NewUpdateRunsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpdateRunsClient, error)` +- New function `*UpdateRunsClient.BeginDelete(context.Context, string, string, string, string, *UpdateRunsClientBeginDeleteOptions) (*runtime.Poller[UpdateRunsClientDeleteResponse], error)` +- New function `*UpdateRunsClient.Get(context.Context, string, string, string, string, *UpdateRunsClientGetOptions) (UpdateRunsClientGetResponse, error)` +- New function `*UpdateRunsClient.NewListPager(string, string, string, *UpdateRunsClientListOptions) *runtime.Pager[UpdateRunsClientListResponse]` +- New function `*UpdateRunsClient.Put(context.Context, string, string, string, string, UpdateRun, *UpdateRunsClientPutOptions) (UpdateRunsClientPutResponse, error)` +- New function `NewUpdateSummariesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpdateSummariesClient, error)` +- New function `*UpdateSummariesClient.BeginDelete(context.Context, string, string, *UpdateSummariesClientBeginDeleteOptions) (*runtime.Poller[UpdateSummariesClientDeleteResponse], error)` +- New function `*UpdateSummariesClient.Get(context.Context, string, string, *UpdateSummariesClientGetOptions) (UpdateSummariesClientGetResponse, error)` +- New function `*UpdateSummariesClient.NewListPager(string, string, *UpdateSummariesClientListOptions) *runtime.Pager[UpdateSummariesClientListResponse]` +- New function `*UpdateSummariesClient.Put(context.Context, string, string, UpdateSummaries, *UpdateSummariesClientPutOptions) (UpdateSummariesClientPutResponse, error)` +- New function `NewUpdatesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpdatesClient, error)` +- New function `*UpdatesClient.BeginDelete(context.Context, string, string, string, *UpdatesClientBeginDeleteOptions) (*runtime.Poller[UpdatesClientDeleteResponse], error)` +- New function `*UpdatesClient.Get(context.Context, string, string, string, *UpdatesClientGetOptions) (UpdatesClientGetResponse, error)` +- New function `*UpdatesClient.NewListPager(string, string, *UpdatesClientListOptions) *runtime.Pager[UpdatesClientListResponse]` +- New function `*UpdatesClient.BeginPost(context.Context, string, string, string, *UpdatesClientBeginPostOptions) (*runtime.Poller[UpdatesClientPostResponse], error)` +- New function `*UpdatesClient.Put(context.Context, string, string, string, Update, *UpdatesClientPutOptions) (UpdatesClientPutResponse, error)` +- New function `NewVirtualHardDisksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VirtualHardDisksClient, error)` +- New function `*VirtualHardDisksClient.BeginCreateOrUpdate(context.Context, string, string, VirtualHardDisks, *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHardDisksClientCreateOrUpdateResponse], error)` +- New function `*VirtualHardDisksClient.BeginDelete(context.Context, string, string, *VirtualHardDisksClientBeginDeleteOptions) (*runtime.Poller[VirtualHardDisksClientDeleteResponse], error)` +- New function `*VirtualHardDisksClient.Get(context.Context, string, string, *VirtualHardDisksClientGetOptions) (VirtualHardDisksClientGetResponse, error)` +- New function `*VirtualHardDisksClient.NewListAllPager(*VirtualHardDisksClientListAllOptions) *runtime.Pager[VirtualHardDisksClientListAllResponse]` +- New function `*VirtualHardDisksClient.NewListPager(string, *VirtualHardDisksClientListOptions) *runtime.Pager[VirtualHardDisksClientListResponse]` +- New function `*VirtualHardDisksClient.BeginUpdate(context.Context, string, string, VirtualHardDisksUpdateRequest, *VirtualHardDisksClientBeginUpdateOptions) (*runtime.Poller[VirtualHardDisksClientUpdateResponse], error)` +- New function `NewVirtualMachineInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*VirtualMachineInstancesClient, error)` +- New function `*VirtualMachineInstancesClient.BeginCreateOrUpdate(context.Context, string, VirtualMachineInstance, *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientCreateOrUpdateResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginDelete(context.Context, string, *VirtualMachineInstancesClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineInstancesClientDeleteResponse], error)` +- New function `*VirtualMachineInstancesClient.Get(context.Context, string, *VirtualMachineInstancesClientGetOptions) (VirtualMachineInstancesClientGetResponse, error)` +- New function `*VirtualMachineInstancesClient.NewListPager(string, *VirtualMachineInstancesClientListOptions) *runtime.Pager[VirtualMachineInstancesClientListResponse]` +- New function `*VirtualMachineInstancesClient.BeginRestart(context.Context, string, *VirtualMachineInstancesClientBeginRestartOptions) (*runtime.Poller[VirtualMachineInstancesClientRestartResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginStart(context.Context, string, *VirtualMachineInstancesClientBeginStartOptions) (*runtime.Poller[VirtualMachineInstancesClientStartResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginStop(context.Context, string, *VirtualMachineInstancesClientBeginStopOptions) (*runtime.Poller[VirtualMachineInstancesClientStopResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginUpdate(context.Context, string, VirtualMachineInstanceUpdateRequest, *VirtualMachineInstancesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientUpdateResponse], error)` +- New function `NewNetworkInterfacesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkInterfacesClient, error)` +- New function `*NetworkInterfacesClient.BeginCreateOrUpdate(context.Context, string, string, NetworkInterfaces, *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkInterfacesClientCreateOrUpdateResponse], error)` +- New function `*NetworkInterfacesClient.BeginDelete(context.Context, string, string, *NetworkInterfacesClientBeginDeleteOptions) (*runtime.Poller[NetworkInterfacesClientDeleteResponse], error)` +- New function `*NetworkInterfacesClient.Get(context.Context, string, string, *NetworkInterfacesClientGetOptions) (NetworkInterfacesClientGetResponse, error)` +- New function `*NetworkInterfacesClient.NewListAllPager(*NetworkInterfacesClientListAllOptions) *runtime.Pager[NetworkInterfacesClientListAllResponse]` +- New function `*NetworkInterfacesClient.NewListPager(string, *NetworkInterfacesClientListOptions) *runtime.Pager[NetworkInterfacesClientListResponse]` +- New function `*NetworkInterfacesClient.BeginUpdate(context.Context, string, string, NetworkInterfacesUpdateRequest, *NetworkInterfacesClientBeginUpdateOptions) (*runtime.Poller[NetworkInterfacesClientUpdateResponse], error)` +- New struct `AdapterPropertyOverrides` +- New struct `DefaultExtensionDetails` +- New struct `DeploymentCluster` +- New struct `DeploymentConfiguration` +- New struct `DeploymentData` +- New struct `DeploymentSecuritySettings` +- New struct `DeploymentSetting` +- New struct `DeploymentSettingListResult` +- New struct `DeploymentSettingsProperties` +- New struct `DeploymentStatus` +- New struct `DeploymentStep` +- New struct `DeviceConfiguration` +- New struct `EdgeDevice` +- New struct `EdgeDeviceListResult` +- New struct `EdgeDeviceProperties` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ExtendedLocation` +- New struct `ExtensionInstanceView` +- New struct `ExtensionInstanceViewStatus` +- New struct `ExtensionPatch` +- New struct `ExtensionPatchParameters` +- New struct `ExtensionPatchProperties` +- New struct `ExtensionUpgradeParameters` +- New struct `GalleryImageIdentifier` +- New struct `GalleryImageProperties` +- New struct `GalleryImageStatus` +- New struct `GalleryImageStatusDownloadStatus` +- New struct `GalleryImageStatusProvisioningStatus` +- New struct `GalleryImageVersion` +- New struct `GalleryImageVersionProperties` +- New struct `GalleryImageVersionStorageProfile` +- New struct `GalleryImages` +- New struct `GalleryImagesListResult` +- New struct `GalleryImagesUpdateRequest` +- New struct `GalleryOSDiskImage` +- New struct `GuestAgent` +- New struct `GuestAgentInstallStatus` +- New struct `GuestAgentList` +- New struct `GuestAgentProperties` +- New struct `GuestCredential` +- New struct `HTTPProxyConfiguration` +- New struct `HardwareProfileUpdate` +- New struct `HostNetwork` +- New struct `HybridIdentityMetadata` +- New struct `HybridIdentityMetadataList` +- New struct `HybridIdentityMetadataProperties` +- New struct `IPConfiguration` +- New struct `IPConfigurationProperties` +- New struct `IPConfigurationPropertiesSubnet` +- New struct `IPPool` +- New struct `IPPoolInfo` +- New struct `IPPools` +- New struct `Identity` +- New struct `InfrastructureNetwork` +- New struct `InstanceViewStatus` +- New struct `Intents` +- New struct `InterfaceDNSSettings` +- New struct `IsolatedVMAttestationConfiguration` +- New struct `LogicalNetworkProperties` +- New struct `LogicalNetworkPropertiesDhcpOptions` +- New struct `LogicalNetworkStatus` +- New struct `LogicalNetworkStatusProvisioningStatus` +- New struct `LogicalNetworks` +- New struct `LogicalNetworksListResult` +- New struct `LogicalNetworksUpdateRequest` +- New struct `ManagedServiceIdentity` +- New struct `MarketplaceGalleryImageProperties` +- New struct `MarketplaceGalleryImageStatus` +- New struct `MarketplaceGalleryImageStatusDownloadStatus` +- New struct `MarketplaceGalleryImageStatusProvisioningStatus` +- New struct `MarketplaceGalleryImages` +- New struct `MarketplaceGalleryImagesListResult` +- New struct `MarketplaceGalleryImagesUpdateRequest` +- New struct `NetworkInterfaceProperties` +- New struct `NetworkInterfaceStatus` +- New struct `NetworkInterfaceStatusProvisioningStatus` +- New struct `NetworkInterfaces` +- New struct `NetworkInterfacesListResult` +- New struct `NetworkInterfacesUpdateRequest` +- New struct `NetworkProfileUpdate` +- New struct `NetworkProfileUpdateNetworkInterfacesItem` +- New struct `NicDetail` +- New struct `Observability` +- New struct `Offer` +- New struct `OfferList` +- New struct `OfferProperties` +- New struct `OptionalServices` +- New struct `OsProfileUpdate` +- New struct `OsProfileUpdateLinuxConfiguration` +- New struct `OsProfileUpdateWindowsConfiguration` +- New struct `PackageVersionInfo` +- New struct `PhysicalNodes` +- New struct `PrecheckResult` +- New struct `PrecheckResultTags` +- New struct `Publisher` +- New struct `PublisherList` +- New struct `PublisherProperties` +- New struct `QosPolicyOverrides` +- New struct `ReportedProperties` +- New struct `Route` +- New struct `RoutePropertiesFormat` +- New struct `RouteTable` +- New struct `RouteTablePropertiesFormat` +- New struct `SKU` +- New struct `SKUList` +- New struct `SKUMappings` +- New struct `SKUProperties` +- New struct `SSHConfiguration` +- New struct `SSHPublicKey` +- New struct `ScaleUnits` +- New struct `SecurityComplianceStatus` +- New struct `SecurityProperties` +- New struct `SecuritySetting` +- New struct `SecuritySettingListResult` +- New struct `SoftwareAssuranceChangeRequest` +- New struct `SoftwareAssuranceChangeRequestProperties` +- New struct `SoftwareAssuranceProperties` +- New struct `Step` +- New struct `Storage` +- New struct `StorageContainerProperties` +- New struct `StorageContainerStatus` +- New struct `StorageContainerStatusProvisioningStatus` +- New struct `StorageContainers` +- New struct `StorageContainersListResult` +- New struct `StorageContainersUpdateRequest` +- New struct `StorageNetworks` +- New struct `StorageProfileUpdate` +- New struct `StorageProfileUpdateDataDisksItem` +- New struct `Subnet` +- New struct `SubnetPropertiesFormat` +- New struct `SubnetPropertiesFormatIPConfigurationReferencesItem` +- New struct `Update` +- New struct `UpdateList` +- New struct `UpdatePrerequisite` +- New struct `UpdateProperties` +- New struct `UpdateRun` +- New struct `UpdateRunList` +- New struct `UpdateRunProperties` +- New struct `UpdateStateProperties` +- New struct `UpdateSummaries` +- New struct `UpdateSummariesList` +- New struct `UpdateSummariesProperties` +- New struct `UserAssignedIdentity` +- New struct `ValidateRequest` +- New struct `ValidateResponse` +- New struct `ValidationStatus` +- New struct `VirtualHardDiskProperties` +- New struct `VirtualHardDiskStatus` +- New struct `VirtualHardDiskStatusProvisioningStatus` +- New struct `VirtualHardDisks` +- New struct `VirtualHardDisksListResult` +- New struct `VirtualHardDisksUpdateRequest` +- New struct `VirtualMachineConfigAgentInstanceView` +- New struct `VirtualMachineInstance` +- New struct `VirtualMachineInstanceListResult` +- New struct `VirtualMachineInstanceProperties` +- New struct `VirtualMachineInstancePropertiesHardwareProfile` +- New struct `VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig` +- New struct `VirtualMachineInstancePropertiesNetworkProfile` +- New struct `VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem` +- New struct `VirtualMachineInstancePropertiesOsProfile` +- New struct `VirtualMachineInstancePropertiesOsProfileLinuxConfiguration` +- New struct `VirtualMachineInstancePropertiesOsProfileWindowsConfiguration` +- New struct `VirtualMachineInstancePropertiesSecurityProfile` +- New struct `VirtualMachineInstancePropertiesSecurityProfileUefiSettings` +- New struct `VirtualMachineInstancePropertiesStorageProfile` +- New struct `VirtualMachineInstancePropertiesStorageProfileDataDisksItem` +- New struct `VirtualMachineInstancePropertiesStorageProfileImageReference` +- New struct `VirtualMachineInstancePropertiesStorageProfileOsDisk` +- New struct `VirtualMachineInstanceStatus` +- New struct `VirtualMachineInstanceStatusProvisioningStatus` +- New struct `VirtualMachineInstanceUpdateProperties` +- New struct `VirtualMachineInstanceUpdateRequest` +- New struct `VirtualMachineInstanceView` +- New struct `VirtualSwitchConfigurationOverrides` +- New field `DefaultExtensions` in struct `ArcSettingProperties` +- New field `Identity` in struct `Cluster` +- New field `EhcResourceID`, `LastLicensingTimestamp`, `NodeType`, `OSDisplayVersion`, `OemActivation` in struct `ClusterNode` +- New field `Identity` in struct `ClusterPatch` +- New field `ConnectivityStatus`, `IsolatedVMAttestationConfiguration`, `ResourceProviderObjectID`, `SoftwareAssuranceProperties` in struct `ClusterProperties` +- New field `ClusterType`, `Manufacturer`, `OemActivation`, `SupportedCapabilities` in struct `ClusterReportedProperties` +- New field `EnableAutomaticUpgrade` in struct `ExtensionParameters` +- New field `ManagedBy` in struct `ExtensionProperties` +- New field `InstanceView`, `TypeHandlerVersion` in struct `PerNodeExtensionState` +- New field `ArcNodeServicePrincipalObjectID` in struct `PerNodeState` + + ## 2.0.0-beta.2 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md index de5911067e21..a8905f362d37 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md @@ -57,7 +57,7 @@ clientFactory, err := armazurestackhci.NewClientFactory(, cred, 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.NewClustersClient() +client := clientFactory.NewArcSettingsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go new file mode 100644 index 000000000000..76b7e3914baf --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go @@ -0,0 +1,709 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// ArcSettingsClient contains the methods for the ArcSettings group. +// Don't use this type directly, use NewArcSettingsClient() instead. +type ArcSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewArcSettingsClient creates a new instance of ArcSettingsClient 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 NewArcSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ArcSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ArcSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ConsentAndInstallDefaultExtensions - Add consent time for default extensions and initiate extensions installation +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ArcSettingsClientConsentAndInstallDefaultExtensionsOptions contains the optional parameters for the ArcSettingsClient.ConsentAndInstallDefaultExtensions +// method. +func (client *ArcSettingsClient) ConsentAndInstallDefaultExtensions(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (ArcSettingsClientConsentAndInstallDefaultExtensionsResponse, error) { + var err error + const operationName = "ArcSettingsClient.ConsentAndInstallDefaultExtensions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.consentAndInstallDefaultExtensionsCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + resp, err := client.consentAndInstallDefaultExtensionsHandleResponse(httpResp) + return resp, err +} + +// consentAndInstallDefaultExtensionsCreateRequest creates the ConsentAndInstallDefaultExtensions request. +func (client *ArcSettingsClient) consentAndInstallDefaultExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/consentAndInstallDefaultExtensions" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// consentAndInstallDefaultExtensionsHandleResponse handles the ConsentAndInstallDefaultExtensions response. +func (client *ArcSettingsClient) consentAndInstallDefaultExtensionsHandleResponse(resp *http.Response) (ArcSettingsClientConsentAndInstallDefaultExtensionsResponse, error) { + result := ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + return result, nil +} + +// Create - Create ArcSetting for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - arcSetting - Parameters supplied to the Create ArcSetting resource for this HCI cluster. +// - options - ArcSettingsClientCreateOptions contains the optional parameters for the ArcSettingsClient.Create method. +func (client *ArcSettingsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSetting, options *ArcSettingsClientCreateOptions) (ArcSettingsClientCreateResponse, error) { + var err error + const operationName = "ArcSettingsClient.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, clusterName, arcSettingName, arcSetting, options) + if err != nil { + return ArcSettingsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *ArcSettingsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSetting, options *ArcSettingsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, arcSetting); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ArcSettingsClient) createHandleResponse(resp *http.Response) (ArcSettingsClientCreateResponse, error) { + result := ArcSettingsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { + return ArcSettingsClientCreateResponse{}, err + } + return result, nil +} + +// BeginCreateIdentity - Create Aad identity for arc settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ArcSettingsClientBeginCreateIdentityOptions contains the optional parameters for the ArcSettingsClient.BeginCreateIdentity +// method. +func (client *ArcSettingsClient) BeginCreateIdentity(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*runtime.Poller[ArcSettingsClientCreateIdentityResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createIdentity(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientCreateIdentityResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ArcSettingsClientCreateIdentityResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateIdentity - Create Aad identity for arc settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ArcSettingsClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*http.Response, error) { + var err error + const operationName = "ArcSettingsClient.BeginCreateIdentity" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 +} + +// createIdentityCreateRequest creates the CreateIdentity request. +func (client *ArcSettingsClient) createIdentityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - Delete ArcSetting resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ArcSettingsClientBeginDeleteOptions contains the optional parameters for the ArcSettingsClient.BeginDelete method. +func (client *ArcSettingsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*runtime.Poller[ArcSettingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ArcSettingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete ArcSetting resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ArcSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ArcSettingsClient.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, clusterName, arcSettingName, 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 *ArcSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GeneratePassword - Generate password for arc settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ArcSettingsClientGeneratePasswordOptions contains the optional parameters for the ArcSettingsClient.GeneratePassword +// method. +func (client *ArcSettingsClient) GeneratePassword(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGeneratePasswordOptions) (ArcSettingsClientGeneratePasswordResponse, error) { + var err error + const operationName = "ArcSettingsClient.GeneratePassword" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generatePasswordCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return ArcSettingsClientGeneratePasswordResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientGeneratePasswordResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientGeneratePasswordResponse{}, err + } + resp, err := client.generatePasswordHandleResponse(httpResp) + return resp, err +} + +// generatePasswordCreateRequest creates the GeneratePassword request. +func (client *ArcSettingsClient) generatePasswordCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGeneratePasswordOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generatePasswordHandleResponse handles the GeneratePassword response. +func (client *ArcSettingsClient) generatePasswordHandleResponse(resp *http.Response) (ArcSettingsClientGeneratePasswordResponse, error) { + result := ArcSettingsClientGeneratePasswordResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PasswordCredential); err != nil { + return ArcSettingsClientGeneratePasswordResponse{}, err + } + return result, nil +} + +// Get - Get ArcSetting resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ArcSettingsClientGetOptions contains the optional parameters for the ArcSettingsClient.Get method. +func (client *ArcSettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGetOptions) (ArcSettingsClientGetResponse, error) { + var err error + const operationName = "ArcSettingsClient.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, clusterName, arcSettingName, options) + if err != nil { + return ArcSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ArcSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ArcSettingsClient) getHandleResponse(resp *http.Response) (ArcSettingsClientGetResponse, error) { + result := ArcSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { + return ArcSettingsClientGetResponse{}, err + } + return result, nil +} + +// BeginInitializeDisableProcess - Initializes ARC Disable process on the cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ArcSettingsClientBeginInitializeDisableProcessOptions contains the optional parameters for the ArcSettingsClient.BeginInitializeDisableProcess +// method. +func (client *ArcSettingsClient) BeginInitializeDisableProcess(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginInitializeDisableProcessOptions) (*runtime.Poller[ArcSettingsClientInitializeDisableProcessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.initializeDisableProcess(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientInitializeDisableProcessResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ArcSettingsClientInitializeDisableProcessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// InitializeDisableProcess - Initializes ARC Disable process on the cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ArcSettingsClient) initializeDisableProcess(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginInitializeDisableProcessOptions) (*http.Response, error) { + var err error + const operationName = "ArcSettingsClient.BeginInitializeDisableProcess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.initializeDisableProcessCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 +} + +// initializeDisableProcessCreateRequest creates the InitializeDisableProcess request. +func (client *ArcSettingsClient) initializeDisableProcessCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginInitializeDisableProcessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByClusterPager - Get ArcSetting resources of HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.NewListByClusterPager +// method. +func (client *ArcSettingsClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *ArcSettingsClientListByClusterOptions) *runtime.Pager[ArcSettingsClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[ArcSettingsClientListByClusterResponse]{ + More: func(page ArcSettingsClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ArcSettingsClientListByClusterResponse) (ArcSettingsClientListByClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ArcSettingsClient.NewListByClusterPager") + 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.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return ArcSettingsClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *ArcSettingsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ArcSettingsClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *ArcSettingsClient) listByClusterHandleResponse(resp *http.Response) (ArcSettingsClientListByClusterResponse, error) { + result := ArcSettingsClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSettingList); err != nil { + return ArcSettingsClientListByClusterResponse{}, err + } + return result, nil +} + +// Update - Update ArcSettings for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - arcSetting - ArcSettings parameters that needs to be updated +// - options - ArcSettingsClientUpdateOptions contains the optional parameters for the ArcSettingsClient.Update method. +func (client *ArcSettingsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSettingsPatch, options *ArcSettingsClientUpdateOptions) (ArcSettingsClientUpdateResponse, error) { + var err error + const operationName = "ArcSettingsClient.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, clusterName, arcSettingName, arcSetting, options) + if err != nil { + return ArcSettingsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ArcSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSettingsPatch, options *ArcSettingsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, arcSetting); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ArcSettingsClient) updateHandleResponse(resp *http.Response) (ArcSettingsClientUpdateResponse, error) { + result := ArcSettingsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { + return ArcSettingsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md index 41d3aa733c14..a4de3d5d9460 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0-beta.2 -tag: package-preview-2023-09 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go index de71a8c08927..20eaa9e17ce2 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go @@ -17,8 +17,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,78 +26,190 @@ 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 } +// NewArcSettingsClient creates a new instance of ArcSettingsClient. +func (c *ClientFactory) NewArcSettingsClient() *ArcSettingsClient { + return &ArcSettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewClustersClient creates a new instance of ClustersClient. +func (c *ClientFactory) NewClustersClient() *ClustersClient { + return &ClustersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDeploymentSettingsClient creates a new instance of DeploymentSettingsClient. +func (c *ClientFactory) NewDeploymentSettingsClient() *DeploymentSettingsClient { + return &DeploymentSettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEdgeDevicesClient creates a new instance of EdgeDevicesClient. +func (c *ClientFactory) NewEdgeDevicesClient() *EdgeDevicesClient { + return &EdgeDevicesClient{ + internal: c.internal, + } +} + +// NewExtensionsClient creates a new instance of ExtensionsClient. +func (c *ClientFactory) NewExtensionsClient() *ExtensionsClient { + return &ExtensionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewGalleryImagesClient creates a new instance of GalleryImagesClient. func (c *ClientFactory) NewGalleryImagesClient() *GalleryImagesClient { - subClient, _ := NewGalleryImagesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &GalleryImagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewGuestAgentClient creates a new instance of GuestAgentClient. func (c *ClientFactory) NewGuestAgentClient() *GuestAgentClient { - subClient, _ := NewGuestAgentClient(c.credential, c.options) - return subClient + return &GuestAgentClient{ + internal: c.internal, + } } // NewGuestAgentsClient creates a new instance of GuestAgentsClient. func (c *ClientFactory) NewGuestAgentsClient() *GuestAgentsClient { - subClient, _ := NewGuestAgentsClient(c.credential, c.options) - return subClient + return &GuestAgentsClient{ + internal: c.internal, + } } // NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient. func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { - subClient, _ := NewHybridIdentityMetadataClient(c.credential, c.options) - return subClient + return &HybridIdentityMetadataClient{ + internal: c.internal, + } } // NewLogicalNetworksClient creates a new instance of LogicalNetworksClient. func (c *ClientFactory) NewLogicalNetworksClient() *LogicalNetworksClient { - subClient, _ := NewLogicalNetworksClient(c.subscriptionID, c.credential, c.options) - return subClient + return &LogicalNetworksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMarketplaceGalleryImagesClient creates a new instance of MarketplaceGalleryImagesClient. func (c *ClientFactory) NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient { - subClient, _ := NewMarketplaceGalleryImagesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MarketplaceGalleryImagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewNetworkInterfacesClient creates a new instance of NetworkInterfacesClient. func (c *ClientFactory) NewNetworkInterfacesClient() *NetworkInterfacesClient { - subClient, _ := NewNetworkInterfacesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &NetworkInterfacesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOffersClient creates a new instance of OffersClient. +func (c *ClientFactory) NewOffersClient() *OffersClient { + return &OffersClient{ + 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, + } +} + +// NewPublishersClient creates a new instance of PublishersClient. +func (c *ClientFactory) NewPublishersClient() *PublishersClient { + return &PublishersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSKUsClient creates a new instance of SKUsClient. +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + return &SKUsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSecuritySettingsClient creates a new instance of SecuritySettingsClient. +func (c *ClientFactory) NewSecuritySettingsClient() *SecuritySettingsClient { + return &SecuritySettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewStorageContainersClient creates a new instance of StorageContainersClient. func (c *ClientFactory) NewStorageContainersClient() *StorageContainersClient { - subClient, _ := NewStorageContainersClient(c.subscriptionID, c.credential, c.options) - return subClient + return &StorageContainersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpdateRunsClient creates a new instance of UpdateRunsClient. +func (c *ClientFactory) NewUpdateRunsClient() *UpdateRunsClient { + return &UpdateRunsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpdateSummariesClient creates a new instance of UpdateSummariesClient. +func (c *ClientFactory) NewUpdateSummariesClient() *UpdateSummariesClient { + return &UpdateSummariesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpdatesClient creates a new instance of UpdatesClient. +func (c *ClientFactory) NewUpdatesClient() *UpdatesClient { + return &UpdatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVirtualHardDisksClient creates a new instance of VirtualHardDisksClient. func (c *ClientFactory) NewVirtualHardDisksClient() *VirtualHardDisksClient { - subClient, _ := NewVirtualHardDisksClient(c.subscriptionID, c.credential, c.options) - return subClient + return &VirtualHardDisksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVirtualMachineInstancesClient creates a new instance of VirtualMachineInstancesClient. func (c *ClientFactory) NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient { - subClient, _ := NewVirtualMachineInstancesClient(c.credential, c.options) - return subClient + return &VirtualMachineInstancesClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go new file mode 100644 index 000000000000..70219ec2c1bb --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go @@ -0,0 +1,673 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// ClustersClient contains the methods for the Clusters group. +// Don't use this type directly, use NewClustersClient() instead. +type ClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewClustersClient creates a new instance of ClustersClient 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 NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClustersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create an HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - cluster - Details of the HCI cluster. +// - options - ClustersClientCreateOptions contains the optional parameters for the ClustersClient.Create method. +func (client *ClustersClient) Create(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersClientCreateOptions) (ClustersClientCreateResponse, error) { + var err error + const operationName = "ClustersClient.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, clusterName, cluster, options) + if err != nil { + return ClustersClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cluster); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ClustersClient) createHandleResponse(resp *http.Response) (ClustersClientCreateResponse, error) { + result := ClustersClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { + return ClustersClientCreateResponse{}, err + } + return result, nil +} + +// BeginCreateIdentity - Create cluster identity. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity +// method. +func (client *ClustersClient) BeginCreateIdentity(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*runtime.Poller[ClustersClientCreateIdentityResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createIdentity(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateIdentityResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientCreateIdentityResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateIdentity - Create cluster identity. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginCreateIdentity" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, 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 +} + +// createIdentityCreateRequest creates the CreateIdentity request. +func (client *ClustersClient) createIdentityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - Delete an HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*runtime.Poller[ClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete an HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.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, clusterName, 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 *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExtendSoftwareAssuranceBenefit - Extends Software Assurance Benefit to a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - softwareAssuranceChangeRequest - Software Assurance Change Request Payload +// - options - ClustersClientBeginExtendSoftwareAssuranceBenefitOptions contains the optional parameters for the ClustersClient.BeginExtendSoftwareAssuranceBenefit +// method. +func (client *ClustersClient) BeginExtendSoftwareAssuranceBenefit(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*runtime.Poller[ClustersClientExtendSoftwareAssuranceBenefitResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.extendSoftwareAssuranceBenefit(ctx, resourceGroupName, clusterName, softwareAssuranceChangeRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientExtendSoftwareAssuranceBenefitResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientExtendSoftwareAssuranceBenefitResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExtendSoftwareAssuranceBenefit - Extends Software Assurance Benefit to a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) extendSoftwareAssuranceBenefit(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginExtendSoftwareAssuranceBenefit" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.extendSoftwareAssuranceBenefitCreateRequest(ctx, resourceGroupName, clusterName, softwareAssuranceChangeRequest, 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 +} + +// extendSoftwareAssuranceBenefitCreateRequest creates the ExtendSoftwareAssuranceBenefit request. +func (client *ClustersClient) extendSoftwareAssuranceBenefitCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, softwareAssuranceChangeRequest); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (ClustersClientGetResponse, error) { + var err error + const operationName = "ClustersClient.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, clusterName, options) + if err != nil { + return ClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersClientGetResponse, error) { + result := ClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { + return ClustersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all HCI clusters in a resource group. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager +// method. +func (client *ClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ClustersClientListByResourceGroupOptions) *runtime.Pager[ClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListByResourceGroupResponse]{ + More: func(page ClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListByResourceGroupResponse) (ClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.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 ClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters" + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersClientListByResourceGroupResponse, error) { + result := ClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterList); err != nil { + return ClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all HCI clusters in a subscription. +// +// Generated from API version 2024-01-01 +// - options - ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager +// method. +func (client *ClustersClient) NewListBySubscriptionPager(options *ClustersClientListBySubscriptionOptions) *runtime.Pager[ClustersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListBySubscriptionResponse]{ + More: func(page ClustersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListBySubscriptionResponse) (ClustersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.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 ClustersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *ClustersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters" + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ClustersClientListBySubscriptionResponse, error) { + result := ClustersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterList); err != nil { + return ClustersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update an HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - cluster - Details of the HCI cluster. +// - options - ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. +func (client *ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterPatch, options *ClustersClientUpdateOptions) (ClustersClientUpdateResponse, error) { + var err error + const operationName = "ClustersClient.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, clusterName, cluster, options) + if err != nil { + return ClustersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterPatch, options *ClustersClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cluster); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ClustersClient) updateHandleResponse(resp *http.Response) (ClustersClientUpdateResponse, error) { + result := ClustersClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { + return ClustersClientUpdateResponse{}, err + } + return result, nil +} + +// BeginUploadCertificate - Upload certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - uploadCertificateRequest - Upload certificate request. +// - options - ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate +// method. +func (client *ClustersClient) BeginUploadCertificate(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*runtime.Poller[ClustersClientUploadCertificateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.uploadCertificate(ctx, resourceGroupName, clusterName, uploadCertificateRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientUploadCertificateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientUploadCertificateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UploadCertificate - Upload certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) uploadCertificate(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginUploadCertificate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.uploadCertificateCreateRequest(ctx, resourceGroupName, clusterName, uploadCertificateRequest, 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 +} + +// uploadCertificateCreateRequest creates the UploadCertificate request. +func (client *ClustersClient) uploadCertificateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, uploadCertificateRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go index 5512c28e9724..1f9e3e18d9e5 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go @@ -10,7 +10,7 @@ package armazurestackhci const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" - moduleVersion = "v2.0.0-beta.2" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,6 +27,72 @@ func PossibleActionTypeValues() []ActionType { } } +// ArcSettingAggregateState - Aggregate state of Arc agent across the nodes in this HCI cluster. +type ArcSettingAggregateState string + +const ( + ArcSettingAggregateStateAccepted ArcSettingAggregateState = "Accepted" + ArcSettingAggregateStateCanceled ArcSettingAggregateState = "Canceled" + ArcSettingAggregateStateConnected ArcSettingAggregateState = "Connected" + ArcSettingAggregateStateCreating ArcSettingAggregateState = "Creating" + ArcSettingAggregateStateDeleted ArcSettingAggregateState = "Deleted" + ArcSettingAggregateStateDeleting ArcSettingAggregateState = "Deleting" + ArcSettingAggregateStateDisableInProgress ArcSettingAggregateState = "DisableInProgress" + ArcSettingAggregateStateDisconnected ArcSettingAggregateState = "Disconnected" + ArcSettingAggregateStateError ArcSettingAggregateState = "Error" + ArcSettingAggregateStateFailed ArcSettingAggregateState = "Failed" + ArcSettingAggregateStateInProgress ArcSettingAggregateState = "InProgress" + ArcSettingAggregateStateMoving ArcSettingAggregateState = "Moving" + ArcSettingAggregateStateNotSpecified ArcSettingAggregateState = "NotSpecified" + ArcSettingAggregateStatePartiallyConnected ArcSettingAggregateState = "PartiallyConnected" + ArcSettingAggregateStatePartiallySucceeded ArcSettingAggregateState = "PartiallySucceeded" + ArcSettingAggregateStateProvisioning ArcSettingAggregateState = "Provisioning" + ArcSettingAggregateStateSucceeded ArcSettingAggregateState = "Succeeded" + ArcSettingAggregateStateUpdating ArcSettingAggregateState = "Updating" +) + +// PossibleArcSettingAggregateStateValues returns the possible values for the ArcSettingAggregateState const type. +func PossibleArcSettingAggregateStateValues() []ArcSettingAggregateState { + return []ArcSettingAggregateState{ + ArcSettingAggregateStateAccepted, + ArcSettingAggregateStateCanceled, + ArcSettingAggregateStateConnected, + ArcSettingAggregateStateCreating, + ArcSettingAggregateStateDeleted, + ArcSettingAggregateStateDeleting, + ArcSettingAggregateStateDisableInProgress, + ArcSettingAggregateStateDisconnected, + ArcSettingAggregateStateError, + ArcSettingAggregateStateFailed, + ArcSettingAggregateStateInProgress, + ArcSettingAggregateStateMoving, + ArcSettingAggregateStateNotSpecified, + ArcSettingAggregateStatePartiallyConnected, + ArcSettingAggregateStatePartiallySucceeded, + ArcSettingAggregateStateProvisioning, + ArcSettingAggregateStateSucceeded, + ArcSettingAggregateStateUpdating, + } +} + +// AvailabilityType - Indicates the way the update content can be downloaded. +type AvailabilityType string + +const ( + AvailabilityTypeLocal AvailabilityType = "Local" + AvailabilityTypeNotify AvailabilityType = "Notify" + AvailabilityTypeOnline AvailabilityType = "Online" +) + +// PossibleAvailabilityTypeValues returns the possible values for the AvailabilityType const type. +func PossibleAvailabilityTypeValues() []AvailabilityType { + return []AvailabilityType{ + AvailabilityTypeLocal, + AvailabilityTypeNotify, + AvailabilityTypeOnline, + } +} + // CloudInitDataSource - Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] type CloudInitDataSource string @@ -43,6 +109,86 @@ func PossibleCloudInitDataSourceValues() []CloudInitDataSource { } } +// ClusterNodeType - The node type of all the nodes of the cluster. +type ClusterNodeType string + +const ( + ClusterNodeTypeFirstParty ClusterNodeType = "FirstParty" + ClusterNodeTypeThirdParty ClusterNodeType = "ThirdParty" +) + +// PossibleClusterNodeTypeValues returns the possible values for the ClusterNodeType const type. +func PossibleClusterNodeTypeValues() []ClusterNodeType { + return []ClusterNodeType{ + ClusterNodeTypeFirstParty, + ClusterNodeTypeThirdParty, + } +} + +// ComplianceAssignmentType - Represents the compliance assignment type of a resource. +type ComplianceAssignmentType string + +const ( + // ComplianceAssignmentTypeApplyAndAutoCorrect - Applied to the machine. If it drifts, the local service inside the machine + // makes a correction at the next evaluation. + ComplianceAssignmentTypeApplyAndAutoCorrect ComplianceAssignmentType = "ApplyAndAutoCorrect" + // ComplianceAssignmentTypeAudit - Report on the state of the machine, but don't make changes. + ComplianceAssignmentTypeAudit ComplianceAssignmentType = "Audit" +) + +// PossibleComplianceAssignmentTypeValues returns the possible values for the ComplianceAssignmentType const type. +func PossibleComplianceAssignmentTypeValues() []ComplianceAssignmentType { + return []ComplianceAssignmentType{ + ComplianceAssignmentTypeApplyAndAutoCorrect, + ComplianceAssignmentTypeAudit, + } +} + +// ComplianceStatus - Represents the compliance status of a resource. +type ComplianceStatus string + +const ( + // ComplianceStatusCompliant - The resource is compliant + ComplianceStatusCompliant ComplianceStatus = "Compliant" + // ComplianceStatusNonCompliant - The resource is non-compliant + ComplianceStatusNonCompliant ComplianceStatus = "NonCompliant" + // ComplianceStatusPending - The resource compliance status is pending + ComplianceStatusPending ComplianceStatus = "Pending" +) + +// PossibleComplianceStatusValues returns the possible values for the ComplianceStatus const type. +func PossibleComplianceStatusValues() []ComplianceStatus { + return []ComplianceStatus{ + ComplianceStatusCompliant, + ComplianceStatusNonCompliant, + ComplianceStatusPending, + } +} + +// ConnectivityStatus - Overall connectivity status for the cluster resource. +type ConnectivityStatus string + +const ( + ConnectivityStatusConnected ConnectivityStatus = "Connected" + ConnectivityStatusDisconnected ConnectivityStatus = "Disconnected" + ConnectivityStatusNotConnectedRecently ConnectivityStatus = "NotConnectedRecently" + ConnectivityStatusNotSpecified ConnectivityStatus = "NotSpecified" + ConnectivityStatusNotYetRegistered ConnectivityStatus = "NotYetRegistered" + ConnectivityStatusPartiallyConnected ConnectivityStatus = "PartiallyConnected" +) + +// PossibleConnectivityStatusValues returns the possible values for the ConnectivityStatus const type. +func PossibleConnectivityStatusValues() []ConnectivityStatus { + return []ConnectivityStatus{ + ConnectivityStatusConnected, + ConnectivityStatusDisconnected, + ConnectivityStatusNotConnectedRecently, + ConnectivityStatusNotSpecified, + ConnectivityStatusNotYetRegistered, + ConnectivityStatusPartiallyConnected, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -63,6 +209,42 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DeploymentMode - The deployment mode for cluster deployment. +type DeploymentMode string + +const ( + // DeploymentModeDeploy - Deploy cluster using deployment settings. + DeploymentModeDeploy DeploymentMode = "Deploy" + // DeploymentModeValidate - Validate deployment settings for cluster. + DeploymentModeValidate DeploymentMode = "Validate" +) + +// PossibleDeploymentModeValues returns the possible values for the DeploymentMode const type. +func PossibleDeploymentModeValues() []DeploymentMode { + return []DeploymentMode{ + DeploymentModeDeploy, + DeploymentModeValidate, + } +} + +// DiagnosticLevel - Desired level of diagnostic data emitted by the cluster. +type DiagnosticLevel string + +const ( + DiagnosticLevelBasic DiagnosticLevel = "Basic" + DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" + DiagnosticLevelOff DiagnosticLevel = "Off" +) + +// PossibleDiagnosticLevelValues returns the possible values for the DiagnosticLevel const type. +func PossibleDiagnosticLevelValues() []DiagnosticLevel { + return []DiagnosticLevel{ + DiagnosticLevelBasic, + DiagnosticLevelEnhanced, + DiagnosticLevelOff, + } +} + // DiskFileFormat - The format of the actual VHD file [vhd, vhdx] type DiskFileFormat string @@ -93,6 +275,93 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { } } +// ExtensionAggregateState - Aggregate state of Arc Extensions across the nodes in this HCI cluster. +type ExtensionAggregateState string + +const ( + ExtensionAggregateStateAccepted ExtensionAggregateState = "Accepted" + ExtensionAggregateStateCanceled ExtensionAggregateState = "Canceled" + ExtensionAggregateStateConnected ExtensionAggregateState = "Connected" + ExtensionAggregateStateCreating ExtensionAggregateState = "Creating" + ExtensionAggregateStateDeleted ExtensionAggregateState = "Deleted" + ExtensionAggregateStateDeleting ExtensionAggregateState = "Deleting" + ExtensionAggregateStateDisconnected ExtensionAggregateState = "Disconnected" + ExtensionAggregateStateError ExtensionAggregateState = "Error" + ExtensionAggregateStateFailed ExtensionAggregateState = "Failed" + ExtensionAggregateStateInProgress ExtensionAggregateState = "InProgress" + ExtensionAggregateStateMoving ExtensionAggregateState = "Moving" + ExtensionAggregateStateNotSpecified ExtensionAggregateState = "NotSpecified" + ExtensionAggregateStatePartiallyConnected ExtensionAggregateState = "PartiallyConnected" + ExtensionAggregateStatePartiallySucceeded ExtensionAggregateState = "PartiallySucceeded" + ExtensionAggregateStateProvisioning ExtensionAggregateState = "Provisioning" + ExtensionAggregateStateSucceeded ExtensionAggregateState = "Succeeded" + ExtensionAggregateStateUpdating ExtensionAggregateState = "Updating" + ExtensionAggregateStateUpgradeFailedRollbackSucceeded ExtensionAggregateState = "UpgradeFailedRollbackSucceeded" +) + +// PossibleExtensionAggregateStateValues returns the possible values for the ExtensionAggregateState const type. +func PossibleExtensionAggregateStateValues() []ExtensionAggregateState { + return []ExtensionAggregateState{ + ExtensionAggregateStateAccepted, + ExtensionAggregateStateCanceled, + ExtensionAggregateStateConnected, + ExtensionAggregateStateCreating, + ExtensionAggregateStateDeleted, + ExtensionAggregateStateDeleting, + ExtensionAggregateStateDisconnected, + ExtensionAggregateStateError, + ExtensionAggregateStateFailed, + ExtensionAggregateStateInProgress, + ExtensionAggregateStateMoving, + ExtensionAggregateStateNotSpecified, + ExtensionAggregateStatePartiallyConnected, + ExtensionAggregateStatePartiallySucceeded, + ExtensionAggregateStateProvisioning, + ExtensionAggregateStateSucceeded, + ExtensionAggregateStateUpdating, + ExtensionAggregateStateUpgradeFailedRollbackSucceeded, + } +} + +// ExtensionManagedBy - Indicates if the extension is managed by azure or the user. +type ExtensionManagedBy string + +const ( + ExtensionManagedByAzure ExtensionManagedBy = "Azure" + ExtensionManagedByUser ExtensionManagedBy = "User" +) + +// PossibleExtensionManagedByValues returns the possible values for the ExtensionManagedBy const type. +func PossibleExtensionManagedByValues() []ExtensionManagedBy { + return []ExtensionManagedBy{ + ExtensionManagedByAzure, + ExtensionManagedByUser, + } +} + +type HealthState string + +const ( + HealthStateError HealthState = "Error" + HealthStateFailure HealthState = "Failure" + HealthStateInProgress HealthState = "InProgress" + HealthStateSuccess HealthState = "Success" + HealthStateUnknown HealthState = "Unknown" + HealthStateWarning HealthState = "Warning" +) + +// PossibleHealthStateValues returns the possible values for the HealthState const type. +func PossibleHealthStateValues() []HealthState { + return []HealthState{ + HealthStateError, + HealthStateFailure, + HealthStateInProgress, + HealthStateSuccess, + HealthStateUnknown, + HealthStateWarning, + } +} + // HyperVGeneration - The hypervisor generation of the Virtual Machine [V1, V2] type HyperVGeneration string @@ -141,6 +410,152 @@ func PossibleIPPoolTypeEnumValues() []IPPoolTypeEnum { } } +// ImdsAttestation - IMDS attestation status of the cluster. +type ImdsAttestation string + +const ( + ImdsAttestationDisabled ImdsAttestation = "Disabled" + ImdsAttestationEnabled ImdsAttestation = "Enabled" +) + +// PossibleImdsAttestationValues returns the possible values for the ImdsAttestation const type. +func PossibleImdsAttestationValues() []ImdsAttestation { + return []ImdsAttestation{ + ImdsAttestationDisabled, + ImdsAttestationEnabled, + } +} + +// 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, + } +} + +// NodeArcState - State of Arc agent in this node. +type NodeArcState string + +const ( + NodeArcStateAccepted NodeArcState = "Accepted" + NodeArcStateCanceled NodeArcState = "Canceled" + NodeArcStateConnected NodeArcState = "Connected" + NodeArcStateCreating NodeArcState = "Creating" + NodeArcStateDeleted NodeArcState = "Deleted" + NodeArcStateDeleting NodeArcState = "Deleting" + NodeArcStateDisableInProgress NodeArcState = "DisableInProgress" + NodeArcStateDisconnected NodeArcState = "Disconnected" + NodeArcStateError NodeArcState = "Error" + NodeArcStateFailed NodeArcState = "Failed" + NodeArcStateInProgress NodeArcState = "InProgress" + NodeArcStateMoving NodeArcState = "Moving" + NodeArcStateNotSpecified NodeArcState = "NotSpecified" + NodeArcStatePartiallyConnected NodeArcState = "PartiallyConnected" + NodeArcStatePartiallySucceeded NodeArcState = "PartiallySucceeded" + NodeArcStateProvisioning NodeArcState = "Provisioning" + NodeArcStateSucceeded NodeArcState = "Succeeded" + NodeArcStateUpdating NodeArcState = "Updating" +) + +// PossibleNodeArcStateValues returns the possible values for the NodeArcState const type. +func PossibleNodeArcStateValues() []NodeArcState { + return []NodeArcState{ + NodeArcStateAccepted, + NodeArcStateCanceled, + NodeArcStateConnected, + NodeArcStateCreating, + NodeArcStateDeleted, + NodeArcStateDeleting, + NodeArcStateDisableInProgress, + NodeArcStateDisconnected, + NodeArcStateError, + NodeArcStateFailed, + NodeArcStateInProgress, + NodeArcStateMoving, + NodeArcStateNotSpecified, + NodeArcStatePartiallyConnected, + NodeArcStatePartiallySucceeded, + NodeArcStateProvisioning, + NodeArcStateSucceeded, + NodeArcStateUpdating, + } +} + +// NodeExtensionState - State of Arc Extension in this node. +type NodeExtensionState string + +const ( + NodeExtensionStateAccepted NodeExtensionState = "Accepted" + NodeExtensionStateCanceled NodeExtensionState = "Canceled" + NodeExtensionStateConnected NodeExtensionState = "Connected" + NodeExtensionStateCreating NodeExtensionState = "Creating" + NodeExtensionStateDeleted NodeExtensionState = "Deleted" + NodeExtensionStateDeleting NodeExtensionState = "Deleting" + NodeExtensionStateDisconnected NodeExtensionState = "Disconnected" + NodeExtensionStateError NodeExtensionState = "Error" + NodeExtensionStateFailed NodeExtensionState = "Failed" + NodeExtensionStateInProgress NodeExtensionState = "InProgress" + NodeExtensionStateMoving NodeExtensionState = "Moving" + NodeExtensionStateNotSpecified NodeExtensionState = "NotSpecified" + NodeExtensionStatePartiallyConnected NodeExtensionState = "PartiallyConnected" + NodeExtensionStatePartiallySucceeded NodeExtensionState = "PartiallySucceeded" + NodeExtensionStateProvisioning NodeExtensionState = "Provisioning" + NodeExtensionStateSucceeded NodeExtensionState = "Succeeded" + NodeExtensionStateUpdating NodeExtensionState = "Updating" +) + +// PossibleNodeExtensionStateValues returns the possible values for the NodeExtensionState const type. +func PossibleNodeExtensionStateValues() []NodeExtensionState { + return []NodeExtensionState{ + NodeExtensionStateAccepted, + NodeExtensionStateCanceled, + NodeExtensionStateConnected, + NodeExtensionStateCreating, + NodeExtensionStateDeleted, + NodeExtensionStateDeleting, + NodeExtensionStateDisconnected, + NodeExtensionStateError, + NodeExtensionStateFailed, + NodeExtensionStateInProgress, + NodeExtensionStateMoving, + NodeExtensionStateNotSpecified, + NodeExtensionStatePartiallyConnected, + NodeExtensionStatePartiallySucceeded, + NodeExtensionStateProvisioning, + NodeExtensionStateSucceeded, + NodeExtensionStateUpdating, + } +} + +// OemActivation - OEM activation status of the cluster. +type OemActivation string + +const ( + OemActivationDisabled OemActivation = "Disabled" + OemActivationEnabled OemActivation = "Enabled" +) + +// PossibleOemActivationValues returns the possible values for the OemActivation const type. +func PossibleOemActivationValues() []OemActivation { + return []OemActivation{ + OemActivationDisabled, + OemActivationEnabled, + } +} + // OperatingSystemTypes - Operating system type that the gallery image uses [Windows, Linux] type OperatingSystemTypes string @@ -220,6 +635,54 @@ func PossibleProvisioningActionValues() []ProvisioningAction { } } +// ProvisioningState - Provisioning state of the ArcSetting proxy resource. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateConnected ProvisioningState = "Connected" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisableInProgress ProvisioningState = "DisableInProgress" + ProvisioningStateDisconnected ProvisioningState = "Disconnected" + ProvisioningStateError ProvisioningState = "Error" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInProgress ProvisioningState = "InProgress" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStatePartiallyConnected ProvisioningState = "PartiallyConnected" + ProvisioningStatePartiallySucceeded ProvisioningState = "PartiallySucceeded" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateConnected, + ProvisioningStateCreating, + ProvisioningStateDeleted, + ProvisioningStateDeleting, + ProvisioningStateDisableInProgress, + ProvisioningStateDisconnected, + ProvisioningStateError, + ProvisioningStateFailed, + ProvisioningStateInProgress, + ProvisioningStateMoving, + ProvisioningStateNotSpecified, + ProvisioningStatePartiallyConnected, + ProvisioningStatePartiallySucceeded, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + // ProvisioningStateEnum - Provisioning state of the gallery image. type ProvisioningStateEnum string @@ -244,6 +707,23 @@ func PossibleProvisioningStateEnumValues() []ProvisioningStateEnum { } } +type RebootRequirement string + +const ( + RebootRequirementFalse RebootRequirement = "False" + RebootRequirementTrue RebootRequirement = "True" + RebootRequirementUnknown RebootRequirement = "Unknown" +) + +// PossibleRebootRequirementValues returns the possible values for the RebootRequirement const type. +func PossibleRebootRequirementValues() []RebootRequirement { + return []RebootRequirement{ + RebootRequirementFalse, + RebootRequirementTrue, + RebootRequirementUnknown, + } +} + // SecurityTypes - Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true // for SecurityType to function. type SecurityTypes string @@ -261,21 +741,148 @@ func PossibleSecurityTypesValues() []SecurityTypes { } } -// Status - The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] +// Severity - Severity of the result (Critical, Warning, Informational, Hidden). This answers how important the result is. +// Critical is the only update-blocking severity. +type Severity string + +const ( + SeverityCritical Severity = "Critical" + SeverityHidden Severity = "Hidden" + SeverityInformational Severity = "Informational" + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns the possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{ + SeverityCritical, + SeverityHidden, + SeverityInformational, + SeverityWarning, + } +} + +// SoftwareAssuranceIntent - Customer Intent for Software Assurance Benefit. +type SoftwareAssuranceIntent string + +const ( + SoftwareAssuranceIntentDisable SoftwareAssuranceIntent = "Disable" + SoftwareAssuranceIntentEnable SoftwareAssuranceIntent = "Enable" +) + +// PossibleSoftwareAssuranceIntentValues returns the possible values for the SoftwareAssuranceIntent const type. +func PossibleSoftwareAssuranceIntentValues() []SoftwareAssuranceIntent { + return []SoftwareAssuranceIntent{ + SoftwareAssuranceIntentDisable, + SoftwareAssuranceIntentEnable, + } +} + +// SoftwareAssuranceStatus - Status of the Software Assurance for the cluster. +type SoftwareAssuranceStatus string + +const ( + SoftwareAssuranceStatusDisabled SoftwareAssuranceStatus = "Disabled" + SoftwareAssuranceStatusEnabled SoftwareAssuranceStatus = "Enabled" +) + +// PossibleSoftwareAssuranceStatusValues returns the possible values for the SoftwareAssuranceStatus const type. +func PossibleSoftwareAssuranceStatusValues() []SoftwareAssuranceStatus { + return []SoftwareAssuranceStatus{ + SoftwareAssuranceStatusDisabled, + SoftwareAssuranceStatusEnabled, + } +} + +// State - State of the update as it relates to this stamp. +type State string + +const ( + StateAdditionalContentRequired State = "AdditionalContentRequired" + StateDownloadFailed State = "DownloadFailed" + StateDownloading State = "Downloading" + StateHasPrerequisite State = "HasPrerequisite" + StateHealthCheckFailed State = "HealthCheckFailed" + StateHealthChecking State = "HealthChecking" + StateInstallationFailed State = "InstallationFailed" + StateInstalled State = "Installed" + StateInstalling State = "Installing" + StateInvalid State = "Invalid" + StateNotApplicableBecauseAnotherUpdateIsInProgress State = "NotApplicableBecauseAnotherUpdateIsInProgress" + StateObsolete State = "Obsolete" + StatePreparationFailed State = "PreparationFailed" + StatePreparing State = "Preparing" + StateReady State = "Ready" + StateReadyToInstall State = "ReadyToInstall" + StateRecalled State = "Recalled" + StateScanFailed State = "ScanFailed" + StateScanInProgress State = "ScanInProgress" +) + +// PossibleStateValues returns the possible values for the State const type. +func PossibleStateValues() []State { + return []State{ + StateAdditionalContentRequired, + StateDownloadFailed, + StateDownloading, + StateHasPrerequisite, + StateHealthCheckFailed, + StateHealthChecking, + StateInstallationFailed, + StateInstalled, + StateInstalling, + StateInvalid, + StateNotApplicableBecauseAnotherUpdateIsInProgress, + StateObsolete, + StatePreparationFailed, + StatePreparing, + StateReady, + StateReadyToInstall, + StateRecalled, + StateScanFailed, + StateScanInProgress, + } +} + +// Status - Status of the cluster agent. type Status string const ( - StatusFailed Status = "Failed" - StatusInProgress Status = "InProgress" - StatusSucceeded Status = "Succeeded" + StatusConnectedRecently Status = "ConnectedRecently" + StatusDeploymentFailed Status = "DeploymentFailed" + StatusDeploymentInProgress Status = "DeploymentInProgress" + StatusDeploymentSuccess Status = "DeploymentSuccess" + StatusDisconnected Status = "Disconnected" + StatusError Status = "Error" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusNotConnectedRecently Status = "NotConnectedRecently" + StatusNotSpecified Status = "NotSpecified" + StatusNotYetRegistered Status = "NotYetRegistered" + StatusSucceeded Status = "Succeeded" + StatusValidationFailed Status = "ValidationFailed" + StatusValidationInProgress Status = "ValidationInProgress" + StatusValidationSuccess Status = "ValidationSuccess" ) // PossibleStatusValues returns the possible values for the Status const type. func PossibleStatusValues() []Status { return []Status{ + StatusConnectedRecently, + StatusDeploymentFailed, + StatusDeploymentInProgress, + StatusDeploymentSuccess, + StatusDisconnected, + StatusError, StatusFailed, StatusInProgress, + StatusNotConnectedRecently, + StatusNotSpecified, + StatusNotYetRegistered, StatusSucceeded, + StatusValidationFailed, + StatusValidationInProgress, + StatusValidationSuccess, } } @@ -315,6 +922,54 @@ func PossibleStatusTypesValues() []StatusTypes { } } +// UpdateRunPropertiesState - State of the update run. +type UpdateRunPropertiesState string + +const ( + UpdateRunPropertiesStateFailed UpdateRunPropertiesState = "Failed" + UpdateRunPropertiesStateInProgress UpdateRunPropertiesState = "InProgress" + UpdateRunPropertiesStateSucceeded UpdateRunPropertiesState = "Succeeded" + UpdateRunPropertiesStateUnknown UpdateRunPropertiesState = "Unknown" +) + +// PossibleUpdateRunPropertiesStateValues returns the possible values for the UpdateRunPropertiesState const type. +func PossibleUpdateRunPropertiesStateValues() []UpdateRunPropertiesState { + return []UpdateRunPropertiesState{ + UpdateRunPropertiesStateFailed, + UpdateRunPropertiesStateInProgress, + UpdateRunPropertiesStateSucceeded, + UpdateRunPropertiesStateUnknown, + } +} + +// UpdateSummariesPropertiesState - Overall update state of the stamp. +type UpdateSummariesPropertiesState string + +const ( + UpdateSummariesPropertiesStateAppliedSuccessfully UpdateSummariesPropertiesState = "AppliedSuccessfully" + UpdateSummariesPropertiesStateNeedsAttention UpdateSummariesPropertiesState = "NeedsAttention" + UpdateSummariesPropertiesStatePreparationFailed UpdateSummariesPropertiesState = "PreparationFailed" + UpdateSummariesPropertiesStatePreparationInProgress UpdateSummariesPropertiesState = "PreparationInProgress" + UpdateSummariesPropertiesStateUnknown UpdateSummariesPropertiesState = "Unknown" + UpdateSummariesPropertiesStateUpdateAvailable UpdateSummariesPropertiesState = "UpdateAvailable" + UpdateSummariesPropertiesStateUpdateFailed UpdateSummariesPropertiesState = "UpdateFailed" + UpdateSummariesPropertiesStateUpdateInProgress UpdateSummariesPropertiesState = "UpdateInProgress" +) + +// PossibleUpdateSummariesPropertiesStateValues returns the possible values for the UpdateSummariesPropertiesState const type. +func PossibleUpdateSummariesPropertiesStateValues() []UpdateSummariesPropertiesState { + return []UpdateSummariesPropertiesState{ + UpdateSummariesPropertiesStateAppliedSuccessfully, + UpdateSummariesPropertiesStateNeedsAttention, + UpdateSummariesPropertiesStatePreparationFailed, + UpdateSummariesPropertiesStatePreparationInProgress, + UpdateSummariesPropertiesStateUnknown, + UpdateSummariesPropertiesStateUpdateAvailable, + UpdateSummariesPropertiesStateUpdateFailed, + UpdateSummariesPropertiesStateUpdateInProgress, + } +} + type VMSizeEnum string const ( @@ -371,3 +1026,19 @@ func PossibleVMSizeEnumValues() []VMSizeEnum { VMSizeEnumStandardNV6, } } + +// WindowsServerSubscription - Desired state of Windows Server Subscription. +type WindowsServerSubscription string + +const ( + WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" + WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" +) + +// PossibleWindowsServerSubscriptionValues returns the possible values for the WindowsServerSubscription const type. +func PossibleWindowsServerSubscriptionValues() []WindowsServerSubscription { + return []WindowsServerSubscription{ + WindowsServerSubscriptionDisabled, + WindowsServerSubscriptionEnabled, + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/deploymentsettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/deploymentsettings_client.go new file mode 100644 index 000000000000..d2b20c0f5bac --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/deploymentsettings_client.go @@ -0,0 +1,346 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// DeploymentSettingsClient contains the methods for the DeploymentSettings group. +// Don't use this type directly, use NewDeploymentSettingsClient() instead. +type DeploymentSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeploymentSettingsClient creates a new instance of DeploymentSettingsClient 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 NewDeploymentSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - deploymentSettingsName - Name of Deployment Setting +// - resource - Resource create parameters. +// - options - DeploymentSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentSettingsClient.BeginCreateOrUpdate +// method. +func (client *DeploymentSettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource DeploymentSetting, options *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentSettingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, deploymentSettingsName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentSettingsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentSettingsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *DeploymentSettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource DeploymentSetting, options *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentSettingsClient.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, clusterName, deploymentSettingsName, 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 *DeploymentSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource DeploymentSetting, options *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings/{deploymentSettingsName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if deploymentSettingsName == "" { + return nil, errors.New("parameter deploymentSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentSettingsName}", url.PathEscape(deploymentSettingsName)) + 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-01") + 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 - Delete a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - deploymentSettingsName - Name of Deployment Setting +// - options - DeploymentSettingsClientBeginDeleteOptions contains the optional parameters for the DeploymentSettingsClient.BeginDelete +// method. +func (client *DeploymentSettingsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientBeginDeleteOptions) (*runtime.Poller[DeploymentSettingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, deploymentSettingsName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentSettingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentSettingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *DeploymentSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentSettingsClient.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, clusterName, deploymentSettingsName, 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 *DeploymentSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings/{deploymentSettingsName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if deploymentSettingsName == "" { + return nil, errors.New("parameter deploymentSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentSettingsName}", url.PathEscape(deploymentSettingsName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - deploymentSettingsName - Name of Deployment Setting +// - options - DeploymentSettingsClientGetOptions contains the optional parameters for the DeploymentSettingsClient.Get method. +func (client *DeploymentSettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientGetOptions) (DeploymentSettingsClientGetResponse, error) { + var err error + const operationName = "DeploymentSettingsClient.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, clusterName, deploymentSettingsName, options) + if err != nil { + return DeploymentSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DeploymentSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings/{deploymentSettingsName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if deploymentSettingsName == "" { + return nil, errors.New("parameter deploymentSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentSettingsName}", url.PathEscape(deploymentSettingsName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeploymentSettingsClient) getHandleResponse(resp *http.Response) (DeploymentSettingsClientGetResponse, error) { + result := DeploymentSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentSetting); err != nil { + return DeploymentSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByClustersPager - List DeploymentSetting resources by Clusters +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - DeploymentSettingsClientListByClustersOptions contains the optional parameters for the DeploymentSettingsClient.NewListByClustersPager +// method. +func (client *DeploymentSettingsClient) NewListByClustersPager(resourceGroupName string, clusterName string, options *DeploymentSettingsClientListByClustersOptions) *runtime.Pager[DeploymentSettingsClientListByClustersResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentSettingsClientListByClustersResponse]{ + More: func(page DeploymentSettingsClientListByClustersResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentSettingsClientListByClustersResponse) (DeploymentSettingsClientListByClustersResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentSettingsClient.NewListByClustersPager") + 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.listByClustersCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return DeploymentSettingsClientListByClustersResponse{}, err + } + return client.listByClustersHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClustersCreateRequest creates the ListByClusters request. +func (client *DeploymentSettingsClient) listByClustersCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *DeploymentSettingsClientListByClustersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClustersHandleResponse handles the ListByClusters response. +func (client *DeploymentSettingsClient) listByClustersHandleResponse(resp *http.Response) (DeploymentSettingsClientListByClustersResponse, error) { + result := DeploymentSettingsClientListByClustersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentSettingListResult); err != nil { + return DeploymentSettingsClientListByClustersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/edgedevices_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/edgedevices_client.go new file mode 100644 index 000000000000..0affacc2cabb --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/edgedevices_client.go @@ -0,0 +1,367 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// EdgeDevicesClient contains the methods for the EdgeDevices group. +// Don't use this type directly, use NewEdgeDevicesClient() instead. +type EdgeDevicesClient struct { + internal *arm.Client +} + +// NewEdgeDevicesClient creates a new instance of EdgeDevicesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEdgeDevicesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EdgeDevicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EdgeDevicesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - resource - Resource create parameters. +// - options - EdgeDevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the EdgeDevicesClient.BeginCreateOrUpdate +// method. +func (client *EdgeDevicesClient) BeginCreateOrUpdate(ctx context.Context, resourceURI string, edgeDeviceName string, resource EdgeDevice, options *EdgeDevicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EdgeDevicesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceURI, edgeDeviceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EdgeDevicesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EdgeDevicesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *EdgeDevicesClient) createOrUpdate(ctx context.Context, resourceURI string, edgeDeviceName string, resource EdgeDevice, options *EdgeDevicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EdgeDevicesClient.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, resourceURI, edgeDeviceName, 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 *EdgeDevicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, resource EdgeDevice, options *EdgeDevicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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-01") + 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 - Delete a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - options - EdgeDevicesClientBeginDeleteOptions contains the optional parameters for the EdgeDevicesClient.BeginDelete method. +func (client *EdgeDevicesClient) BeginDelete(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientBeginDeleteOptions) (*runtime.Poller[EdgeDevicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceURI, edgeDeviceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EdgeDevicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EdgeDevicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *EdgeDevicesClient) deleteOperation(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EdgeDevicesClient.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, resourceURI, edgeDeviceName, 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 *EdgeDevicesClient) deleteCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - options - EdgeDevicesClientGetOptions contains the optional parameters for the EdgeDevicesClient.Get method. +func (client *EdgeDevicesClient) Get(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientGetOptions) (EdgeDevicesClientGetResponse, error) { + var err error + const operationName = "EdgeDevicesClient.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, edgeDeviceName, options) + if err != nil { + return EdgeDevicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EdgeDevicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EdgeDevicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EdgeDevicesClient) getCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EdgeDevicesClient) getHandleResponse(resp *http.Response) (EdgeDevicesClientGetResponse, error) { + result := EdgeDevicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EdgeDevice); err != nil { + return EdgeDevicesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List EdgeDevice resources by parent +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - options - EdgeDevicesClientListOptions contains the optional parameters for the EdgeDevicesClient.NewListPager method. +func (client *EdgeDevicesClient) NewListPager(resourceURI string, options *EdgeDevicesClientListOptions) *runtime.Pager[EdgeDevicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[EdgeDevicesClientListResponse]{ + More: func(page EdgeDevicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EdgeDevicesClientListResponse) (EdgeDevicesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EdgeDevicesClient.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, resourceURI, options) + }, nil) + if err != nil { + return EdgeDevicesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *EdgeDevicesClient) listCreateRequest(ctx context.Context, resourceURI string, options *EdgeDevicesClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *EdgeDevicesClient) listHandleResponse(resp *http.Response) (EdgeDevicesClientListResponse, error) { + result := EdgeDevicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EdgeDeviceListResult); err != nil { + return EdgeDevicesClientListResponse{}, err + } + return result, nil +} + +// BeginValidate - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - validateRequest - The content of the action request +// - options - EdgeDevicesClientBeginValidateOptions contains the optional parameters for the EdgeDevicesClient.BeginValidate +// method. +func (client *EdgeDevicesClient) BeginValidate(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest ValidateRequest, options *EdgeDevicesClientBeginValidateOptions) (*runtime.Poller[EdgeDevicesClientValidateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validate(ctx, resourceURI, edgeDeviceName, validateRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EdgeDevicesClientValidateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EdgeDevicesClientValidateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Validate - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *EdgeDevicesClient) validate(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest ValidateRequest, options *EdgeDevicesClientBeginValidateOptions) (*http.Response, error) { + var err error + const operationName = "EdgeDevicesClient.BeginValidate" + 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, resourceURI, edgeDeviceName, validateRequest, 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 +} + +// validateCreateRequest creates the Validate request. +func (client *EdgeDevicesClient) validateCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest ValidateRequest, options *EdgeDevicesClientBeginValidateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}/validate" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, validateRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go new file mode 100644 index 000000000000..7b04d52346d3 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go @@ -0,0 +1,544 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// ExtensionsClient contains the methods for the Extensions group. +// Don't use this type directly, use NewExtensionsClient() instead. +type ExtensionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExtensionsClient creates a new instance of ExtensionsClient 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 NewExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExtensionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create Extension for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - extensionName - The name of the machine extension. +// - extension - Details of the Machine Extension to be created. +// - options - ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. +func (client *ExtensionsClient) BeginCreate(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*runtime.Poller[ExtensionsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create Extension for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.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, clusterName, arcSettingName, extensionName, extension, 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 *ExtensionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + if extensionName == "" { + return nil, errors.New("parameter extensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extension); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - extensionName - The name of the machine extension. +// - options - ExtensionsClientBeginDeleteOptions contains the optional parameters for the ExtensionsClient.BeginDelete method. +func (client *ExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*runtime.Poller[ExtensionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.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, clusterName, arcSettingName, extensionName, 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 *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + if extensionName == "" { + return nil, errors.New("parameter extensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - extensionName - The name of the machine extension. +// - options - ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. +func (client *ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientGetOptions) (ExtensionsClientGetResponse, error) { + var err error + const operationName = "ExtensionsClient.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, clusterName, arcSettingName, extensionName, options) + if err != nil { + return ExtensionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtensionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + if extensionName == "" { + return nil, errors.New("parameter extensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (ExtensionsClientGetResponse, error) { + result := ExtensionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { + return ExtensionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByArcSettingPager - List all Extensions under ArcSetting resource. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - options - ExtensionsClientListByArcSettingOptions contains the optional parameters for the ExtensionsClient.NewListByArcSettingPager +// method. +func (client *ExtensionsClient) NewListByArcSettingPager(resourceGroupName string, clusterName string, arcSettingName string, options *ExtensionsClientListByArcSettingOptions) *runtime.Pager[ExtensionsClientListByArcSettingResponse] { + return runtime.NewPager(runtime.PagingHandler[ExtensionsClientListByArcSettingResponse]{ + More: func(page ExtensionsClientListByArcSettingResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExtensionsClientListByArcSettingResponse) (ExtensionsClientListByArcSettingResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExtensionsClient.NewListByArcSettingPager") + 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.listByArcSettingCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + }, nil) + if err != nil { + return ExtensionsClientListByArcSettingResponse{}, err + } + return client.listByArcSettingHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByArcSettingCreateRequest creates the ListByArcSetting request. +func (client *ExtensionsClient) listByArcSettingCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ExtensionsClientListByArcSettingOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByArcSettingHandleResponse handles the ListByArcSetting response. +func (client *ExtensionsClient) listByArcSettingHandleResponse(resp *http.Response) (ExtensionsClientListByArcSettingResponse, error) { + result := ExtensionsClientListByArcSettingResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionList); err != nil { + return ExtensionsClientListByArcSettingResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update Extension for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - extensionName - The name of the machine extension. +// - extension - Details of the Machine Extension to be created. +// - options - ExtensionsClientBeginUpdateOptions contains the optional parameters for the ExtensionsClient.BeginUpdate method. +func (client *ExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension ExtensionPatch, options *ExtensionsClientBeginUpdateOptions) (*runtime.Poller[ExtensionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update Extension for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension ExtensionPatch, options *ExtensionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.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, clusterName, arcSettingName, extensionName, extension, 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 *ExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension ExtensionPatch, options *ExtensionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + if extensionName == "" { + return nil, errors.New("parameter extensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extension); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpgrade - Upgrade a particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - arcSettingName - The name of the proxy resource holding details of HCI ArcSetting information. +// - extensionName - The name of the machine extension. +// - extensionUpgradeParameters - Parameters supplied to the Upgrade Extensions operation. +// - options - ExtensionsClientBeginUpgradeOptions contains the optional parameters for the ExtensionsClient.BeginUpgrade method. +func (client *ExtensionsClient) BeginUpgrade(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters ExtensionUpgradeParameters, options *ExtensionsClientBeginUpgradeOptions) (*runtime.Poller[ExtensionsClientUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.upgrade(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extensionUpgradeParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientUpgradeResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientUpgradeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Upgrade - Upgrade a particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) upgrade(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters ExtensionUpgradeParameters, options *ExtensionsClientBeginUpgradeOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.BeginUpgrade" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.upgradeCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extensionUpgradeParameters, 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 +} + +// upgradeCreateRequest creates the Upgrade request. +func (client *ExtensionsClient) upgradeCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters ExtensionUpgradeParameters, options *ExtensionsClientBeginUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if arcSettingName == "" { + return nil, errors.New("parameter arcSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{arcSettingName}", url.PathEscape(arcSettingName)) + if extensionName == "" { + return nil, errors.New("parameter extensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionName}", url.PathEscape(extensionName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionUpgradeParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/arcsettings_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/arcsettings_server.go new file mode 100644 index 000000000000..c2152a8d4e88 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/arcsettings_server.go @@ -0,0 +1,504 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// ArcSettingsServer is a fake server for instances of the armazurestackhci.ArcSettingsClient type. +type ArcSettingsServer struct { + // ConsentAndInstallDefaultExtensions is the fake for method ArcSettingsClient.ConsentAndInstallDefaultExtensions + // HTTP status codes to indicate success: http.StatusOK + ConsentAndInstallDefaultExtensions func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientConsentAndInstallDefaultExtensionsResponse], errResp azfake.ErrorResponder) + + // Create is the fake for method ArcSettingsClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting armazurestackhci.ArcSetting, options *armazurestackhci.ArcSettingsClientCreateOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginCreateIdentity is the fake for method ArcSettingsClient.BeginCreateIdentity + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateIdentity func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginCreateIdentityOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ArcSettingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // GeneratePassword is the fake for method ArcSettingsClient.GeneratePassword + // HTTP status codes to indicate success: http.StatusOK + GeneratePassword func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientGeneratePasswordOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientGeneratePasswordResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ArcSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientGetResponse], errResp azfake.ErrorResponder) + + // BeginInitializeDisableProcess is the fake for method ArcSettingsClient.BeginInitializeDisableProcess + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginInitializeDisableProcess func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginInitializeDisableProcessOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method ArcSettingsClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.ArcSettingsClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]) + + // Update is the fake for method ArcSettingsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting armazurestackhci.ArcSettingsPatch, options *armazurestackhci.ArcSettingsClientUpdateOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewArcSettingsServerTransport creates a new instance of ArcSettingsServerTransport with the provided implementation. +// The returned ArcSettingsServerTransport instance is connected to an instance of armazurestackhci.ArcSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewArcSettingsServerTransport(srv *ArcSettingsServer) *ArcSettingsServerTransport { + return &ArcSettingsServerTransport{ + srv: srv, + beginCreateIdentity: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse]](), + beginInitializeDisableProcess: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse]](), + newListByClusterPager: newTracker[azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]](), + } +} + +// ArcSettingsServerTransport connects instances of armazurestackhci.ArcSettingsClient to instances of ArcSettingsServer. +// Don't use this type directly, use NewArcSettingsServerTransport instead. +type ArcSettingsServerTransport struct { + srv *ArcSettingsServer + beginCreateIdentity *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse]] + beginInitializeDisableProcess *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse]] + newListByClusterPager *tracker[azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]] +} + +// Do implements the policy.Transporter interface for ArcSettingsServerTransport. +func (a *ArcSettingsServerTransport) 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 "ArcSettingsClient.ConsentAndInstallDefaultExtensions": + resp, err = a.dispatchConsentAndInstallDefaultExtensions(req) + case "ArcSettingsClient.Create": + resp, err = a.dispatchCreate(req) + case "ArcSettingsClient.BeginCreateIdentity": + resp, err = a.dispatchBeginCreateIdentity(req) + case "ArcSettingsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "ArcSettingsClient.GeneratePassword": + resp, err = a.dispatchGeneratePassword(req) + case "ArcSettingsClient.Get": + resp, err = a.dispatchGet(req) + case "ArcSettingsClient.BeginInitializeDisableProcess": + resp, err = a.dispatchBeginInitializeDisableProcess(req) + case "ArcSettingsClient.NewListByClusterPager": + resp, err = a.dispatchNewListByClusterPager(req) + case "ArcSettingsClient.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 *ArcSettingsServerTransport) dispatchConsentAndInstallDefaultExtensions(req *http.Request) (*http.Response, error) { + if a.srv.ConsentAndInstallDefaultExtensions == nil { + return nil, &nonRetriableError{errors.New("fake for method ConsentAndInstallDefaultExtensions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/consentAndInstallDefaultExtensions` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.ConsentAndInstallDefaultExtensions(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?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[armazurestackhci.ArcSetting](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchBeginCreateIdentity(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateIdentity == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateIdentity not implemented")} + } + beginCreateIdentity := a.beginCreateIdentity.get(req) + if beginCreateIdentity == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createArcIdentity` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateIdentity(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateIdentity = &respr + a.beginCreateIdentity.add(req, beginCreateIdentity) + } + + resp, err := server.PollerResponderNext(beginCreateIdentity, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginCreateIdentity.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateIdentity) { + a.beginCreateIdentity.remove(req) + } + + return resp, nil +} + +func (a *ArcSettingsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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 *ArcSettingsServerTransport) dispatchGeneratePassword(req *http.Request) (*http.Response, error) { + if a.srv.GeneratePassword == nil { + return nil, &nonRetriableError{errors.New("fake for method GeneratePassword not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generatePassword` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GeneratePassword(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).PasswordCredential, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchBeginInitializeDisableProcess(req *http.Request) (*http.Response, error) { + if a.srv.BeginInitializeDisableProcess == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginInitializeDisableProcess not implemented")} + } + beginInitializeDisableProcess := a.beginInitializeDisableProcess.get(req) + if beginInitializeDisableProcess == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/initializeDisableProcess` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginInitializeDisableProcess(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginInitializeDisableProcess = &respr + a.beginInitializeDisableProcess.add(req, beginInitializeDisableProcess) + } + + resp, err := server.PollerResponderNext(beginInitializeDisableProcess, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginInitializeDisableProcess.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginInitializeDisableProcess) { + a.beginInitializeDisableProcess.remove(req) + } + + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := a.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClusterPager = &resp + a.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.ArcSettingsClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + a.newListByClusterPager.remove(req) + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?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[armazurestackhci.ArcSettingsPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, 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).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/clusters_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/clusters_server.go new file mode 100644 index 000000000000..7ef20637e3bd --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/clusters_server.go @@ -0,0 +1,491 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// ClustersServer is a fake server for instances of the armazurestackhci.ClustersClient type. +type ClustersServer struct { + // Create is the fake for method ClustersClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, clusterName string, cluster armazurestackhci.Cluster, options *armazurestackhci.ClustersClientCreateOptions) (resp azfake.Responder[armazurestackhci.ClustersClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginCreateIdentity is the fake for method ClustersClient.BeginCreateIdentity + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateIdentity func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.ClustersClientBeginCreateIdentityOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientCreateIdentityResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.ClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginExtendSoftwareAssuranceBenefit is the fake for method ClustersClient.BeginExtendSoftwareAssuranceBenefit + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExtendSoftwareAssuranceBenefit func(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest armazurestackhci.SoftwareAssuranceChangeRequest, options *armazurestackhci.ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientExtendSoftwareAssuranceBenefitResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.ClustersClientGetOptions) (resp azfake.Responder[armazurestackhci.ClustersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armazurestackhci.ClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armazurestackhci.ClustersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ClustersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armazurestackhci.ClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armazurestackhci.ClustersClientListBySubscriptionResponse]) + + // Update is the fake for method ClustersClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, clusterName string, cluster armazurestackhci.ClusterPatch, options *armazurestackhci.ClustersClientUpdateOptions) (resp azfake.Responder[armazurestackhci.ClustersClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginUploadCertificate is the fake for method ClustersClient.BeginUploadCertificate + // HTTP status codes to indicate success: http.StatusAccepted + BeginUploadCertificate func(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest armazurestackhci.UploadCertificateRequest, options *armazurestackhci.ClustersClientBeginUploadCertificateOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientUploadCertificateResponse], errResp azfake.ErrorResponder) +} + +// NewClustersServerTransport creates a new instance of ClustersServerTransport with the provided implementation. +// The returned ClustersServerTransport instance is connected to an instance of armazurestackhci.ClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewClustersServerTransport(srv *ClustersServer) *ClustersServerTransport { + return &ClustersServerTransport{ + srv: srv, + beginCreateIdentity: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientCreateIdentityResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientDeleteResponse]](), + beginExtendSoftwareAssuranceBenefit: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientExtendSoftwareAssuranceBenefitResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armazurestackhci.ClustersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armazurestackhci.ClustersClientListBySubscriptionResponse]](), + beginUploadCertificate: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientUploadCertificateResponse]](), + } +} + +// ClustersServerTransport connects instances of armazurestackhci.ClustersClient to instances of ClustersServer. +// Don't use this type directly, use NewClustersServerTransport instead. +type ClustersServerTransport struct { + srv *ClustersServer + beginCreateIdentity *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientCreateIdentityResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientDeleteResponse]] + beginExtendSoftwareAssuranceBenefit *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientExtendSoftwareAssuranceBenefitResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armazurestackhci.ClustersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armazurestackhci.ClustersClientListBySubscriptionResponse]] + beginUploadCertificate *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientUploadCertificateResponse]] +} + +// Do implements the policy.Transporter interface for ClustersServerTransport. +func (c *ClustersServerTransport) 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 "ClustersClient.Create": + resp, err = c.dispatchCreate(req) + case "ClustersClient.BeginCreateIdentity": + resp, err = c.dispatchBeginCreateIdentity(req) + case "ClustersClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ClustersClient.BeginExtendSoftwareAssuranceBenefit": + resp, err = c.dispatchBeginExtendSoftwareAssuranceBenefit(req) + case "ClustersClient.Get": + resp, err = c.dispatchGet(req) + case "ClustersClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "ClustersClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "ClustersClient.Update": + resp, err = c.dispatchUpdate(req) + case "ClustersClient.BeginUploadCertificate": + resp, err = c.dispatchBeginUploadCertificate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if c.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\.AzureStackHCI/clusters/(?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[armazurestackhci.Cluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Create(req.Context(), resourceGroupNameParam, clusterNameParam, 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).Cluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginCreateIdentity(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateIdentity == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateIdentity not implemented")} + } + beginCreateIdentity := c.beginCreateIdentity.get(req) + if beginCreateIdentity == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createClusterIdentity` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateIdentity(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateIdentity = &respr + c.beginCreateIdentity.add(req, beginCreateIdentity) + } + + resp, err := server.PollerResponderNext(beginCreateIdentity, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginCreateIdentity.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateIdentity) { + c.beginCreateIdentity.remove(req) + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.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) { + c.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) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginExtendSoftwareAssuranceBenefit(req *http.Request) (*http.Response, error) { + if c.srv.BeginExtendSoftwareAssuranceBenefit == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExtendSoftwareAssuranceBenefit not implemented")} + } + beginExtendSoftwareAssuranceBenefit := c.beginExtendSoftwareAssuranceBenefit.get(req) + if beginExtendSoftwareAssuranceBenefit == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extendSoftwareAssuranceBenefit` + 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[armazurestackhci.SoftwareAssuranceChangeRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginExtendSoftwareAssuranceBenefit(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExtendSoftwareAssuranceBenefit = &respr + c.beginExtendSoftwareAssuranceBenefit.add(req, beginExtendSoftwareAssuranceBenefit) + } + + resp, err := server.PollerResponderNext(beginExtendSoftwareAssuranceBenefit, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginExtendSoftwareAssuranceBenefit.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExtendSoftwareAssuranceBenefit) { + c.beginExtendSoftwareAssuranceBenefit.remove(req) + } + + return resp, nil +} + +func (c *ClustersServerTransport) 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~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, 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).Cluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters` + 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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armazurestackhci.ClustersClientListByResourceGroupResponse, 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) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters` + 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 := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armazurestackhci.ClustersClientListBySubscriptionResponse, 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) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if c.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\.AzureStackHCI/clusters/(?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[armazurestackhci.ClusterPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, clusterNameParam, 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).Cluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginUploadCertificate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUploadCertificate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUploadCertificate not implemented")} + } + beginUploadCertificate := c.beginUploadCertificate.get(req) + if beginUploadCertificate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/uploadCertificate` + 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[armazurestackhci.UploadCertificateRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUploadCertificate(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUploadCertificate = &respr + c.beginUploadCertificate.add(req, beginUploadCertificate) + } + + resp, err := server.PollerResponderNext(beginUploadCertificate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + c.beginUploadCertificate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUploadCertificate) { + c.beginUploadCertificate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/deploymentsettings_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/deploymentsettings_server.go new file mode 100644 index 000000000000..9cf978eb800f --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/deploymentsettings_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// DeploymentSettingsServer is a fake server for instances of the armazurestackhci.DeploymentSettingsClient type. +type DeploymentSettingsServer struct { + // BeginCreateOrUpdate is the fake for method DeploymentSettingsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource armazurestackhci.DeploymentSetting, options *armazurestackhci.DeploymentSettingsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DeploymentSettingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *armazurestackhci.DeploymentSettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DeploymentSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *armazurestackhci.DeploymentSettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.DeploymentSettingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClustersPager is the fake for method DeploymentSettingsClient.NewListByClustersPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClustersPager func(resourceGroupName string, clusterName string, options *armazurestackhci.DeploymentSettingsClientListByClustersOptions) (resp azfake.PagerResponder[armazurestackhci.DeploymentSettingsClientListByClustersResponse]) +} + +// NewDeploymentSettingsServerTransport creates a new instance of DeploymentSettingsServerTransport with the provided implementation. +// The returned DeploymentSettingsServerTransport instance is connected to an instance of armazurestackhci.DeploymentSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeploymentSettingsServerTransport(srv *DeploymentSettingsServer) *DeploymentSettingsServerTransport { + return &DeploymentSettingsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientDeleteResponse]](), + newListByClustersPager: newTracker[azfake.PagerResponder[armazurestackhci.DeploymentSettingsClientListByClustersResponse]](), + } +} + +// DeploymentSettingsServerTransport connects instances of armazurestackhci.DeploymentSettingsClient to instances of DeploymentSettingsServer. +// Don't use this type directly, use NewDeploymentSettingsServerTransport instead. +type DeploymentSettingsServerTransport struct { + srv *DeploymentSettingsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientDeleteResponse]] + newListByClustersPager *tracker[azfake.PagerResponder[armazurestackhci.DeploymentSettingsClientListByClustersResponse]] +} + +// Do implements the policy.Transporter interface for DeploymentSettingsServerTransport. +func (d *DeploymentSettingsServerTransport) 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 "DeploymentSettingsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DeploymentSettingsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DeploymentSettingsClient.Get": + resp, err = d.dispatchGet(req) + case "DeploymentSettingsClient.NewListByClustersPager": + resp, err = d.dispatchNewListByClustersPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings/(?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[armazurestackhci.DeploymentSetting](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + deploymentSettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentSettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, deploymentSettingsNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.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) { + d.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) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + deploymentSettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentSettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, deploymentSettingsNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + 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 !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + deploymentSettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentSettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, deploymentSettingsNameParam, 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).DeploymentSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchNewListByClustersPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByClustersPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClustersPager not implemented")} + } + newListByClustersPager := d.newListByClustersPager.get(req) + if newListByClustersPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByClustersPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClustersPager = &resp + d.newListByClustersPager.add(req, newListByClustersPager) + server.PagerResponderInjectNextLinks(newListByClustersPager, req, func(page *armazurestackhci.DeploymentSettingsClientListByClustersResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClustersPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByClustersPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClustersPager) { + d.newListByClustersPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/edgedevices_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/edgedevices_server.go new file mode 100644 index 000000000000..670da9728b68 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/edgedevices_server.go @@ -0,0 +1,312 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// EdgeDevicesServer is a fake server for instances of the armazurestackhci.EdgeDevicesClient type. +type EdgeDevicesServer struct { + // BeginCreateOrUpdate is the fake for method EdgeDevicesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceURI string, edgeDeviceName string, resource armazurestackhci.EdgeDevice, options *armazurestackhci.EdgeDevicesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.EdgeDevicesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EdgeDevicesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceURI string, edgeDeviceName string, options *armazurestackhci.EdgeDevicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.EdgeDevicesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EdgeDevicesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, edgeDeviceName string, options *armazurestackhci.EdgeDevicesClientGetOptions) (resp azfake.Responder[armazurestackhci.EdgeDevicesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method EdgeDevicesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceURI string, options *armazurestackhci.EdgeDevicesClientListOptions) (resp azfake.PagerResponder[armazurestackhci.EdgeDevicesClientListResponse]) + + // BeginValidate is the fake for method EdgeDevicesClient.BeginValidate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginValidate func(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest armazurestackhci.ValidateRequest, options *armazurestackhci.EdgeDevicesClientBeginValidateOptions) (resp azfake.PollerResponder[armazurestackhci.EdgeDevicesClientValidateResponse], errResp azfake.ErrorResponder) +} + +// NewEdgeDevicesServerTransport creates a new instance of EdgeDevicesServerTransport with the provided implementation. +// The returned EdgeDevicesServerTransport instance is connected to an instance of armazurestackhci.EdgeDevicesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEdgeDevicesServerTransport(srv *EdgeDevicesServer) *EdgeDevicesServerTransport { + return &EdgeDevicesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.EdgeDevicesClientListResponse]](), + beginValidate: newTracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientValidateResponse]](), + } +} + +// EdgeDevicesServerTransport connects instances of armazurestackhci.EdgeDevicesClient to instances of EdgeDevicesServer. +// Don't use this type directly, use NewEdgeDevicesServerTransport instead. +type EdgeDevicesServerTransport struct { + srv *EdgeDevicesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.EdgeDevicesClientListResponse]] + beginValidate *tracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientValidateResponse]] +} + +// Do implements the policy.Transporter interface for EdgeDevicesServerTransport. +func (e *EdgeDevicesServerTransport) 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 "EdgeDevicesClient.BeginCreateOrUpdate": + resp, err = e.dispatchBeginCreateOrUpdate(req) + case "EdgeDevicesClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "EdgeDevicesClient.Get": + resp, err = e.dispatchGet(req) + case "EdgeDevicesClient.NewListPager": + resp, err = e.dispatchNewListPager(req) + case "EdgeDevicesClient.BeginValidate": + resp, err = e.dispatchBeginValidate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?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[armazurestackhci.EdgeDevice](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceURIParam, edgeDeviceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.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) { + e.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) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?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 + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceURIParam, edgeDeviceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?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 + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceURIParam, edgeDeviceNameParam, 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).EdgeDevice, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EdgeDevicesServerTransport) 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 { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices` + 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 := e.srv.NewListPager(resourceURIParam, nil) + newListPager = &resp + e.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.EdgeDevicesClientListResponse, 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) { + 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 +} + +func (e *EdgeDevicesServerTransport) dispatchBeginValidate(req *http.Request) (*http.Response, error) { + if e.srv.BeginValidate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginValidate not implemented")} + } + beginValidate := e.beginValidate.get(req) + if beginValidate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validate` + 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[armazurestackhci.ValidateRequest](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginValidate(req.Context(), resourceURIParam, edgeDeviceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginValidate = &respr + e.beginValidate.add(req, beginValidate) + } + + resp, err := server.PollerResponderNext(beginValidate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginValidate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginValidate) { + e.beginValidate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/extensions_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/extensions_server.go new file mode 100644 index 000000000000..f03fb00c194d --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/extensions_server.go @@ -0,0 +1,416 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// ExtensionsServer is a fake server for instances of the armazurestackhci.ExtensionsClient type. +type ExtensionsServer struct { + // BeginCreate is the fake for method ExtensionsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension armazurestackhci.Extension, options *armazurestackhci.ExtensionsClientBeginCreateOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ExtensionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *armazurestackhci.ExtensionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ExtensionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *armazurestackhci.ExtensionsClientGetOptions) (resp azfake.Responder[armazurestackhci.ExtensionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByArcSettingPager is the fake for method ExtensionsClient.NewListByArcSettingPager + // HTTP status codes to indicate success: http.StatusOK + NewListByArcSettingPager func(resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ExtensionsClientListByArcSettingOptions) (resp azfake.PagerResponder[armazurestackhci.ExtensionsClientListByArcSettingResponse]) + + // BeginUpdate is the fake for method ExtensionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension armazurestackhci.ExtensionPatch, options *armazurestackhci.ExtensionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginUpgrade is the fake for method ExtensionsClient.BeginUpgrade + // HTTP status codes to indicate success: http.StatusAccepted + BeginUpgrade func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters armazurestackhci.ExtensionUpgradeParameters, options *armazurestackhci.ExtensionsClientBeginUpgradeOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientUpgradeResponse], errResp azfake.ErrorResponder) +} + +// NewExtensionsServerTransport creates a new instance of ExtensionsServerTransport with the provided implementation. +// The returned ExtensionsServerTransport instance is connected to an instance of armazurestackhci.ExtensionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExtensionsServerTransport(srv *ExtensionsServer) *ExtensionsServerTransport { + return &ExtensionsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientDeleteResponse]](), + newListByArcSettingPager: newTracker[azfake.PagerResponder[armazurestackhci.ExtensionsClientListByArcSettingResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpdateResponse]](), + beginUpgrade: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpgradeResponse]](), + } +} + +// ExtensionsServerTransport connects instances of armazurestackhci.ExtensionsClient to instances of ExtensionsServer. +// Don't use this type directly, use NewExtensionsServerTransport instead. +type ExtensionsServerTransport struct { + srv *ExtensionsServer + beginCreate *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientDeleteResponse]] + newListByArcSettingPager *tracker[azfake.PagerResponder[armazurestackhci.ExtensionsClientListByArcSettingResponse]] + beginUpdate *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpdateResponse]] + beginUpgrade *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpgradeResponse]] +} + +// Do implements the policy.Transporter interface for ExtensionsServerTransport. +func (e *ExtensionsServerTransport) 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 "ExtensionsClient.BeginCreate": + resp, err = e.dispatchBeginCreate(req) + case "ExtensionsClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "ExtensionsClient.Get": + resp, err = e.dispatchGet(req) + case "ExtensionsClient.NewListByArcSettingPager": + resp, err = e.dispatchNewListByArcSettingPager(req) + case "ExtensionsClient.BeginUpdate": + resp, err = e.dispatchBeginUpdate(req) + case "ExtensionsClient.BeginUpgrade": + resp, err = e.dispatchBeginUpgrade(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := e.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?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[armazurestackhci.Extension](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreate(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + e.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) { + e.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) { + e.beginCreate.remove(req) + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.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) { + e.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) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, 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).Extension, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchNewListByArcSettingPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByArcSettingPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByArcSettingPager not implemented")} + } + newListByArcSettingPager := e.newListByArcSettingPager.get(req) + if newListByArcSettingPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListByArcSettingPager(resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + newListByArcSettingPager = &resp + e.newListByArcSettingPager.add(req, newListByArcSettingPager) + server.PagerResponderInjectNextLinks(newListByArcSettingPager, req, func(page *armazurestackhci.ExtensionsClientListByArcSettingResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByArcSettingPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByArcSettingPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByArcSettingPager) { + e.newListByArcSettingPager.remove(req) + } + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?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[armazurestackhci.ExtensionPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.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) { + e.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) { + e.beginUpdate.remove(req) + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginUpgrade(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpgrade == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpgrade not implemented")} + } + beginUpgrade := e.beginUpgrade.get(req) + if beginUpgrade == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upgrade` + 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[armazurestackhci.ExtensionUpgradeParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpgrade(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpgrade = &respr + e.beginUpgrade.add(req, beginUpgrade) + } + + resp, err := server.PollerResponderNext(beginUpgrade, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + e.beginUpgrade.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpgrade) { + e.beginUpgrade.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go index 5f75802a569e..94e060e89dbd 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go @@ -11,6 +11,7 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) @@ -31,6 +32,13 @@ func contains[T comparable](s []T, v T) bool { 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{}, diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/offers_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/offers_server.go new file mode 100644 index 000000000000..0d622db0a8d6 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/offers_server.go @@ -0,0 +1,249 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// OffersServer is a fake server for instances of the armazurestackhci.OffersClient type. +type OffersServer struct { + // Get is the fake for method OffersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *armazurestackhci.OffersClientGetOptions) (resp azfake.Responder[armazurestackhci.OffersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method OffersClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.OffersClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.OffersClientListByClusterResponse]) + + // NewListByPublisherPager is the fake for method OffersClient.NewListByPublisherPager + // HTTP status codes to indicate success: http.StatusOK + NewListByPublisherPager func(resourceGroupName string, clusterName string, publisherName string, options *armazurestackhci.OffersClientListByPublisherOptions) (resp azfake.PagerResponder[armazurestackhci.OffersClientListByPublisherResponse]) +} + +// NewOffersServerTransport creates a new instance of OffersServerTransport with the provided implementation. +// The returned OffersServerTransport instance is connected to an instance of armazurestackhci.OffersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOffersServerTransport(srv *OffersServer) *OffersServerTransport { + return &OffersServerTransport{ + srv: srv, + newListByClusterPager: newTracker[azfake.PagerResponder[armazurestackhci.OffersClientListByClusterResponse]](), + newListByPublisherPager: newTracker[azfake.PagerResponder[armazurestackhci.OffersClientListByPublisherResponse]](), + } +} + +// OffersServerTransport connects instances of armazurestackhci.OffersClient to instances of OffersServer. +// Don't use this type directly, use NewOffersServerTransport instead. +type OffersServerTransport struct { + srv *OffersServer + newListByClusterPager *tracker[azfake.PagerResponder[armazurestackhci.OffersClientListByClusterResponse]] + newListByPublisherPager *tracker[azfake.PagerResponder[armazurestackhci.OffersClientListByPublisherResponse]] +} + +// Do implements the policy.Transporter interface for OffersServerTransport. +func (o *OffersServerTransport) 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 "OffersClient.Get": + resp, err = o.dispatchGet(req) + case "OffersClient.NewListByClusterPager": + resp, err = o.dispatchNewListByClusterPager(req) + case "OffersClient.NewListByPublisherPager": + resp, err = o.dispatchNewListByPublisherPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OffersServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers/(?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) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + offerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("offerName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.OffersClientGetOptions + if expandParam != nil { + options = &armazurestackhci.OffersClientGetOptions{ + Expand: expandParam, + } + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, publisherNameParam, offerNameParam, 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).Offer, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *OffersServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := o.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.OffersClientListByClusterOptions + if expandParam != nil { + options = &armazurestackhci.OffersClientListByClusterOptions{ + Expand: expandParam, + } + } + resp := o.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, options) + newListByClusterPager = &resp + o.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.OffersClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + o.newListByClusterPager.remove(req) + } + return resp, nil +} + +func (o *OffersServerTransport) dispatchNewListByPublisherPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByPublisherPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPublisherPager not implemented")} + } + newListByPublisherPager := o.newListByPublisherPager.get(req) + if newListByPublisherPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.OffersClientListByPublisherOptions + if expandParam != nil { + options = &armazurestackhci.OffersClientListByPublisherOptions{ + Expand: expandParam, + } + } + resp := o.srv.NewListByPublisherPager(resourceGroupNameParam, clusterNameParam, publisherNameParam, options) + newListByPublisherPager = &resp + o.newListByPublisherPager.add(req, newListByPublisherPager) + server.PagerResponderInjectNextLinks(newListByPublisherPager, req, func(page *armazurestackhci.OffersClientListByPublisherResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPublisherPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListByPublisherPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPublisherPager) { + o.newListByPublisherPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go index 84cfeec0e7c2..abe4dbf4305b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go @@ -9,38 +9,34 @@ 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/azurestackhci/armazurestackhci/v2" "net/http" ) // OperationsServer is a fake server for instances of the armazurestackhci.OperationsClient type. type OperationsServer struct { - // NewListPager is the fake for method OperationsClient.NewListPager + // List is the fake for method OperationsClient.List // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armazurestackhci.OperationsClientListOptions) (resp azfake.PagerResponder[armazurestackhci.OperationsClientListResponse]) + List func(ctx context.Context, options *armazurestackhci.OperationsClientListOptions) (resp azfake.Responder[armazurestackhci.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 armazurestackhci.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[armazurestackhci.OperationsClientListResponse]](), - } + return &OperationsServerTransport{srv: srv} } // OperationsServerTransport connects instances of armazurestackhci.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { - srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armazurestackhci.OperationsClientListResponse]] + srv *OperationsServer } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -55,8 +51,8 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error var err error switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) + case "OperationsClient.List": + resp, err = o.dispatchList(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -68,29 +64,21 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return resp, nil } -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")} +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 } - 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 *armazurestackhci.OperationsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) + 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.PagerResponderNext(newListPager, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResult, 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/azurestackhci/armazurestackhci/fake/publishers_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/publishers_server.go new file mode 100644 index 000000000000..d8179653f92b --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/publishers_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// PublishersServer is a fake server for instances of the armazurestackhci.PublishersClient type. +type PublishersServer struct { + // Get is the fake for method PublishersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *armazurestackhci.PublishersClientGetOptions) (resp azfake.Responder[armazurestackhci.PublishersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method PublishersClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.PublishersClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.PublishersClientListByClusterResponse]) +} + +// NewPublishersServerTransport creates a new instance of PublishersServerTransport with the provided implementation. +// The returned PublishersServerTransport instance is connected to an instance of armazurestackhci.PublishersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPublishersServerTransport(srv *PublishersServer) *PublishersServerTransport { + return &PublishersServerTransport{ + srv: srv, + newListByClusterPager: newTracker[azfake.PagerResponder[armazurestackhci.PublishersClientListByClusterResponse]](), + } +} + +// PublishersServerTransport connects instances of armazurestackhci.PublishersClient to instances of PublishersServer. +// Don't use this type directly, use NewPublishersServerTransport instead. +type PublishersServerTransport struct { + srv *PublishersServer + newListByClusterPager *tracker[azfake.PagerResponder[armazurestackhci.PublishersClientListByClusterResponse]] +} + +// Do implements the policy.Transporter interface for PublishersServerTransport. +func (p *PublishersServerTransport) 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 "PublishersClient.Get": + resp, err = p.dispatchGet(req) + case "PublishersClient.NewListByClusterPager": + resp, err = p.dispatchNewListByClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PublishersServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, publisherNameParam, 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).Publisher, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PublishersServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := p.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClusterPager = &resp + p.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.PublishersClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + p.newListByClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/securitysettings_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/securitysettings_server.go new file mode 100644 index 000000000000..768243215b70 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/securitysettings_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// SecuritySettingsServer is a fake server for instances of the armazurestackhci.SecuritySettingsClient type. +type SecuritySettingsServer struct { + // BeginCreateOrUpdate is the fake for method SecuritySettingsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource armazurestackhci.SecuritySetting, options *armazurestackhci.SecuritySettingsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.SecuritySettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SecuritySettingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *armazurestackhci.SecuritySettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.SecuritySettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SecuritySettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *armazurestackhci.SecuritySettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.SecuritySettingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClustersPager is the fake for method SecuritySettingsClient.NewListByClustersPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClustersPager func(resourceGroupName string, clusterName string, options *armazurestackhci.SecuritySettingsClientListByClustersOptions) (resp azfake.PagerResponder[armazurestackhci.SecuritySettingsClientListByClustersResponse]) +} + +// NewSecuritySettingsServerTransport creates a new instance of SecuritySettingsServerTransport with the provided implementation. +// The returned SecuritySettingsServerTransport instance is connected to an instance of armazurestackhci.SecuritySettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSecuritySettingsServerTransport(srv *SecuritySettingsServer) *SecuritySettingsServerTransport { + return &SecuritySettingsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientDeleteResponse]](), + newListByClustersPager: newTracker[azfake.PagerResponder[armazurestackhci.SecuritySettingsClientListByClustersResponse]](), + } +} + +// SecuritySettingsServerTransport connects instances of armazurestackhci.SecuritySettingsClient to instances of SecuritySettingsServer. +// Don't use this type directly, use NewSecuritySettingsServerTransport instead. +type SecuritySettingsServerTransport struct { + srv *SecuritySettingsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientDeleteResponse]] + newListByClustersPager *tracker[azfake.PagerResponder[armazurestackhci.SecuritySettingsClientListByClustersResponse]] +} + +// Do implements the policy.Transporter interface for SecuritySettingsServerTransport. +func (s *SecuritySettingsServerTransport) 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 "SecuritySettingsClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SecuritySettingsClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SecuritySettingsClient.Get": + resp, err = s.dispatchGet(req) + case "SecuritySettingsClient.NewListByClustersPager": + resp, err = s.dispatchNewListByClustersPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings/(?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[armazurestackhci.SecuritySetting](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + securitySettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, securitySettingsNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.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) { + s.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) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + securitySettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, securitySettingsNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SecuritySettingsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + securitySettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, securitySettingsNameParam, 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).SecuritySetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchNewListByClustersPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByClustersPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClustersPager not implemented")} + } + newListByClustersPager := s.newListByClustersPager.get(req) + if newListByClustersPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByClustersPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClustersPager = &resp + s.newListByClustersPager.add(req, newListByClustersPager) + server.PagerResponderInjectNextLinks(newListByClustersPager, req, func(page *armazurestackhci.SecuritySettingsClientListByClustersResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClustersPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByClustersPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClustersPager) { + s.newListByClustersPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go index 25768a7c65b8..9f3127ff664b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go @@ -19,6 +19,11 @@ import ( // ServerFactory is a fake server for instances of the armazurestackhci.ClientFactory type. type ServerFactory struct { + ArcSettingsServer ArcSettingsServer + ClustersServer ClustersServer + DeploymentSettingsServer DeploymentSettingsServer + EdgeDevicesServer EdgeDevicesServer + ExtensionsServer ExtensionsServer GalleryImagesServer GalleryImagesServer GuestAgentServer GuestAgentServer GuestAgentsServer GuestAgentsServer @@ -26,8 +31,15 @@ type ServerFactory struct { LogicalNetworksServer LogicalNetworksServer MarketplaceGalleryImagesServer MarketplaceGalleryImagesServer NetworkInterfacesServer NetworkInterfacesServer + OffersServer OffersServer OperationsServer OperationsServer + PublishersServer PublishersServer + SKUsServer SKUsServer + SecuritySettingsServer SecuritySettingsServer StorageContainersServer StorageContainersServer + UpdateRunsServer UpdateRunsServer + UpdateSummariesServer UpdateSummariesServer + UpdatesServer UpdatesServer VirtualHardDisksServer VirtualHardDisksServer VirtualMachineInstancesServer VirtualMachineInstancesServer } @@ -46,6 +58,11 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex + trArcSettingsServer *ArcSettingsServerTransport + trClustersServer *ClustersServerTransport + trDeploymentSettingsServer *DeploymentSettingsServerTransport + trEdgeDevicesServer *EdgeDevicesServerTransport + trExtensionsServer *ExtensionsServerTransport trGalleryImagesServer *GalleryImagesServerTransport trGuestAgentServer *GuestAgentServerTransport trGuestAgentsServer *GuestAgentsServerTransport @@ -53,8 +70,15 @@ type ServerFactoryTransport struct { trLogicalNetworksServer *LogicalNetworksServerTransport trMarketplaceGalleryImagesServer *MarketplaceGalleryImagesServerTransport trNetworkInterfacesServer *NetworkInterfacesServerTransport + trOffersServer *OffersServerTransport trOperationsServer *OperationsServerTransport + trPublishersServer *PublishersServerTransport + trSKUsServer *SKUsServerTransport + trSecuritySettingsServer *SecuritySettingsServerTransport trStorageContainersServer *StorageContainersServerTransport + trUpdateRunsServer *UpdateRunsServerTransport + trUpdateSummariesServer *UpdateSummariesServerTransport + trUpdatesServer *UpdatesServerTransport trVirtualHardDisksServer *VirtualHardDisksServerTransport trVirtualMachineInstancesServer *VirtualMachineInstancesServerTransport } @@ -72,6 +96,23 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "ArcSettingsClient": + initServer(s, &s.trArcSettingsServer, func() *ArcSettingsServerTransport { return NewArcSettingsServerTransport(&s.srv.ArcSettingsServer) }) + resp, err = s.trArcSettingsServer.Do(req) + case "ClustersClient": + initServer(s, &s.trClustersServer, func() *ClustersServerTransport { return NewClustersServerTransport(&s.srv.ClustersServer) }) + resp, err = s.trClustersServer.Do(req) + case "DeploymentSettingsClient": + initServer(s, &s.trDeploymentSettingsServer, func() *DeploymentSettingsServerTransport { + return NewDeploymentSettingsServerTransport(&s.srv.DeploymentSettingsServer) + }) + resp, err = s.trDeploymentSettingsServer.Do(req) + case "EdgeDevicesClient": + initServer(s, &s.trEdgeDevicesServer, func() *EdgeDevicesServerTransport { return NewEdgeDevicesServerTransport(&s.srv.EdgeDevicesServer) }) + resp, err = s.trEdgeDevicesServer.Do(req) + case "ExtensionsClient": + initServer(s, &s.trExtensionsServer, func() *ExtensionsServerTransport { return NewExtensionsServerTransport(&s.srv.ExtensionsServer) }) + resp, err = s.trExtensionsServer.Do(req) case "GalleryImagesClient": initServer(s, &s.trGalleryImagesServer, func() *GalleryImagesServerTransport { return NewGalleryImagesServerTransport(&s.srv.GalleryImagesServer) @@ -103,14 +144,39 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewNetworkInterfacesServerTransport(&s.srv.NetworkInterfacesServer) }) resp, err = s.trNetworkInterfacesServer.Do(req) + case "OffersClient": + initServer(s, &s.trOffersServer, func() *OffersServerTransport { return NewOffersServerTransport(&s.srv.OffersServer) }) + resp, err = s.trOffersServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "PublishersClient": + initServer(s, &s.trPublishersServer, func() *PublishersServerTransport { return NewPublishersServerTransport(&s.srv.PublishersServer) }) + resp, err = s.trPublishersServer.Do(req) + case "SKUsClient": + initServer(s, &s.trSKUsServer, func() *SKUsServerTransport { return NewSKUsServerTransport(&s.srv.SKUsServer) }) + resp, err = s.trSKUsServer.Do(req) + case "SecuritySettingsClient": + initServer(s, &s.trSecuritySettingsServer, func() *SecuritySettingsServerTransport { + return NewSecuritySettingsServerTransport(&s.srv.SecuritySettingsServer) + }) + resp, err = s.trSecuritySettingsServer.Do(req) case "StorageContainersClient": initServer(s, &s.trStorageContainersServer, func() *StorageContainersServerTransport { return NewStorageContainersServerTransport(&s.srv.StorageContainersServer) }) resp, err = s.trStorageContainersServer.Do(req) + case "UpdateRunsClient": + initServer(s, &s.trUpdateRunsServer, func() *UpdateRunsServerTransport { return NewUpdateRunsServerTransport(&s.srv.UpdateRunsServer) }) + resp, err = s.trUpdateRunsServer.Do(req) + case "UpdateSummariesClient": + initServer(s, &s.trUpdateSummariesServer, func() *UpdateSummariesServerTransport { + return NewUpdateSummariesServerTransport(&s.srv.UpdateSummariesServer) + }) + resp, err = s.trUpdateSummariesServer.Do(req) + case "UpdatesClient": + initServer(s, &s.trUpdatesServer, func() *UpdatesServerTransport { return NewUpdatesServerTransport(&s.srv.UpdatesServer) }) + resp, err = s.trUpdatesServer.Do(req) case "VirtualHardDisksClient": initServer(s, &s.trVirtualHardDisksServer, func() *VirtualHardDisksServerTransport { return NewVirtualHardDisksServerTransport(&s.srv.VirtualHardDisksServer) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/skus_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/skus_server.go new file mode 100644 index 000000000000..439195c9ad56 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/skus_server.go @@ -0,0 +1,196 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// SKUsServer is a fake server for instances of the armazurestackhci.SKUsClient type. +type SKUsServer struct { + // Get is the fake for method SKUsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *armazurestackhci.SKUsClientGetOptions) (resp azfake.Responder[armazurestackhci.SKUsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByOfferPager is the fake for method SKUsClient.NewListByOfferPager + // HTTP status codes to indicate success: http.StatusOK + NewListByOfferPager func(resourceGroupName string, clusterName string, publisherName string, offerName string, options *armazurestackhci.SKUsClientListByOfferOptions) (resp azfake.PagerResponder[armazurestackhci.SKUsClientListByOfferResponse]) +} + +// NewSKUsServerTransport creates a new instance of SKUsServerTransport with the provided implementation. +// The returned SKUsServerTransport instance is connected to an instance of armazurestackhci.SKUsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSKUsServerTransport(srv *SKUsServer) *SKUsServerTransport { + return &SKUsServerTransport{ + srv: srv, + newListByOfferPager: newTracker[azfake.PagerResponder[armazurestackhci.SKUsClientListByOfferResponse]](), + } +} + +// SKUsServerTransport connects instances of armazurestackhci.SKUsClient to instances of SKUsServer. +// Don't use this type directly, use NewSKUsServerTransport instead. +type SKUsServerTransport struct { + srv *SKUsServer + newListByOfferPager *tracker[azfake.PagerResponder[armazurestackhci.SKUsClientListByOfferResponse]] +} + +// Do implements the policy.Transporter interface for SKUsServerTransport. +func (s *SKUsServerTransport) 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 "SKUsClient.Get": + resp, err = s.dispatchGet(req) + case "SKUsClient.NewListByOfferPager": + resp, err = s.dispatchNewListByOfferPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SKUsServerTransport) 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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + offerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("offerName")]) + if err != nil { + return nil, err + } + skuNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("skuName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.SKUsClientGetOptions + if expandParam != nil { + options = &armazurestackhci.SKUsClientGetOptions{ + Expand: expandParam, + } + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, publisherNameParam, offerNameParam, skuNameParam, 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).SKU, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SKUsServerTransport) dispatchNewListByOfferPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByOfferPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByOfferPager not implemented")} + } + newListByOfferPager := s.newListByOfferPager.get(req) + if newListByOfferPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` + 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) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + offerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("offerName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.SKUsClientListByOfferOptions + if expandParam != nil { + options = &armazurestackhci.SKUsClientListByOfferOptions{ + Expand: expandParam, + } + } + resp := s.srv.NewListByOfferPager(resourceGroupNameParam, clusterNameParam, publisherNameParam, offerNameParam, options) + newListByOfferPager = &resp + s.newListByOfferPager.add(req, newListByOfferPager) + server.PagerResponderInjectNextLinks(newListByOfferPager, req, func(page *armazurestackhci.SKUsClientListByOfferResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByOfferPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByOfferPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByOfferPager) { + s.newListByOfferPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/azurestackhci/armazurestackhci/fake/updateruns_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updateruns_server.go new file mode 100644 index 000000000000..aefbac7aa565 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updateruns_server.go @@ -0,0 +1,275 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// UpdateRunsServer is a fake server for instances of the armazurestackhci.UpdateRunsClient type. +type UpdateRunsServer struct { + // BeginDelete is the fake for method UpdateRunsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *armazurestackhci.UpdateRunsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.UpdateRunsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpdateRunsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *armazurestackhci.UpdateRunsClientGetOptions) (resp azfake.Responder[armazurestackhci.UpdateRunsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method UpdateRunsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdateRunsClientListOptions) (resp azfake.PagerResponder[armazurestackhci.UpdateRunsClientListResponse]) + + // Put is the fake for method UpdateRunsClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, updateRunsProperties armazurestackhci.UpdateRun, options *armazurestackhci.UpdateRunsClientPutOptions) (resp azfake.Responder[armazurestackhci.UpdateRunsClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewUpdateRunsServerTransport creates a new instance of UpdateRunsServerTransport with the provided implementation. +// The returned UpdateRunsServerTransport instance is connected to an instance of armazurestackhci.UpdateRunsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpdateRunsServerTransport(srv *UpdateRunsServer) *UpdateRunsServerTransport { + return &UpdateRunsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.UpdateRunsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.UpdateRunsClientListResponse]](), + } +} + +// UpdateRunsServerTransport connects instances of armazurestackhci.UpdateRunsClient to instances of UpdateRunsServer. +// Don't use this type directly, use NewUpdateRunsServerTransport instead. +type UpdateRunsServerTransport struct { + srv *UpdateRunsServer + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.UpdateRunsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.UpdateRunsClientListResponse]] +} + +// Do implements the policy.Transporter interface for UpdateRunsServerTransport. +func (u *UpdateRunsServerTransport) 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 "UpdateRunsClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpdateRunsClient.Get": + resp, err = u.dispatchGet(req) + case "UpdateRunsClient.NewListPager": + resp, err = u.dispatchNewListPager(req) + case "UpdateRunsClient.Put": + resp, err = u.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + updateRunNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateRunName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, updateRunNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.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) { + u.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) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + updateRunNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateRunName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, updateRunNameParam, 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).UpdateRun, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := u.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + resp := u.srv.NewListPager(resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + newListPager = &resp + u.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.UpdateRunsClientListResponse, 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) { + u.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + u.newListPager.remove(req) + } + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if u.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns/(?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[armazurestackhci.UpdateRun](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + updateRunNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateRunName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Put(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, updateRunNameParam, 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).UpdateRun, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updates_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updates_server.go new file mode 100644 index 000000000000..6de709374f6a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updates_server.go @@ -0,0 +1,315 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// UpdatesServer is a fake server for instances of the armazurestackhci.UpdatesClient type. +type UpdatesServer struct { + // BeginDelete is the fake for method UpdatesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdatesClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.UpdatesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpdatesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdatesClientGetOptions) (resp azfake.Responder[armazurestackhci.UpdatesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method UpdatesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, clusterName string, options *armazurestackhci.UpdatesClientListOptions) (resp azfake.PagerResponder[armazurestackhci.UpdatesClientListResponse]) + + // BeginPost is the fake for method UpdatesClient.BeginPost + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginPost func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdatesClientBeginPostOptions) (resp azfake.PollerResponder[armazurestackhci.UpdatesClientPostResponse], errResp azfake.ErrorResponder) + + // Put is the fake for method UpdatesClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateProperties armazurestackhci.Update, options *armazurestackhci.UpdatesClientPutOptions) (resp azfake.Responder[armazurestackhci.UpdatesClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewUpdatesServerTransport creates a new instance of UpdatesServerTransport with the provided implementation. +// The returned UpdatesServerTransport instance is connected to an instance of armazurestackhci.UpdatesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpdatesServerTransport(srv *UpdatesServer) *UpdatesServerTransport { + return &UpdatesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.UpdatesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.UpdatesClientListResponse]](), + beginPost: newTracker[azfake.PollerResponder[armazurestackhci.UpdatesClientPostResponse]](), + } +} + +// UpdatesServerTransport connects instances of armazurestackhci.UpdatesClient to instances of UpdatesServer. +// Don't use this type directly, use NewUpdatesServerTransport instead. +type UpdatesServerTransport struct { + srv *UpdatesServer + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.UpdatesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.UpdatesClientListResponse]] + beginPost *tracker[azfake.PollerResponder[armazurestackhci.UpdatesClientPostResponse]] +} + +// Do implements the policy.Transporter interface for UpdatesServerTransport. +func (u *UpdatesServerTransport) 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 "UpdatesClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpdatesClient.Get": + resp, err = u.dispatchGet(req) + case "UpdatesClient.NewListPager": + resp, err = u.dispatchNewListPager(req) + case "UpdatesClient.BeginPost": + resp, err = u.dispatchBeginPost(req) + case "UpdatesClient.Put": + resp, err = u.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.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) { + u.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) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, 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).Update, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := u.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := u.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) + newListPager = &resp + u.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.UpdatesClientListResponse, 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) { + u.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + u.newListPager.remove(req) + } + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchBeginPost(req *http.Request) (*http.Response, error) { + if u.srv.BeginPost == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginPost not implemented")} + } + beginPost := u.beginPost.get(req) + if beginPost == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apply` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginPost(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginPost = &respr + u.beginPost.add(req, beginPost) + } + + resp, err := server.PollerResponderNext(beginPost, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + u.beginPost.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginPost) { + u.beginPost.remove(req) + } + + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if u.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?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[armazurestackhci.Update](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Put(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, 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).Update, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updatesummaries_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updatesummaries_server.go new file mode 100644 index 000000000000..e10d39052b85 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updatesummaries_server.go @@ -0,0 +1,247 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/azurestackhci/armazurestackhci/v2" + "net/http" + "net/url" + "regexp" +) + +// UpdateSummariesServer is a fake server for instances of the armazurestackhci.UpdateSummariesClient type. +type UpdateSummariesServer struct { + // BeginDelete is the fake for method UpdateSummariesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.UpdateSummariesClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.UpdateSummariesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpdateSummariesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.UpdateSummariesClientGetOptions) (resp azfake.Responder[armazurestackhci.UpdateSummariesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method UpdateSummariesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, clusterName string, options *armazurestackhci.UpdateSummariesClientListOptions) (resp azfake.PagerResponder[armazurestackhci.UpdateSummariesClientListResponse]) + + // Put is the fake for method UpdateSummariesClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, clusterName string, updateLocationProperties armazurestackhci.UpdateSummaries, options *armazurestackhci.UpdateSummariesClientPutOptions) (resp azfake.Responder[armazurestackhci.UpdateSummariesClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewUpdateSummariesServerTransport creates a new instance of UpdateSummariesServerTransport with the provided implementation. +// The returned UpdateSummariesServerTransport instance is connected to an instance of armazurestackhci.UpdateSummariesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpdateSummariesServerTransport(srv *UpdateSummariesServer) *UpdateSummariesServerTransport { + return &UpdateSummariesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.UpdateSummariesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.UpdateSummariesClientListResponse]](), + } +} + +// UpdateSummariesServerTransport connects instances of armazurestackhci.UpdateSummariesClient to instances of UpdateSummariesServer. +// Don't use this type directly, use NewUpdateSummariesServerTransport instead. +type UpdateSummariesServerTransport struct { + srv *UpdateSummariesServer + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.UpdateSummariesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.UpdateSummariesClientListResponse]] +} + +// Do implements the policy.Transporter interface for UpdateSummariesServerTransport. +func (u *UpdateSummariesServerTransport) 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 "UpdateSummariesClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpdateSummariesClient.Get": + resp, err = u.dispatchGet(req) + case "UpdateSummariesClient.NewListPager": + resp, err = u.dispatchNewListPager(req) + case "UpdateSummariesClient.Put": + resp, err = u.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries/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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.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) { + u.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) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.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\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries/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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, 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).UpdateSummaries, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := u.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries` + 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 + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := u.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) + newListPager = &resp + u.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.UpdateSummariesClientListResponse, 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) { + u.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + u.newListPager.remove(req) + } + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if u.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries/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[armazurestackhci.UpdateSummaries](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Put(req.Context(), resourceGroupNameParam, clusterNameParam, 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).UpdateSummaries, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go index 8aca5ca6bffb..2cff6494ce97 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go @@ -47,7 +47,7 @@ func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCreden // gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - galleryImageName - Name of the gallery image // - options - GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, reso // gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImages, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImages); err != nil { @@ -128,7 +128,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - The operation to delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - galleryImageName - Name of the gallery image // - options - GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete @@ -154,7 +154,7 @@ func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - The operation to delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets a gallery image // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - galleryImageName - Name of the gallery image // - options - GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method. @@ -251,7 +251,7 @@ func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (Galle // NewListPager - Lists all of the gallery images in the specified resource group. Use the nextLink property in the response // to get the next page of gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - GalleryImagesClientListOptions contains the optional parameters for the GalleryImagesClient.NewListPager method. func (client *GalleryImagesClient) NewListPager(resourceGroupName string, options *GalleryImagesClientListOptions) *runtime.Pager[GalleryImagesClientListResponse] { @@ -311,7 +311,7 @@ func (client *GalleryImagesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +329,7 @@ func (client *GalleryImagesClient) listHandleResponse(resp *http.Response) (Gall // NewListAllPager - Lists all of the gallery images in the specified subscription. Use the nextLink property in the response // to get the next page of gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - GalleryImagesClientListAllOptions contains the optional parameters for the GalleryImagesClient.NewListAllPager // method. func (client *GalleryImagesClient) NewListAllPager(options *GalleryImagesClientListAllOptions) *runtime.Pager[GalleryImagesClientListAllResponse] { @@ -367,7 +367,7 @@ func (client *GalleryImagesClient) listAllCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,7 @@ func (client *GalleryImagesClient) listAllHandleResponse(resp *http.Response) (G // BeginUpdate - The operation to update a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - galleryImageName - Name of the gallery image // - options - GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate @@ -411,7 +411,7 @@ func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGrou // Update - The operation to update a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImagesUpdateRequest, options *GalleryImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginUpdate" @@ -453,7 +453,7 @@ func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImages); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go deleted file mode 100644 index 0224161e28e0..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go +++ /dev/null @@ -1,368 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetGalleryImage.json -func ExampleGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "test-rg", "test-gallery-image", 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.GalleryImages = armazurestackhci.GalleryImages{ - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutGalleryImage.json -func ExampleGalleryImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-gallery-image", armazurestackhci.GalleryImages{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.GalleryImageProperties{ - ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - ImagePath: to.Ptr("C:\\test.vhdx"), - OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - }, - }, 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.GalleryImages = armazurestackhci.GalleryImages{ - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteGalleryImage.json -func ExampleGalleryImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginDelete(ctx, "test-rg", "test-gallery-image", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateGalleryImage.json -func ExampleGalleryImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginUpdate(ctx, "test-rg", "test-gallery-image", armazurestackhci.GalleryImagesUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, 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.GalleryImages = armazurestackhci.GalleryImages{ - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-galimg3325"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListGalleryImageByResourceGroup.json -func ExampleGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListPager("test-rg", 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.GalleryImagesListResult = armazurestackhci.GalleryImagesListResult{ - // Value: []*armazurestackhci.GalleryImages{ - // { - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListGalleryImageBySubscription.json -func ExampleGalleryImagesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListAllPager(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.GalleryImagesListResult = armazurestackhci.GalleryImagesListResult{ - // Value: []*armazurestackhci.GalleryImages{ - // { - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod index 57e976651f2f..e1f5af908c89 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armaz go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go index 82d624fa979f..57729f9f8298 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go @@ -41,7 +41,7 @@ func NewGuestAgentClient(credential azcore.TokenCredential, options *arm.ClientO // BeginCreate - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - GuestAgentClientBeginCreateOptions contains the optional parameters for the GuestAgentClient.BeginCreate method. func (client *GuestAgentClient) BeginCreate(ctx context.Context, resourceURI string, options *GuestAgentClientBeginCreateOptions) (*runtime.Poller[GuestAgentClientCreateResponse], error) { @@ -65,7 +65,7 @@ func (client *GuestAgentClient) BeginCreate(ctx context.Context, resourceURI str // Create - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GuestAgentClient) create(ctx context.Context, resourceURI string, options *GuestAgentClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "GuestAgentClient.BeginCreate" @@ -96,7 +96,7 @@ func (client *GuestAgentClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -111,7 +111,7 @@ func (client *GuestAgentClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - GuestAgentClientBeginDeleteOptions contains the optional parameters for the GuestAgentClient.BeginDelete method. func (client *GuestAgentClient) BeginDelete(ctx context.Context, resourceURI string, options *GuestAgentClientBeginDeleteOptions) (*runtime.Poller[GuestAgentClientDeleteResponse], error) { @@ -134,7 +134,7 @@ func (client *GuestAgentClient) BeginDelete(ctx context.Context, resourceURI str // Delete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GuestAgentClient) deleteOperation(ctx context.Context, resourceURI string, options *GuestAgentClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GuestAgentClient.BeginDelete" @@ -165,7 +165,7 @@ func (client *GuestAgentClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,7 +174,7 @@ func (client *GuestAgentClient) deleteCreateRequest(ctx context.Context, resourc // Get - Implements GuestAgent GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - GuestAgentClientGetOptions contains the optional parameters for the GuestAgentClient.Get method. func (client *GuestAgentClient) Get(ctx context.Context, resourceURI string, options *GuestAgentClientGetOptions) (GuestAgentClientGetResponse, error) { @@ -208,7 +208,7 @@ func (client *GuestAgentClient) getCreateRequest(ctx context.Context, resourceUR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go deleted file mode 100644 index 5c261d768d3b..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go +++ /dev/null @@ -1,113 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/CreateGuestAgent.json -func ExampleGuestAgentClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentClient().BeginCreate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", &armazurestackhci.GuestAgentClientBeginCreateOptions{Body: &armazurestackhci.GuestAgent{ - Properties: &armazurestackhci.GuestAgentProperties{ - Credentials: &armazurestackhci.GuestCredential{ - Password: to.Ptr(""), - Username: to.Ptr("tempuser"), - }, - ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - }, - }, - }) - 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 = armazurestackhci.GuestAgent{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), - // Properties: &armazurestackhci.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetGuestAgent.json -func ExampleGuestAgentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGuestAgentClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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 = armazurestackhci.GuestAgent{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), - // Properties: &armazurestackhci.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteGuestAgent.json -func ExampleGuestAgentClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentClient().BeginDelete(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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/azurestackhci/armazurestackhci/guestagents_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go index 25af25867f60..410e0cf2d275 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go @@ -40,7 +40,7 @@ func NewGuestAgentsClient(credential azcore.TokenCredential, options *arm.Client // NewListPager - Returns the list of GuestAgent of the given vm. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - GuestAgentsClientListOptions contains the optional parameters for the GuestAgentsClient.NewListPager method. func (client *GuestAgentsClient) NewListPager(resourceURI string, options *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse] { @@ -75,7 +75,7 @@ func (client *GuestAgentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go deleted file mode 100644 index b7b2541ee7de..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_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 armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GuestAgent_List.json -func ExampleGuestAgentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGuestAgentsClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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.GuestAgentList = armazurestackhci.GuestAgentList{ - // Value: []*armazurestackhci.GuestAgent{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), - // Properties: &armazurestackhci.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go index 3d1d9ce6a365..d9939c21ee24 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go @@ -41,7 +41,7 @@ func NewHybridIdentityMetadataClient(credential azcore.TokenCredential, options // Get - Implements HybridIdentityMetadata GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get // method. @@ -76,7 +76,7 @@ func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -93,7 +93,7 @@ func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Respons // NewListPager - Returns the list of HybridIdentityMetadata of the given vm. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - HybridIdentityMetadataClientListOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListPager // method. @@ -129,7 +129,7 @@ func (client *HybridIdentityMetadataClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go deleted file mode 100644 index 40bf9c56d21a..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHybridIdentityMetadataClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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.HybridIdentityMetadata = armazurestackhci.HybridIdentityMetadata{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // Properties: &armazurestackhci.HybridIdentityMetadataProperties{ - // Identity: &armazurestackhci.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/HybridIdentityMetadata_List.json -func ExampleHybridIdentityMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHybridIdentityMetadataClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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.HybridIdentityMetadataList = armazurestackhci.HybridIdentityMetadataList{ - // Value: []*armazurestackhci.HybridIdentityMetadata{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // Properties: &armazurestackhci.HybridIdentityMetadataProperties{ - // Identity: &armazurestackhci.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go index f3c9189b72eb..7b145fd98740 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go @@ -47,7 +47,7 @@ func NewLogicalNetworksClient(subscriptionID string, credential azcore.TokenCred // during logical network creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *LogicalNetworksClient) BeginCreateOrUpdate(ctx context.Context, re // logical network creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *LogicalNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworks, options *LogicalNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "LogicalNetworksClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *LogicalNetworksClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, logicalNetworks); err != nil { @@ -128,7 +128,7 @@ func (client *LogicalNetworksClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - The operation to delete a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientBeginDeleteOptions contains the optional parameters for the LogicalNetworksClient.BeginDelete @@ -154,7 +154,7 @@ func (client *LogicalNetworksClient) BeginDelete(ctx context.Context, resourceGr // Delete - The operation to delete a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *LogicalNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "LogicalNetworksClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *LogicalNetworksClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *LogicalNetworksClient) deleteCreateRequest(ctx context.Context, re // Get - // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientGetOptions contains the optional parameters for the LogicalNetworksClient.Get method. @@ -251,7 +251,7 @@ func (client *LogicalNetworksClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *LogicalNetworksClient) getHandleResponse(resp *http.Response) (Log // NewListPager - Lists all of the logical networks in the specified resource group. Use the nextLink property in the response // to get the next page of logical networks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - LogicalNetworksClientListOptions contains the optional parameters for the LogicalNetworksClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *LogicalNetworksClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *LogicalNetworksClient) listHandleResponse(resp *http.Response) (Lo // NewListAllPager - Lists all of the logical networks in the specified subscription. Use the nextLink property in the response // to get the next page of logical networks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - LogicalNetworksClientListAllOptions contains the optional parameters for the LogicalNetworksClient.NewListAllPager // method. func (client *LogicalNetworksClient) NewListAllPager(options *LogicalNetworksClientListAllOptions) *runtime.Pager[LogicalNetworksClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *LogicalNetworksClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *LogicalNetworksClient) listAllHandleResponse(resp *http.Response) // BeginUpdate - The operation to update a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientBeginUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginUpdate @@ -412,7 +412,7 @@ func (client *LogicalNetworksClient) BeginUpdate(ctx context.Context, resourceGr // Update - The operation to update a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *LogicalNetworksClient) update(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworksUpdateRequest, options *LogicalNetworksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "LogicalNetworksClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *LogicalNetworksClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, logicalNetworks); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go deleted file mode 100644 index 620fed06d072..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go +++ /dev/null @@ -1,242 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetLogicalNetwork.json -func ExampleLogicalNetworksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogicalNetworksClient().Get(ctx, "test-rg", "test-lnet", 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.LogicalNetworks = armazurestackhci.LogicalNetworks{ - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutLogicalNetwork.json -func ExampleLogicalNetworksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogicalNetworksClient().BeginCreateOrUpdate(ctx, "test-rg", "test-lnet", armazurestackhci.LogicalNetworks{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - }, 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.LogicalNetworks = armazurestackhci.LogicalNetworks{ - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteLogicalNetwork.json -func ExampleLogicalNetworksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogicalNetworksClient().BeginDelete(ctx, "test-rg", "test-lnet", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateLogicalNetwork.json -func ExampleLogicalNetworksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogicalNetworksClient().BeginUpdate(ctx, "test-rg", "test-lnet", armazurestackhci.LogicalNetworksUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, 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.LogicalNetworks = armazurestackhci.LogicalNetworks{ - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListLogicalNetworkByResourceGroup.json -func ExampleLogicalNetworksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogicalNetworksClient().NewListPager("test-rg", 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.LogicalNetworksListResult = armazurestackhci.LogicalNetworksListResult{ - // Value: []*armazurestackhci.LogicalNetworks{ - // { - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListLogicalNetworkBySubscription.json -func ExampleLogicalNetworksClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogicalNetworksClient().NewListAllPager(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.LogicalNetworksListResult = armazurestackhci.LogicalNetworksListResult{ - // Value: []*armazurestackhci.LogicalNetworks{ - // { - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go index e46b1f8584d2..353dc0644096 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go @@ -47,7 +47,7 @@ func NewMarketplaceGalleryImagesClient(subscriptionID string, credential azcore. // set only during marketplace gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - marketplaceGalleryImageName - Name of the marketplace gallery image // - options - MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *MarketplaceGalleryImagesClient) BeginCreateOrUpdate(ctx context.Co // only during marketplace gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *MarketplaceGalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImages, options *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "MarketplaceGalleryImagesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *MarketplaceGalleryImagesClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, marketplaceGalleryImages); err != nil { @@ -128,7 +128,7 @@ func (client *MarketplaceGalleryImagesClient) createOrUpdateCreateRequest(ctx co // BeginDelete - The operation to delete a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - marketplaceGalleryImageName - Name of the marketplace gallery image // - options - MarketplaceGalleryImagesClientBeginDeleteOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginDelete @@ -154,7 +154,7 @@ func (client *MarketplaceGalleryImagesClient) BeginDelete(ctx context.Context, r // Delete - The operation to delete a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *MarketplaceGalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "MarketplaceGalleryImagesClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *MarketplaceGalleryImagesClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *MarketplaceGalleryImagesClient) deleteCreateRequest(ctx context.Co // Get - Gets a marketplace gallery image // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - marketplaceGalleryImageName - Name of the marketplace gallery image // - options - MarketplaceGalleryImagesClientGetOptions contains the optional parameters for the MarketplaceGalleryImagesClient.Get @@ -252,7 +252,7 @@ func (client *MarketplaceGalleryImagesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +270,7 @@ func (client *MarketplaceGalleryImagesClient) getHandleResponse(resp *http.Respo // NewListPager - Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in // the response to get the next page of marketplace gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MarketplaceGalleryImagesClientListOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListPager // method. @@ -313,7 +313,7 @@ func (client *MarketplaceGalleryImagesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +331,7 @@ func (client *MarketplaceGalleryImagesClient) listHandleResponse(resp *http.Resp // NewListAllPager - Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property // in the response to get the next page of marketplace gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - MarketplaceGalleryImagesClientListAllOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListAllPager // method. func (client *MarketplaceGalleryImagesClient) NewListAllPager(options *MarketplaceGalleryImagesClientListAllOptions) *runtime.Pager[MarketplaceGalleryImagesClientListAllResponse] { @@ -369,7 +369,7 @@ func (client *MarketplaceGalleryImagesClient) listAllCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,7 +387,7 @@ func (client *MarketplaceGalleryImagesClient) listAllHandleResponse(resp *http.R // BeginUpdate - The operation to update a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - marketplaceGalleryImageName - Name of the marketplace gallery image // - options - MarketplaceGalleryImagesClientBeginUpdateOptions contains the optional parameters for the MarketplaceGalleryImagesClient.BeginUpdate @@ -413,7 +413,7 @@ func (client *MarketplaceGalleryImagesClient) BeginUpdate(ctx context.Context, r // Update - The operation to update a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *MarketplaceGalleryImagesClient) update(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImagesUpdateRequest, options *MarketplaceGalleryImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "MarketplaceGalleryImagesClient.BeginUpdate" @@ -455,7 +455,7 @@ func (client *MarketplaceGalleryImagesClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, marketplaceGalleryImages); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go deleted file mode 100644 index 0c7011e1fa15..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go +++ /dev/null @@ -1,401 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMarketplaceGalleryImagesClient().Get(ctx, "test-rg", "test-marketplace-gallery-image", 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.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-marketplace-gallery-image", armazurestackhci.MarketplaceGalleryImages{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - Identifier: &armazurestackhci.GalleryImageIdentifier{ - Offer: to.Ptr("myOfferName"), - Publisher: to.Ptr("myPublisherName"), - SKU: to.Ptr("mySkuName"), - }, - OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - Version: &armazurestackhci.GalleryImageVersion{ - Name: to.Ptr("1.0.0"), - }, - }, - }, 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.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](0), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusInProgress), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginDelete(ctx, "test-rg", "test-marketplace-gallery-image", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginUpdate(ctx, "test-rg", "test-marketplce-gallery-image", armazurestackhci.MarketplaceGalleryImagesUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, 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.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](0), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusInProgress), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListMarketplaceGalleryImageByResourceGroup.json -func ExampleMarketplaceGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplaceGalleryImagesClient().NewListPager("test-rg", 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.MarketplaceGalleryImagesListResult = armazurestackhci.MarketplaceGalleryImagesListResult{ - // Value: []*armazurestackhci.MarketplaceGalleryImages{ - // { - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListMarketplaceGalleryImageBySubscription.json -func ExampleMarketplaceGalleryImagesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplaceGalleryImagesClient().NewListAllPager(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.MarketplaceGalleryImagesListResult = armazurestackhci.MarketplaceGalleryImagesListResult{ - // Value: []*armazurestackhci.MarketplaceGalleryImages{ - // { - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go index 054c38749a89..7eeff3d302ca 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go @@ -10,6 +10,578 @@ package armazurestackhci import "time" +// AdapterPropertyOverrides - The AdapterPropertyOverrides of a cluster. +type AdapterPropertyOverrides struct { + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + JumboPacket *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + NetworkDirect *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + // Expected values are 'iWARP', 'RoCEv2', 'RoCE' + NetworkDirectTechnology *string +} + +// ArcIdentityResponse - ArcIdentity details. +type ArcIdentityResponse struct { + // READ-ONLY; ArcIdentity properties. + Properties *ArcIdentityResponseProperties +} + +type ArcIdentityResponseProperties struct { + ArcApplicationClientID *string + ArcApplicationObjectID *string + ArcApplicationTenantID *string + ArcServicePrincipalObjectID *string +} + +// ArcSetting details. +type ArcSetting struct { + // ArcSetting properties. + Properties *ArcSettingProperties + + // 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 +} + +// ArcSettingList - List of ArcSetting proxy resources for the HCI cluster. +type ArcSettingList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of ArcSetting proxy resources. + Value []*ArcSetting +} + +// ArcSettingProperties - ArcSetting properties. +type ArcSettingProperties struct { + // App id of arc AAD identity. + ArcApplicationClientID *string + + // Object id of arc AAD identity. + ArcApplicationObjectID *string + + // Tenant id of arc AAD identity. + ArcApplicationTenantID *string + + // The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. + ArcInstanceResourceGroup *string + + // Object id of arc AAD service principal. + ArcServicePrincipalObjectID *string + + // contains connectivity related configuration for ARC resources + ConnectivityProperties any + + // READ-ONLY; Aggregate state of Arc agent across the nodes in this HCI cluster. + AggregateState *ArcSettingAggregateState + + // READ-ONLY; Properties for each of the default extensions category + DefaultExtensions []*DefaultExtensionDetails + + // READ-ONLY; State of Arc agent in each of the nodes. + PerNodeDetails []*PerNodeState + + // READ-ONLY; Provisioning state of the ArcSetting proxy resource. + ProvisioningState *ProvisioningState +} + +// ArcSettingsPatch - ArcSetting details to update. +type ArcSettingsPatch struct { + // ArcSettings properties. + Properties *ArcSettingsPatchProperties + + // Resource tags. + Tags map[string]*string +} + +// ArcSettingsPatchProperties - ArcSettings properties. +type ArcSettingsPatchProperties struct { + // contains connectivity related configuration for ARC resources + ConnectivityProperties any +} + +// Cluster details. +type Cluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Identity of Cluster resource + Identity *ManagedServiceIdentity + + // Cluster properties. + Properties *ClusterProperties + + // 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 +} + +// ClusterDesiredProperties - Desired properties of the cluster. +type ClusterDesiredProperties struct { + // Desired level of diagnostic data emitted by the cluster. + DiagnosticLevel *DiagnosticLevel + + // Desired state of Windows Server Subscription. + WindowsServerSubscription *WindowsServerSubscription +} + +// ClusterIdentityResponse - Cluster Identity details. +type ClusterIdentityResponse struct { + // READ-ONLY; Cluster identity properties. + Properties *ClusterIdentityResponseProperties +} + +type ClusterIdentityResponseProperties struct { + AADApplicationObjectID *string + AADClientID *string + AADServicePrincipalObjectID *string + AADTenantID *string +} + +// ClusterList - List of clusters. +type ClusterList struct { + // List of clusters. + Value []*Cluster + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// ClusterNode - Cluster node details. +type ClusterNode struct { + // READ-ONLY; Number of physical cores on the cluster node. + CoreCount *float32 + + // READ-ONLY; Edge Hardware Center Resource Id + EhcResourceID *string + + // READ-ONLY; Id of the node in the cluster. + ID *float32 + + // READ-ONLY; Most recent licensing timestamp. + LastLicensingTimestamp *time.Time + + // READ-ONLY; Manufacturer of the cluster node hardware. + Manufacturer *string + + // READ-ONLY; Total available memory on the cluster node (in GiB). + MemoryInGiB *float32 + + // READ-ONLY; Model name of the cluster node hardware. + Model *string + + // READ-ONLY; Name of the cluster node. + Name *string + + // READ-ONLY; Type of the cluster node hardware. + NodeType *ClusterNodeType + + // READ-ONLY; Display version of the operating system running on the cluster node. + OSDisplayVersion *string + + // READ-ONLY; Operating system running on the cluster node. + OSName *string + + // READ-ONLY; Version of the operating system running on the cluster node. + OSVersion *string + + // READ-ONLY; OEM activation status of the node. + OemActivation *OemActivation + + // READ-ONLY; Immutable id of the cluster node. + SerialNumber *string + + // READ-ONLY; State of Windows Server Subscription. + WindowsServerSubscription *WindowsServerSubscription +} + +// ClusterPatch - Cluster details to update. +type ClusterPatch struct { + // Identity of Cluster resource + Identity *ManagedServiceIdentity + + // Cluster properties. + Properties *ClusterPatchProperties + + // Resource tags. + Tags map[string]*string +} + +// ClusterPatchProperties - Cluster properties. +type ClusterPatchProperties struct { + // App id of cluster AAD identity. + AADClientID *string + + // Tenant id of cluster AAD identity. + AADTenantID *string + + // Endpoint configured for management from the Azure portal + CloudManagementEndpoint *string + + // Desired properties of the cluster. + DesiredProperties *ClusterDesiredProperties +} + +// ClusterProperties - Cluster properties. +type ClusterProperties struct { + // Object id of cluster AAD identity. + AADApplicationObjectID *string + + // App id of cluster AAD identity. + AADClientID *string + + // Id of cluster identity service principal. + AADServicePrincipalObjectID *string + + // Tenant id of cluster AAD identity. + AADTenantID *string + + // Endpoint configured for management from the Azure portal. + CloudManagementEndpoint *string + + // Desired properties of the cluster. + DesiredProperties *ClusterDesiredProperties + + // Software Assurance properties of the cluster. + SoftwareAssuranceProperties *SoftwareAssuranceProperties + + // READ-ONLY; Type of billing applied to the resource. + BillingModel *string + + // READ-ONLY; Unique, immutable resource id. + CloudID *string + + // READ-ONLY; Overall connectivity status for the cluster resource. + ConnectivityStatus *ConnectivityStatus + + // READ-ONLY; Attestation configurations for isolated VM (e.g. TVM, CVM) of the cluster. + IsolatedVMAttestationConfiguration *IsolatedVMAttestationConfiguration + + // READ-ONLY; Most recent billing meter timestamp. + LastBillingTimestamp *time.Time + + // READ-ONLY; Most recent cluster sync timestamp. + LastSyncTimestamp *time.Time + + // READ-ONLY; Provisioning state. + ProvisioningState *ProvisioningState + + // READ-ONLY; First cluster sync timestamp. + RegistrationTimestamp *time.Time + + // READ-ONLY; Properties reported by cluster agent. + ReportedProperties *ClusterReportedProperties + + // READ-ONLY; Object id of RP Service Principal + ResourceProviderObjectID *string + + // READ-ONLY; Region specific DataPath Endpoint of the cluster. + ServiceEndpoint *string + + // READ-ONLY; Status of the cluster agent. + Status *Status + + // READ-ONLY; Number of days remaining in the trial period. + TrialDaysRemaining *float32 +} + +// ClusterReportedProperties - Properties reported by cluster agent. +type ClusterReportedProperties struct { + // Level of diagnostic data emitted by the cluster. + DiagnosticLevel *DiagnosticLevel + + // READ-ONLY; Unique id generated by the on-prem cluster. + ClusterID *string + + // READ-ONLY; Name of the on-prem cluster connected to this resource. + ClusterName *string + + // READ-ONLY; The node type of all the nodes of the cluster. + ClusterType *ClusterNodeType + + // READ-ONLY; Version of the cluster software. + ClusterVersion *string + + // READ-ONLY; IMDS attestation status of the cluster. + ImdsAttestation *ImdsAttestation + + // READ-ONLY; Last time the cluster reported the data. + LastUpdated *time.Time + + // READ-ONLY; The manufacturer of all the nodes of the cluster. + Manufacturer *string + + // READ-ONLY; List of nodes reported by the cluster. + Nodes []*ClusterNode + + // READ-ONLY; OEM activation status of the cluster. + OemActivation *OemActivation + + // READ-ONLY; Capabilities supported by the cluster. + SupportedCapabilities []*string +} + +// DefaultExtensionDetails - Properties for a particular default extension category. +type DefaultExtensionDetails struct { + // READ-ONLY; Default extension category + Category *string + + // READ-ONLY; Consent time for extension category + ConsentTime *time.Time +} + +// DeploymentCluster - AzureStackHCI Cluster deployment properties. +type DeploymentCluster struct { + // For Azure blob service endpoint type, select either Default or Custom domain. If you selected **Custom domain, enter the + // domain for the blob service in this format core.windows.net. + AzureServiceEndpoint *string + + // Specify the Azure Storage account name for cloud witness for your Azure Stack HCI cluster. + CloudAccountName *string + + // The cluster name provided when preparing Active Directory. + Name *string + + // Specify the fileshare path for the local witness for your Azure Stack HCI cluster. + WitnessPath *string + + // Use a cloud witness if you have internet access and if you use an Azure Storage account to provide a vote on cluster quorum. + // A cloud witness uses Azure Blob Storage to read or write a blob file and + // then uses it to arbitrate in split-brain resolution. Only allowed values are 'Cloud', 'FileShare'. + WitnessType *string +} + +// DeploymentConfiguration - Deployment Configuration +type DeploymentConfiguration struct { + // REQUIRED; Scale units will contains list of deployment data + ScaleUnits []*ScaleUnits + + // deployment template version + Version *string +} + +// DeploymentData - The Deployment data of AzureStackHCI Cluster. +type DeploymentData struct { + // The path to the Active Directory Organizational Unit container object prepared for the deployment. + AdouPath *string + + // Observability config to deploy AzureStackHCI Cluster. + Cluster *DeploymentCluster + + // FQDN to deploy cluster + DomainFqdn *string + + // HostNetwork config to deploy AzureStackHCI Cluster. + HostNetwork *HostNetwork + + // InfrastructureNetwork config to deploy AzureStackHCI Cluster. + InfrastructureNetwork []*InfrastructureNetwork + + // naming prefix to deploy cluster. + NamingPrefix *string + + // Observability config to deploy AzureStackHCI Cluster. + Observability *Observability + + // OptionalServices config to deploy AzureStackHCI Cluster. + OptionalServices *OptionalServices + + // list of physical nodes config to deploy AzureStackHCI Cluster. + PhysicalNodes []*PhysicalNodes + + // The URI to the keyvault / secret store. + SecretsLocation *string + + // SecuritySettings to deploy AzureStackHCI Cluster. + SecuritySettings *DeploymentSecuritySettings + + // Storage config to deploy AzureStackHCI Cluster. + Storage *Storage +} + +// DeploymentSecuritySettings - The SecuritySettings of AzureStackHCI Cluster. +type DeploymentSecuritySettings struct { + // When set to true, BitLocker XTS_AES 256-bit encryption is enabled for all data-at-rest on the OS volume of your Azure Stack + // HCI cluster. This setting is TPM-hardware dependent. + BitlockerBootVolume *bool + + // When set to true, BitLocker XTS-AES 256-bit encryption is enabled for all data-at-rest on your Azure Stack HCI cluster + // shared volumes. + BitlockerDataVolumes *bool + + // When set to true, Credential Guard is enabled. + CredentialGuardEnforced *bool + + // When set to true, the security baseline is re-applied regularly. + DriftControlEnforced *bool + + // By default, Secure Boot is enabled on your Azure HCI cluster. This setting is hardware dependent. + DrtmProtection *bool + + // By default, Hypervisor-protected Code Integrity is enabled on your Azure HCI cluster. + HvciProtection *bool + + // When set to true, all the side channel mitigations are enabled + SideChannelMitigationEnforced *bool + + // When set to true, cluster east-west traffic is encrypted. + SmbClusterEncryption *bool + + // When set to true, the SMB default instance requires sign in for the client and server services. + SmbSigningEnforced *bool + + // WDAC is enabled by default and limits the applications and the code that you can run on your Azure Stack HCI cluster. + WdacEnforced *bool +} + +// DeploymentSetting - Edge device resource +type DeploymentSetting struct { + // The resource-specific properties for this resource. + Properties *DeploymentSettingsProperties + + // 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 +} + +// DeploymentSettingListResult - The response of a DeploymentSetting list operation. +type DeploymentSettingListResult struct { + // REQUIRED; The DeploymentSetting items on this page + Value []*DeploymentSetting + + // The link to the next page of items + NextLink *string +} + +// DeploymentSettingsProperties - DeploymentSetting properties +type DeploymentSettingsProperties struct { + // REQUIRED; Azure resource ids of Arc machines to be part of cluster. + ArcNodeResourceIDs []*string + + // REQUIRED; Scale units will contains list of deployment data + DeploymentConfiguration *DeploymentConfiguration + + // REQUIRED; The deployment mode for cluster deployment. + DeploymentMode *DeploymentMode + + // DeploymentSetting provisioning state + ProvisioningState *ProvisioningState + + // READ-ONLY; Deployment Status reported from cluster. + ReportedProperties *ReportedProperties +} + +// DeploymentStatus - The DeploymentStatus of AzureStackHCI Cluster. +type DeploymentStatus struct { + // READ-ONLY; Status of AzureStackHCI Cluster Deployment. + Status *string + + // READ-ONLY; List of steps of AzureStackHCI Cluster Deployment. + Steps []*DeploymentStep +} + +// DeploymentStep - The Step of AzureStackHCI Cluster. +type DeploymentStep struct { + // READ-ONLY; Description of step. + Description *string + + // READ-ONLY; End time of step. + EndTimeUTC *string + + // READ-ONLY; List of exceptions in AzureStackHCI Cluster Deployment. + Exception []*string + + // READ-ONLY; FullStepIndex of step. + FullStepIndex *string + + // READ-ONLY; Name of step. + Name *string + + // READ-ONLY; Start time of step. + StartTimeUTC *string + + // READ-ONLY; Status of step. Allowed values are 'Error', 'Success', 'InProgress' + Status *string + + // READ-ONLY; List of nested steps of AzureStackHCI Cluster Deployment. + Steps []*DeploymentStep +} + +// DeviceConfiguration - The device Configuration of a device. +type DeviceConfiguration struct { + // device metadata details. + DeviceMetadata *string + + // NIC Details of device + NicDetails []*NicDetail +} + +// EdgeDevice - Edge device resource +type EdgeDevice struct { + // The resource-specific properties for this resource. + Properties *EdgeDeviceProperties + + // 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 +} + +// EdgeDeviceListResult - The response of a EdgeDevice list operation. +type EdgeDeviceListResult struct { + // REQUIRED; The EdgeDevice items on this page + Value []*EdgeDevice + + // The link to the next page of items + NextLink *string +} + +// EdgeDeviceProperties - Edge Device properties +type EdgeDeviceProperties struct { + // Device Configuration + DeviceConfiguration *DeviceConfiguration + + // Provisioning state of edgeDevice resource + ProvisioningState *ProvisioningState +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -46,6 +618,146 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes } +// Extension - Details of a particular extension in HCI Cluster. +type Extension struct { + // Describes Machine Extension Properties. + Properties *ExtensionProperties + + // 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 +} + +// ExtensionInstanceView - Describes the Extension Instance View. +type ExtensionInstanceView struct { + // The extension name. + Name *string + + // Instance view status. + Status *ExtensionInstanceViewStatus + + // Specifies the type of the extension; an example is "MicrosoftMonitoringAgent". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// ExtensionInstanceViewStatus - Instance view status. +type ExtensionInstanceViewStatus struct { + // The status code. + Code *string + + // The short localizable label for the status. + DisplayStatus *string + + // The level code. + Level *StatusLevelTypes + + // The detailed status message, including for alerts and error messages. + Message *string + + // The time of the status. + Time *time.Time +} + +// ExtensionList - List of Extensions in HCI cluster. +type ExtensionList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of Extensions in HCI cluster. + Value []*Extension +} + +// ExtensionParameters - Describes the properties of a Machine Extension. This object mirrors the definition in HybridCompute. +type ExtensionParameters struct { + // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + // however, the extension will not upgrade minor versions unless redeployed, even + // with this property set to true. + AutoUpgradeMinorVersion *bool + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string + + // Protected settings (may contain secrets). + ProtectedSettings any + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. Latest version would be used if not specified. + TypeHandlerVersion *string +} + +// ExtensionPatch - Extension Details to update +type ExtensionPatch struct { + // Describes Machine Extension Properties that can be updated. + Properties *ExtensionPatchProperties +} + +// ExtensionPatchParameters - Describes the properties of a Machine Extension that can be updated. +type ExtensionPatchParameters struct { + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool + + // Protected settings (may contain secrets). + ProtectedSettings any + + // Json formatted public settings for the extension. + Settings any + + // Specifies the version of the script handler. Latest version would be used if not specified. + TypeHandlerVersion *string +} + +// ExtensionPatchProperties - Describes Machine Extension Properties that can be updated. +type ExtensionPatchProperties struct { + // Describes the properties of a Machine Extension that can be updated. + ExtensionParameters *ExtensionPatchParameters +} + +// ExtensionProperties - Status of Arc Extension for a particular node in HCI Cluster. +type ExtensionProperties struct { + // Parameters specific to this extension type. + ExtensionParameters *ExtensionParameters + + // READ-ONLY; Aggregate state of Arc Extensions across the nodes in this HCI cluster. + AggregateState *ExtensionAggregateState + + // READ-ONLY; Indicates if the extension is managed by azure or the user. + ManagedBy *ExtensionManagedBy + + // READ-ONLY; State of Arc Extension in each of the nodes. + PerNodeExtensionDetails []*PerNodeExtensionState + + // READ-ONLY; Provisioning state of the Extension proxy resource. + ProvisioningState *ProvisioningState +} + +// ExtensionUpgradeParameters - Describes the parameters for Extension upgrade. +type ExtensionUpgradeParameters struct { + // Extension Upgrade Target Version. + TargetVersion *string +} + // GalleryImageIdentifier - This is the gallery image definition identifier. type GalleryImageIdentifier struct { // REQUIRED; The name of the gallery image definition offer. @@ -280,6 +992,23 @@ type HardwareProfileUpdate struct { VMSize *VMSizeEnum } +// HostNetwork - The HostNetwork of a cluster. +type HostNetwork struct { + // Optional parameter required only for 3 Nodes Switchless deployments. This allows users to specify IPs and Mask for Storage + // NICs when Network ATC is not assigning the IPs for storage automatically. + EnableStorageAutoIP *bool + + // The network intents assigned to the network reference pattern used for the deployment. Each intent will define its own + // name, traffic type, adapter names, and overrides as recommended by your OEM. + Intents []*Intents + + // Defines how the storage adapters between nodes are connected either switch or switch less.. + StorageConnectivitySwitchless *bool + + // List of StorageNetworks config to deploy AzureStackHCI Cluster. + StorageNetworks []*StorageNetworks +} + // HybridIdentityMetadata - Defines the HybridIdentityMetadata. type HybridIdentityMetadata struct { // REQUIRED; Resource properties. @@ -375,6 +1104,17 @@ type IPPoolInfo struct { Used *string } +// IPPools - The dnsServers of a device. +type IPPools struct { + // Ending IP address for the management network. A minimum of six free, contiguous IPv4 addresses (excluding your host IPs) + // are needed for infrastructure services such as clustering. + EndingAddress *string + + // Starting IP address for the management network. A minimum of six free, contiguous IPv4 addresses (excluding your host IPs) + // are needed for infrastructure services such as clustering. + StartingAddress *string +} + // Identity for the resource. type Identity struct { // The identity type. @@ -387,6 +1127,25 @@ type Identity struct { TenantID *string } +// InfrastructureNetwork - The InfrastructureNetwork of a AzureStackHCI Cluster. +type InfrastructureNetwork struct { + // IPv4 address of the DNS servers in your environment. + DNSServers []*string + + // Default gateway that should be used for the provided IP address space. + Gateway *string + + // Range of IP addresses from which addresses are allocated for nodes within a subnet. + IPPools []*IPPools + + // Subnet mask that matches the provided IP address space. + SubnetMask *string + + // Allows customers to use DHCP for Hosts and Cluster IPs. If not declared, the deployment will default to static IPs. When + // true, GW and DNS servers are not required + UseDhcp *bool +} + // InstanceViewStatus - Instance view status. type InstanceViewStatus struct { // The status code. @@ -405,11 +1164,53 @@ type InstanceViewStatus struct { Time *time.Time } +// Intents - The Intents of a cluster. +type Intents struct { + // Array of network interfaces used for the network intent. + Adapter []*string + + // Set Adapter PropertyOverrides for cluster. + AdapterPropertyOverrides *AdapterPropertyOverrides + + // Name of the network intent you wish to create. + Name *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + OverrideAdapterProperty *bool + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + OverrideQosPolicy *bool + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + OverrideVirtualSwitchConfiguration *bool + + // Set QoS PolicyOverrides for cluster. + QosPolicyOverrides *QosPolicyOverrides + + // List of network traffic types. Only allowed values are 'Compute', 'Storage', 'Management'. + TrafficType []*string + + // Set virtualSwitch ConfigurationOverrides for cluster. + VirtualSwitchConfigurationOverrides *VirtualSwitchConfigurationOverrides +} + type InterfaceDNSSettings struct { // List of DNS server IP Addresses for the interface DNSServers []*string } +// IsolatedVMAttestationConfiguration - Attestation configurations for isolated VM (e.g. TVM, CVM) of the cluster. +type IsolatedVMAttestationConfiguration struct { + // READ-ONLY; Fully qualified Azure resource id of the Microsoft Azure attestation resource associated with this cluster. + AttestationResourceID *string + + // READ-ONLY; Region specific endpoint for Microsoft Azure Attestation service for the cluster + AttestationServiceEndpoint *string + + // READ-ONLY; Region specific endpoint for relying party service. + RelyingPartyServiceEndpoint *string +} + // LogicalNetworkProperties - Properties under the logical network resource type LogicalNetworkProperties struct { // DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for @@ -492,6 +1293,26 @@ type LogicalNetworksUpdateRequest struct { Tags map[string]*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 +} + // MarketplaceGalleryImageProperties - Properties under the marketplace gallery image resource type MarketplaceGalleryImageProperties struct { // REQUIRED; Operating system type that the gallery image uses [Windows, Linux] @@ -672,6 +1493,95 @@ type NetworkProfileUpdateNetworkInterfacesItem struct { ID *string } +// NicDetail - The NIC Detail of a device. +type NicDetail struct { + // REQUIRED; Adapter Name of NIC + AdapterName *string + + // Component Id of NIC + ComponentID *string + + // DNS Servers for NIC + DNSServers []*string + + // Default Gateway of NIC + DefaultGateway *string + + // Default Isolation of Management NIC + DefaultIsolationID *string + + // Driver Version of NIC + DriverVersion *string + + // Interface Description of NIC + InterfaceDescription *string + + // Subnet Mask of NIC + Ip4Address *string + + // Subnet Mask of NIC + SubnetMask *string +} + +// Observability - The Observability of AzureStackHCI Cluster. +type Observability struct { + // When set to true, collects log data to facilitate quicker issue resolution. + EpisodicDataUpload *bool + + // Location of your cluster. The log and diagnostic data is sent to the appropriate diagnostics servers depending upon where + // your cluster resides. Setting this to false results in all data sent to + // Microsoft to be stored outside of the EU. + EuLocation *bool + + // Enables telemetry data to be sent to Microsoft + StreamingDataClient *bool +} + +// Offer details. +type Offer struct { + // Offer properties. + Properties *OfferProperties + + // 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 +} + +// OfferList - List of Offer proxy resources for the HCI cluster. +type OfferList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of Offer proxy resources. + Value []*Offer +} + +// OfferProperties - Publisher properties. +type OfferProperties struct { + // JSON serialized catalog content of the offer + Content *string + + // The API version of the catalog service used to serve the catalog content + ContentVersion *string + + // Identifier of the Publisher for the offer + PublisherID *string + + // Array of SKU mappings + SKUMappings []*SKUMappings + + // READ-ONLY; Provisioning State + ProvisioningState *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. @@ -706,45 +1616,222 @@ type OperationDisplay struct { // 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 + // 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 +} + +// OptionalServices - The OptionalServices of AzureStackHCI Cluster. +type OptionalServices struct { + // The name of custom location. + CustomLocation *string +} + +// OsProfileUpdate - OsProfile - describes the update configuration of the operating system +type OsProfileUpdate struct { + // ComputerName - name of the computer + ComputerName *string + LinuxConfiguration *OsProfileUpdateLinuxConfiguration + WindowsConfiguration *OsProfileUpdateWindowsConfiguration +} + +type OsProfileUpdateLinuxConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool +} + +type OsProfileUpdateWindowsConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool +} + +// PackageVersionInfo - Current version of each updatable component. +type PackageVersionInfo struct { + // Last time this component was updated. + LastUpdated *time.Time + + // Package type + PackageType *string + + // Package version + Version *string +} + +type PasswordCredential struct { + EndDateTime *time.Time + KeyID *string + SecretText *string + StartDateTime *time.Time +} + +// PerNodeExtensionState - Status of Arc Extension for a particular node in HCI Cluster. +type PerNodeExtensionState struct { + // READ-ONLY; Fully qualified resource ID for the particular Arc Extension on this node. + Extension *string + + // READ-ONLY; The extension instance view. + InstanceView *ExtensionInstanceView + + // READ-ONLY; Name of the node in HCI Cluster. + Name *string + + // READ-ONLY; State of Arc Extension in this node. + State *NodeExtensionState + + // READ-ONLY; Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// PerNodeState - Status of Arc agent for a particular node in HCI Cluster. +type PerNodeState struct { + // READ-ONLY; Fully qualified resource ID for the Arc agent of this node. + ArcInstance *string + + // READ-ONLY; The service principal id of the arc for server node + ArcNodeServicePrincipalObjectID *string + + // READ-ONLY; Name of the Node in HCI Cluster + Name *string + + // READ-ONLY; State of Arc agent in this node. + State *NodeArcState +} + +// PhysicalNodes - The PhysicalNodes of a cluster. +type PhysicalNodes struct { + // The IPv4 address assigned to each physical server on your Azure Stack HCI cluster. + IPv4Address *string + + // NETBIOS name of each physical server on your Azure Stack HCI cluster. + Name *string +} + +type PrecheckResult struct { + // Property bag of key value pairs for additional information. + AdditionalData *string + + // Detailed overview of the issue and what impact the issue has on the stamp. + Description *string + + // The health check DisplayName localized of the individual test executed. + DisplayName *string + + // The name of the services called for the HealthCheck (I.E. Test-AzureStack, Test-Cluster). + HealthCheckSource *string + + // Name of the individual test/rule/alert that was executed. Unique, not exposed to the customer. + Name *string + + // Set of steps that can be taken to resolve the issue found. + Remediation *string + + // Severity of the result (Critical, Warning, Informational, Hidden). This answers how important the result is. Critical is + // the only update-blocking severity. + Severity *Severity + + // The status of the check running (i.e. Failed, Succeeded, In Progress). This answers whether the check ran, and passed or + // failed. + Status *Status + + // Key-value pairs that allow grouping/filtering individual tests. + Tags *PrecheckResultTags + + // The unique identifier for the affected resource (such as a node or drive). + TargetResourceID *string + + // The name of the affected resource. + TargetResourceName *string + + // The Time in which the HealthCheck was called. + Timestamp *time.Time + + // User-facing name; one or more sentences indicating the direct issue. + Title *string +} + +// PrecheckResultTags - Key-value pairs that allow grouping/filtering individual tests. +type PrecheckResultTags struct { + // Key that allow grouping/filtering individual tests. + Key *string + + // Value of the key that allow grouping/filtering individual tests. + Value *string +} + +// Publisher details. +type Publisher struct { + // Publisher properties. + Properties *PublisherProperties + + // 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 } -// 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). +// PublisherList - List of Publisher proxy resources for the HCI cluster. +type PublisherList struct { + // READ-ONLY; Link to the next set of results. NextLink *string - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation + // READ-ONLY; List of Publisher proxy resources. + Value []*Publisher } -// OsProfileUpdate - OsProfile - describes the update configuration of the operating system -type OsProfileUpdate struct { - // ComputerName - name of the computer - ComputerName *string - LinuxConfiguration *OsProfileUpdateLinuxConfiguration - WindowsConfiguration *OsProfileUpdateWindowsConfiguration +// PublisherProperties - Publisher properties. +type PublisherProperties struct { + // READ-ONLY; Provisioning State + ProvisioningState *string } -type OsProfileUpdateLinuxConfiguration struct { - // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation - // process. - ProvisionVMAgent *bool +// QosPolicyOverrides - The QoSPolicyOverrides of a cluster. +type QosPolicyOverrides struct { + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + BandwidthPercentageSMB *string - // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. - ProvisionVMConfigAgent *bool + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + PriorityValue8021ActionCluster *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + PriorityValue8021ActionSMB *string } -type OsProfileUpdateWindowsConfiguration struct { - // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation - // process. - ProvisionVMAgent *bool +type RawCertificateData struct { + Certificates []*string +} - // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. - ProvisionVMConfigAgent *bool +// ReportedProperties - The DeploymentStatus of AzureStackHCI Cluster. +type ReportedProperties struct { + // READ-ONLY; Deployment status of AzureStackHCI Cluster Deployment. + DeploymentStatus *DeploymentStatus + + // READ-ONLY; validation status of AzureStackHCI Cluster Deployment. + ValidationStatus *ValidationStatus } // Route - Route resource. @@ -786,6 +1873,66 @@ type RouteTablePropertiesFormat struct { Routes []*Route } +// SKU - Sku details. +type SKU struct { + // SKU properties. + Properties *SKUProperties + + // 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 +} + +// SKUList - List of SKU proxy resources for the HCI cluster. +type SKUList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of SKU proxy resources. + Value []*SKU +} + +// SKUMappings - SKU Mapping details. +type SKUMappings struct { + // Identifier of the CatalogPlan for the sku + CatalogPlanID *string + + // Identifier for the sku + MarketplaceSKUID *string + + // Array of SKU versions available + MarketplaceSKUVersions []*string +} + +// SKUProperties - SKU properties. +type SKUProperties struct { + // JSON serialized catalog content of the sku offer + Content *string + + // The API version of the catalog service used to serve the catalog content + ContentVersion *string + + // Identifier of the Offer for the sku + OfferID *string + + // Identifier of the Publisher for the offer + PublisherID *string + + // Array of SKU mappings + SKUMappings []*SKUMappings + + // READ-ONLY; Provisioning State + ProvisioningState *string +} + // SSHConfiguration - SSH configuration for Linux based VMs running on Azure type SSHConfiguration struct { // The list of SSH public keys used to authenticate with linux based VMs. @@ -805,6 +1952,125 @@ type SSHPublicKey struct { Path *string } +// ScaleUnits - Scale units will contains list of deployment data +type ScaleUnits struct { + // REQUIRED; Deployment Data to deploy AzureStackHCI Cluster. + DeploymentData *DeploymentData +} + +// SecurityComplianceStatus - Security compliance properties of the resource +type SecurityComplianceStatus struct { + // READ-ONLY; Indicates whether data at-rest encryption is enabled on Azure Stack HCI clustered volumes. + DataAtRestEncrypted *ComplianceStatus + + // READ-ONLY; Indicates whether HCI cluster has data in-transit protection. + DataInTransitProtected *ComplianceStatus + + // READ-ONLY; Time in UTC when compliance status was last updated. + LastUpdated *time.Time + + // READ-ONLY; Indicates whether HCI hosts meets secured-core server requirements. + SecuredCoreCompliance *ComplianceStatus + + // READ-ONLY; Indicates whether HCI hosts have enforced consistent Windows Defender Application Control. + WdacCompliance *ComplianceStatus +} + +// SecurityProperties - Security properties of the resource +type SecurityProperties struct { + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Secured Core Compliance Assignment + SecuredCoreComplianceAssignment *ComplianceAssignmentType + + // READ-ONLY; Security Compliance Status + SecurityComplianceStatus *SecurityComplianceStatus +} + +// SecuritySetting - Security settings proxy resource +type SecuritySetting struct { + // The resource-specific properties for this resource. + Properties *SecurityProperties + + // 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 +} + +// SecuritySettingListResult - The response of a SecuritySetting list operation. +type SecuritySettingListResult struct { + // REQUIRED; The SecuritySetting items on this page + Value []*SecuritySetting + + // The link to the next page of items + NextLink *string +} + +type SoftwareAssuranceChangeRequest struct { + Properties *SoftwareAssuranceChangeRequestProperties +} + +type SoftwareAssuranceChangeRequestProperties struct { + // Customer Intent for Software Assurance Benefit. + SoftwareAssuranceIntent *SoftwareAssuranceIntent +} + +// SoftwareAssuranceProperties - Software Assurance properties of the cluster. +type SoftwareAssuranceProperties struct { + // Customer Intent for Software Assurance Benefit. + SoftwareAssuranceIntent *SoftwareAssuranceIntent + + // READ-ONLY; TimeStamp denoting the latest SA benefit applicability is validated. + LastUpdated *time.Time + + // READ-ONLY; Status of the Software Assurance for the cluster. + SoftwareAssuranceStatus *SoftwareAssuranceStatus +} + +// Step - Progress representation of the update run steps. +type Step struct { + // More detailed description of the step. + Description *string + + // When the step reached a terminal state. + EndTimeUTC *time.Time + + // Error message, specified if the step is in a failed state. + ErrorMessage *string + + // Completion time of this step or the last completed sub-step. + LastUpdatedTimeUTC *time.Time + + // Name of the step. + Name *string + + // When the step started, or empty if it has not started executing. + StartTimeUTC *time.Time + + // Status of the step, bubbled up from the ECE action plan for installation attempts. Values are: 'Success', 'Error', 'InProgress', + // and 'Unknown status'. + Status *string + + // Recursive model for child steps of this step. + Steps []*Step +} + +// Storage - The Storage config of AzureStackHCI Cluster. +type Storage struct { + // By default, this mode is set to Express and your storage is configured as per best practices based on the number of nodes + // in the cluster. Allowed values are 'Express','InfraOnly', 'KeepStorage' + ConfigurationMode *string +} + // StorageContainerProperties - Properties under the storage container resource type StorageContainerProperties struct { // REQUIRED; Path of the storage container on the disk @@ -879,6 +2145,19 @@ type StorageContainersUpdateRequest struct { Tags map[string]*string } +// StorageNetworks - The StorageNetworks of a cluster. +type StorageNetworks struct { + // Name of the storage network. + Name *string + + // Name of the storage network adapter. + NetworkAdapterName *string + + // ID specified for the VLAN storage network. This setting is applied to the network interfaces that route the storage and + // VM migration traffic. + VlanID *string +} + type StorageProfileUpdate struct { // adds data disks to the virtual machine instance for the update call DataDisks []*StorageProfileUpdateDataDisksItem @@ -948,6 +2227,279 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// Update details +type Update struct { + // The geo-location where the resource lives + Location *string + + // Update properties + Properties *UpdateProperties + + // 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 +} + +// UpdateList - List of Updates +type UpdateList struct { + // List of Updates + Value []*Update + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// UpdatePrerequisite - If update State is HasPrerequisite, this property contains an array of objects describing prerequisite +// updates before installing this update. Otherwise, it is empty. +type UpdatePrerequisite struct { + // Friendly name of the prerequisite. + PackageName *string + + // Updatable component type. + UpdateType *string + + // Version of the prerequisite. + Version *string +} + +// UpdateProperties - Details of a singular Update in HCI Cluster +type UpdateProperties struct { + // Extensible KV pairs serialized as a string. This is currently used to report the stamp OEM family and hardware model information + // when an update is flagged as Invalid for the stamp based on OEM type. + AdditionalProperties *string + + // Indicates the way the update content can be downloaded. + AvailabilityType *AvailabilityType + + // An array of component versions for a Solution Bundle update, and an empty array otherwise. + ComponentVersions []*PackageVersionInfo + + // Description of the update. + Description *string + + // Display name of the Update + DisplayName *string + + // Last time the package-specific checks were run. + HealthCheckDate *time.Time + + // An array of PrecheckResult objects. + HealthCheckResult []*PrecheckResult + + // Overall health state for update-specific health checks. + HealthState *HealthState + + // Date that the update was installed. + InstalledDate *time.Time + + // Path where the update package is available. + PackagePath *string + + // Size of the package. This value is a combination of the size from update metadata and size of the payload that results + // from the live scan operation for OS update content. + PackageSizeInMb *float32 + + // Customer-visible type of the update. + PackageType *string + + // If update State is HasPrerequisite, this property contains an array of objects describing prerequisite updates before installing + // this update. Otherwise, it is empty. + Prerequisites []*UpdatePrerequisite + + // Publisher of the update package. + Publisher *string + RebootRequired *RebootRequirement + + // Link to release notes for the update. + ReleaseLink *string + + // State of the update as it relates to this stamp. + State *State + + // Additional information regarding the state of the update. See definition of UpdateStateProperties type below for more details + // on this property. + UpdateStateProperties *UpdateStateProperties + + // Version of the update. + Version *string + + // READ-ONLY; Provisioning state of the Updates proxy resource. + ProvisioningState *ProvisioningState +} + +// UpdateRun - Details of an Update run +type UpdateRun struct { + // The geo-location where the resource lives + Location *string + + // Describes Update Run Properties. + Properties *UpdateRunProperties + + // 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 +} + +// UpdateRunList - List of Update runs +type UpdateRunList struct { + // List of Update runs + Value []*UpdateRun + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// UpdateRunProperties - Details of an Update run +type UpdateRunProperties struct { + // Duration of the update run. + Duration *string + + // Timestamp of the most recently completed step in the update run. + LastUpdatedTime *time.Time + + // Progress representation of the update run steps. + Progress *Step + + // State of the update run. + State *UpdateRunPropertiesState + + // Timestamp of the update run was started. + TimeStarted *time.Time + + // READ-ONLY; Provisioning state of the UpdateRuns proxy resource. + ProvisioningState *ProvisioningState +} + +// UpdateStateProperties - Additional information regarding the state of the update. See definition of UpdateStateProperties +// type below for more details on this property. +type UpdateStateProperties struct { + // Brief message with instructions for updates of AvailabilityType Notify. + NotifyMessage *string + + // Progress percentage of ongoing operation. Currently this property is only valid when the update is in the Downloading state, + // where it maps to how much of the update content has been downloaded. + ProgressPercentage *float32 +} + +// UpdateSummaries - Get the update summaries for the cluster +type UpdateSummaries struct { + // The geo-location where the resource lives + Location *string + + // Update summaries properties + Properties *UpdateSummariesProperties + + // 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 +} + +// UpdateSummariesList - List of Update Summaries +type UpdateSummariesList struct { + // List of Update Summaries + Value []*UpdateSummaries + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// UpdateSummariesProperties - Properties of Update summaries +type UpdateSummariesProperties struct { + // Current Solution Bundle version of the stamp. + CurrentVersion *string + + // Name of the hardware model. + HardwareModel *string + + // Last time the package-specific checks were run. + HealthCheckDate *time.Time + + // An array of pre-check result objects. + HealthCheckResult []*PrecheckResult + + // Overall health state for update-specific health checks. + HealthState *HealthState + + // Last time the update service successfully checked for updates + LastChecked *time.Time + + // Last time an update installation completed successfully. + LastUpdated *time.Time + + // OEM family name. + OemFamily *string + + // Current version of each updatable component. + PackageVersions []*PackageVersionInfo + + // Overall update state of the stamp. + State *UpdateSummariesPropertiesState + + // READ-ONLY; Provisioning state of the UpdateSummaries proxy resource. + ProvisioningState *ProvisioningState +} + +type UploadCertificateRequest struct { + Properties *RawCertificateData +} + +// 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 +} + +// ValidateRequest - The validate request for Edge Device. +type ValidateRequest struct { + // REQUIRED; Node Ids against which, current node has to be validated. + EdgeDeviceIDs []*string + + // additional Info required for validation + AdditionalInfo *string +} + +// ValidateResponse - An Accepted response with an Operation-Location header. +type ValidateResponse struct { + // READ-ONLY; edge device validation status + Status *string +} + +// ValidationStatus - The ValidationStatus of AzureStackHCI Cluster. +type ValidationStatus struct { + // READ-ONLY; Status of AzureStackHCI Cluster Deployment. + Status *string + + // READ-ONLY; List of steps of AzureStackHCI Cluster Deployment. + Steps []*DeploymentStep +} + // VirtualHardDiskProperties - Properties under the virtual hard disk resource type VirtualHardDiskProperties struct { BlockSizeBytes *int32 @@ -1300,3 +2852,12 @@ type VirtualMachineInstanceView struct { // The VM Config Agent running on the virtual machine. VMAgent *VirtualMachineConfigAgentInstanceView } + +// VirtualSwitchConfigurationOverrides - The VirtualSwitchConfigurationOverrides of a cluster. +type VirtualSwitchConfigurationOverrides struct { + // Enable IoV for Virtual Switch + EnableIov *string + + // Load Balancing Algorithm for Virtual Switch + LoadBalancingAlgorithm *string +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go index a176b3d8ef98..d62b53001293 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go @@ -15,2798 +15,6732 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AdapterPropertyOverrides. +func (a AdapterPropertyOverrides) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "jumboPacket", a.JumboPacket) + populate(objectMap, "networkDirect", a.NetworkDirect) + populate(objectMap, "networkDirectTechnology", a.NetworkDirectTechnology) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AdapterPropertyOverrides. +func (a *AdapterPropertyOverrides) UnmarshalJSON(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", a, err) } for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "jumboPacket": + err = unpopulate(val, "JumboPacket", &a.JumboPacket) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "networkDirect": + err = unpopulate(val, "NetworkDirect", &a.NetworkDirect) + delete(rawMsg, key) + case "networkDirectTechnology": + err = unpopulate(val, "NetworkDirectTechnology", &a.NetworkDirectTechnology) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponse. +func (a ArcIdentityResponse) 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) + populate(objectMap, "properties", a.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponse. +func (a *ArcIdentityResponse) UnmarshalJSON(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", a, 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) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. -func (e ExtendedLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponseProperties. +func (a ArcIdentityResponseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) + populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) + populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) + populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) + populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. -func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponseProperties. +func (a *ArcIdentityResponseProperties) UnmarshalJSON(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", a, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) + case "arcApplicationClientId": + err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "arcApplicationObjectId": + err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) + delete(rawMsg, key) + case "arcApplicationTenantId": + err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + delete(rawMsg, key) + case "arcServicePrincipalObjectId": + err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. -func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSetting. +func (a ArcSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "offer", g.Offer) - populate(objectMap, "publisher", g.Publisher) - populate(objectMap, "sku", g.SKU) + 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 GalleryImageIdentifier. -func (g *GalleryImageIdentifier) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSetting. +func (a *ArcSetting) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "offer": - err = unpopulate(val, "Offer", &g.Offer) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &g.Publisher) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &g.SKU) + 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", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. -func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingList. +func (a ArcSettingList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cloudInitDataSource", g.CloudInitDataSource) - populate(objectMap, "containerId", g.ContainerID) - populate(objectMap, "hyperVGeneration", g.HyperVGeneration) - populate(objectMap, "identifier", g.Identifier) - populate(objectMap, "imagePath", g.ImagePath) - populate(objectMap, "osType", g.OSType) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "status", g.Status) - populate(objectMap, "version", g.Version) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties. -func (g *GalleryImageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingList. +func (a *ArcSettingList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "cloudInitDataSource": - err = unpopulate(val, "CloudInitDataSource", &g.CloudInitDataSource) - delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &g.ContainerID) - delete(rawMsg, key) - case "hyperVGeneration": - err = unpopulate(val, "HyperVGeneration", &g.HyperVGeneration) - delete(rawMsg, key) - case "identifier": - err = unpopulate(val, "Identifier", &g.Identifier) - delete(rawMsg, key) - case "imagePath": - err = unpopulate(val, "ImagePath", &g.ImagePath) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &g.OSType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &g.Version) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatus. -func (g GalleryImageStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingProperties. +func (a ArcSettingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadStatus", g.DownloadStatus) - populate(objectMap, "errorCode", g.ErrorCode) - populate(objectMap, "errorMessage", g.ErrorMessage) - populate(objectMap, "progressPercentage", g.ProgressPercentage) - populate(objectMap, "provisioningStatus", g.ProvisioningStatus) + populate(objectMap, "aggregateState", a.AggregateState) + populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) + populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) + populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) + populate(objectMap, "arcInstanceResourceGroup", a.ArcInstanceResourceGroup) + populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) + populateAny(objectMap, "connectivityProperties", a.ConnectivityProperties) + populate(objectMap, "defaultExtensions", a.DefaultExtensions) + populate(objectMap, "perNodeDetails", a.PerNodeDetails) + populate(objectMap, "provisioningState", a.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatus. -func (g *GalleryImageStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingProperties. +func (a *ArcSettingProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "downloadStatus": - err = unpopulate(val, "DownloadStatus", &g.DownloadStatus) + case "aggregateState": + err = unpopulate(val, "AggregateState", &a.AggregateState) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &g.ErrorCode) + case "arcApplicationClientId": + err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &g.ErrorMessage) + case "arcApplicationObjectId": + err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) delete(rawMsg, key) - case "progressPercentage": - err = unpopulate(val, "ProgressPercentage", &g.ProgressPercentage) + case "arcApplicationTenantId": + err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &g.ProvisioningStatus) + case "arcInstanceResourceGroup": + err = unpopulate(val, "ArcInstanceResourceGroup", &a.ArcInstanceResourceGroup) + delete(rawMsg, key) + case "arcServicePrincipalObjectId": + err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + delete(rawMsg, key) + case "connectivityProperties": + err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + delete(rawMsg, key) + case "defaultExtensions": + err = unpopulate(val, "DefaultExtensions", &a.DefaultExtensions) + delete(rawMsg, key) + case "perNodeDetails": + err = unpopulate(val, "PerNodeDetails", &a.PerNodeDetails) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusDownloadStatus. -func (g GalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatch. +func (a ArcSettingsPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadSizeInMB", g.DownloadSizeInMB) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusDownloadStatus. -func (g *GalleryImageStatusDownloadStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatch. +func (a *ArcSettingsPatch) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "downloadSizeInMB": - err = unpopulate(val, "DownloadSizeInMB", &g.DownloadSizeInMB) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusProvisioningStatus. -func (g GalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatchProperties. +func (a ArcSettingsPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", g.OperationID) - populate(objectMap, "status", g.Status) + populateAny(objectMap, "connectivityProperties", a.ConnectivityProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusProvisioningStatus. -func (g *GalleryImageStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatchProperties. +func (a *ArcSettingsPatchProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "operationId": - err = unpopulate(val, "OperationID", &g.OperationID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "connectivityProperties": + err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion. -func (g GalleryImageVersion) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersion. -func (g *GalleryImageVersion) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &g.Name) + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties. -func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterDesiredProperties. +func (c ClusterDesiredProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "storageProfile", g.StorageProfile) + populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) + populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionProperties. -func (g *GalleryImageVersionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterDesiredProperties. +func (c *ClusterDesiredProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "storageProfile": - err = unpopulate(val, "StorageProfile", &g.StorageProfile) + case "diagnosticLevel": + err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + delete(rawMsg, key) + case "windowsServerSubscription": + err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile. -func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponse. +func (c ClusterIdentityResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "osDiskImage", g.OSDiskImage) + populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionStorageProfile. -func (g *GalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponse. +func (c *ClusterIdentityResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "osDiskImage": - err = unpopulate(val, "OSDiskImage", &g.OSDiskImage) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImages. -func (g GalleryImages) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponseProperties. +func (c ClusterIdentityResponseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", g.ExtendedLocation) - populate(objectMap, "id", g.ID) - populate(objectMap, "location", g.Location) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "systemData", g.SystemData) - populate(objectMap, "tags", g.Tags) - populate(objectMap, "type", g.Type) + populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) + populate(objectMap, "aadTenantId", c.AADTenantID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImages. -func (g *GalleryImages) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponseProperties. +func (c *ClusterIdentityResponseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &g.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &g.Location) + case "aadApplicationObjectId": + err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &g.Tags) + case "aadServicePrincipalObjectId": + err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImagesListResult. -func (g GalleryImagesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterList. +func (c ClusterList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesListResult. -func (g *GalleryImagesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterList. +func (c *ClusterList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, 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", &g.NextLink) + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &g.Value) + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImagesUpdateRequest. -func (g GalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterNode. +func (c ClusterNode) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", g.Tags) + populate(objectMap, "coreCount", c.CoreCount) + populate(objectMap, "ehcResourceId", c.EhcResourceID) + populate(objectMap, "id", c.ID) + populateDateTimeRFC3339(objectMap, "lastLicensingTimestamp", c.LastLicensingTimestamp) + populate(objectMap, "manufacturer", c.Manufacturer) + populate(objectMap, "memoryInGiB", c.MemoryInGiB) + populate(objectMap, "model", c.Model) + populate(objectMap, "name", c.Name) + populate(objectMap, "nodeType", c.NodeType) + populate(objectMap, "osDisplayVersion", c.OSDisplayVersion) + populate(objectMap, "osName", c.OSName) + populate(objectMap, "osVersion", c.OSVersion) + populate(objectMap, "oemActivation", c.OemActivation) + populate(objectMap, "serialNumber", c.SerialNumber) + populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesUpdateRequest. -func (g *GalleryImagesUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterNode. +func (c *ClusterNode) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "coreCount": + err = unpopulate(val, "CoreCount", &c.CoreCount) + delete(rawMsg, key) + case "ehcResourceId": + err = unpopulate(val, "EhcResourceID", &c.EhcResourceID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "lastLicensingTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastLicensingTimestamp", &c.LastLicensingTimestamp) + delete(rawMsg, key) + case "manufacturer": + err = unpopulate(val, "Manufacturer", &c.Manufacturer) + delete(rawMsg, key) + case "memoryInGiB": + err = unpopulate(val, "MemoryInGiB", &c.MemoryInGiB) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &c.Model) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "nodeType": + err = unpopulate(val, "NodeType", &c.NodeType) + delete(rawMsg, key) + case "osDisplayVersion": + err = unpopulate(val, "OSDisplayVersion", &c.OSDisplayVersion) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &c.OSName) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &c.OSVersion) + delete(rawMsg, key) + case "oemActivation": + err = unpopulate(val, "OemActivation", &c.OemActivation) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &c.SerialNumber) + delete(rawMsg, key) + case "windowsServerSubscription": + err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + 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 ClusterPatch. +func (c ClusterPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatch. +func (c *ClusterPatch) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &g.Tags) + err = unpopulate(val, "Tags", &c.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage. -func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterPatchProperties. +func (c ClusterPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sizeInMB", g.SizeInMB) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadTenantId", c.AADTenantID) + populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) + populate(objectMap, "desiredProperties", c.DesiredProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryOSDiskImage. -func (g *GalleryOSDiskImage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatchProperties. +func (c *ClusterPatchProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "sizeInMB": - err = unpopulate(val, "SizeInMB", &g.SizeInMB) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) + delete(rawMsg, key) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) + delete(rawMsg, key) + case "cloudManagementEndpoint": + err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) + delete(rawMsg, key) + case "desiredProperties": + err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgent. -func (g GuestAgent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "systemData", g.SystemData) - populate(objectMap, "type", g.Type) + populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) + populate(objectMap, "aadTenantId", c.AADTenantID) + populate(objectMap, "billingModel", c.BillingModel) + populate(objectMap, "cloudId", c.CloudID) + populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) + populate(objectMap, "connectivityStatus", c.ConnectivityStatus) + populate(objectMap, "desiredProperties", c.DesiredProperties) + populate(objectMap, "isolatedVmAttestationConfiguration", c.IsolatedVMAttestationConfiguration) + populateDateTimeRFC3339(objectMap, "lastBillingTimestamp", c.LastBillingTimestamp) + populateDateTimeRFC3339(objectMap, "lastSyncTimestamp", c.LastSyncTimestamp) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateDateTimeRFC3339(objectMap, "registrationTimestamp", c.RegistrationTimestamp) + populate(objectMap, "reportedProperties", c.ReportedProperties) + populate(objectMap, "resourceProviderObjectId", c.ResourceProviderObjectID) + populate(objectMap, "serviceEndpoint", c.ServiceEndpoint) + populate(objectMap, "softwareAssuranceProperties", c.SoftwareAssuranceProperties) + populate(objectMap, "status", c.Status) + populate(objectMap, "trialDaysRemaining", c.TrialDaysRemaining) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgent. -func (g *GuestAgent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) + case "aadApplicationObjectId": + err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "aadServicePrincipalObjectId": + err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "billingModel": + err = unpopulate(val, "BillingModel", &c.BillingModel) + delete(rawMsg, key) + case "cloudId": + err = unpopulate(val, "CloudID", &c.CloudID) + delete(rawMsg, key) + case "cloudManagementEndpoint": + err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) + delete(rawMsg, key) + case "connectivityStatus": + err = unpopulate(val, "ConnectivityStatus", &c.ConnectivityStatus) + delete(rawMsg, key) + case "desiredProperties": + err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + delete(rawMsg, key) + case "isolatedVmAttestationConfiguration": + err = unpopulate(val, "IsolatedVMAttestationConfiguration", &c.IsolatedVMAttestationConfiguration) + delete(rawMsg, key) + case "lastBillingTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastBillingTimestamp", &c.LastBillingTimestamp) + delete(rawMsg, key) + case "lastSyncTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastSyncTimestamp", &c.LastSyncTimestamp) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "registrationTimestamp": + err = unpopulateDateTimeRFC3339(val, "RegistrationTimestamp", &c.RegistrationTimestamp) + delete(rawMsg, key) + case "reportedProperties": + err = unpopulate(val, "ReportedProperties", &c.ReportedProperties) + delete(rawMsg, key) + case "resourceProviderObjectId": + err = unpopulate(val, "ResourceProviderObjectID", &c.ResourceProviderObjectID) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &c.ServiceEndpoint) + delete(rawMsg, key) + case "softwareAssuranceProperties": + err = unpopulate(val, "SoftwareAssuranceProperties", &c.SoftwareAssuranceProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "trialDaysRemaining": + err = unpopulate(val, "TrialDaysRemaining", &c.TrialDaysRemaining) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentInstallStatus. -func (g GuestAgentInstallStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterReportedProperties. +func (c ClusterReportedProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentVersion", g.AgentVersion) - populate(objectMap, "errorDetails", g.ErrorDetails) - populateDateTimeRFC3339(objectMap, "lastStatusChange", g.LastStatusChange) - populate(objectMap, "status", g.Status) - populate(objectMap, "vmUuid", g.VMUUID) + populate(objectMap, "clusterId", c.ClusterID) + populate(objectMap, "clusterName", c.ClusterName) + populate(objectMap, "clusterType", c.ClusterType) + populate(objectMap, "clusterVersion", c.ClusterVersion) + populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) + populate(objectMap, "imdsAttestation", c.ImdsAttestation) + populateDateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) + populate(objectMap, "manufacturer", c.Manufacturer) + populate(objectMap, "nodes", c.Nodes) + populate(objectMap, "oemActivation", c.OemActivation) + populate(objectMap, "supportedCapabilities", c.SupportedCapabilities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentInstallStatus. -func (g *GuestAgentInstallStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterReportedProperties. +func (c *ClusterReportedProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "agentVersion": - err = unpopulate(val, "AgentVersion", &g.AgentVersion) + case "clusterId": + err = unpopulate(val, "ClusterID", &c.ClusterID) delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &g.ErrorDetails) + case "clusterName": + err = unpopulate(val, "ClusterName", &c.ClusterName) delete(rawMsg, key) - case "lastStatusChange": - err = unpopulateDateTimeRFC3339(val, "LastStatusChange", &g.LastStatusChange) + case "clusterType": + err = unpopulate(val, "ClusterType", &c.ClusterType) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "clusterVersion": + err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) delete(rawMsg, key) - case "vmUuid": - err = unpopulate(val, "VMUUID", &g.VMUUID) + case "diagnosticLevel": + err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + delete(rawMsg, key) + case "imdsAttestation": + err = unpopulate(val, "ImdsAttestation", &c.ImdsAttestation) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) + delete(rawMsg, key) + case "manufacturer": + err = unpopulate(val, "Manufacturer", &c.Manufacturer) + delete(rawMsg, key) + case "nodes": + err = unpopulate(val, "Nodes", &c.Nodes) + delete(rawMsg, key) + case "oemActivation": + err = unpopulate(val, "OemActivation", &c.OemActivation) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &c.SupportedCapabilities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentList. -func (g GuestAgentList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefaultExtensionDetails. +func (d DefaultExtensionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "category", d.Category) + populateDateTimeRFC3339(objectMap, "consentTime", d.ConsentTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentList. -func (g *GuestAgentList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultExtensionDetails. +func (d *DefaultExtensionDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + 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", &g.NextLink) + case "category": + err = unpopulate(val, "Category", &d.Category) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "consentTime": + err = unpopulateDateTimeRFC3339(val, "ConsentTime", &d.ConsentTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentProperties. -func (g GuestAgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentCluster. +func (d DeploymentCluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", g.Credentials) - populate(objectMap, "provisioningAction", g.ProvisioningAction) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "status", g.Status) + populate(objectMap, "azureServiceEndpoint", d.AzureServiceEndpoint) + populate(objectMap, "cloudAccountName", d.CloudAccountName) + populate(objectMap, "name", d.Name) + populate(objectMap, "witnessPath", d.WitnessPath) + populate(objectMap, "witnessType", d.WitnessType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentProperties. -func (g *GuestAgentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentCluster. +func (d *DeploymentCluster) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &g.Credentials) + case "azureServiceEndpoint": + err = unpopulate(val, "AzureServiceEndpoint", &d.AzureServiceEndpoint) delete(rawMsg, key) - case "provisioningAction": - err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) + case "cloudAccountName": + err = unpopulate(val, "CloudAccountName", &d.CloudAccountName) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "witnessPath": + err = unpopulate(val, "WitnessPath", &d.WitnessPath) + delete(rawMsg, key) + case "witnessType": + err = unpopulate(val, "WitnessType", &d.WitnessType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestCredential. -func (g GuestCredential) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentConfiguration. +func (d DeploymentConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "password", g.Password) - populate(objectMap, "username", g.Username) + populate(objectMap, "scaleUnits", d.ScaleUnits) + populate(objectMap, "version", d.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestCredential. -func (g *GuestCredential) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentConfiguration. +func (d *DeploymentConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "password": - err = unpopulate(val, "Password", &g.Password) + case "scaleUnits": + err = unpopulate(val, "ScaleUnits", &d.ScaleUnits) delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &g.Username) + case "version": + err = unpopulate(val, "Version", &d.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfiguration. -func (h HTTPProxyConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentData. +func (d DeploymentData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "httpProxy", h.HTTPProxy) - populate(objectMap, "httpsProxy", h.HTTPSProxy) - populate(objectMap, "noProxy", h.NoProxy) - populate(objectMap, "trustedCa", h.TrustedCa) + populate(objectMap, "adouPath", d.AdouPath) + populate(objectMap, "cluster", d.Cluster) + populate(objectMap, "domainFqdn", d.DomainFqdn) + populate(objectMap, "hostNetwork", d.HostNetwork) + populate(objectMap, "infrastructureNetwork", d.InfrastructureNetwork) + populate(objectMap, "namingPrefix", d.NamingPrefix) + populate(objectMap, "observability", d.Observability) + populate(objectMap, "optionalServices", d.OptionalServices) + populate(objectMap, "physicalNodes", d.PhysicalNodes) + populate(objectMap, "secretsLocation", d.SecretsLocation) + populate(objectMap, "securitySettings", d.SecuritySettings) + populate(objectMap, "storage", d.Storage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPProxyConfiguration. -func (h *HTTPProxyConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentData. +func (d *DeploymentData) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "httpProxy": - err = unpopulate(val, "HTTPProxy", &h.HTTPProxy) + case "adouPath": + err = unpopulate(val, "AdouPath", &d.AdouPath) delete(rawMsg, key) - case "httpsProxy": - err = unpopulate(val, "HTTPSProxy", &h.HTTPSProxy) + case "cluster": + err = unpopulate(val, "Cluster", &d.Cluster) delete(rawMsg, key) - case "noProxy": - err = unpopulate(val, "NoProxy", &h.NoProxy) + case "domainFqdn": + err = unpopulate(val, "DomainFqdn", &d.DomainFqdn) delete(rawMsg, key) - case "trustedCa": - err = unpopulate(val, "TrustedCa", &h.TrustedCa) + case "hostNetwork": + err = unpopulate(val, "HostNetwork", &d.HostNetwork) + delete(rawMsg, key) + case "infrastructureNetwork": + err = unpopulate(val, "InfrastructureNetwork", &d.InfrastructureNetwork) + delete(rawMsg, key) + case "namingPrefix": + err = unpopulate(val, "NamingPrefix", &d.NamingPrefix) + delete(rawMsg, key) + case "observability": + err = unpopulate(val, "Observability", &d.Observability) + delete(rawMsg, key) + case "optionalServices": + err = unpopulate(val, "OptionalServices", &d.OptionalServices) + delete(rawMsg, key) + case "physicalNodes": + err = unpopulate(val, "PhysicalNodes", &d.PhysicalNodes) + delete(rawMsg, key) + case "secretsLocation": + err = unpopulate(val, "SecretsLocation", &d.SecretsLocation) + delete(rawMsg, key) + case "securitySettings": + err = unpopulate(val, "SecuritySettings", &d.SecuritySettings) + delete(rawMsg, key) + case "storage": + err = unpopulate(val, "Storage", &d.Storage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HardwareProfileUpdate. -func (h HardwareProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSecuritySettings. +func (d DeploymentSecuritySettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "memoryMB", h.MemoryMB) - populate(objectMap, "processors", h.Processors) - populate(objectMap, "vmSize", h.VMSize) + populate(objectMap, "bitlockerBootVolume", d.BitlockerBootVolume) + populate(objectMap, "bitlockerDataVolumes", d.BitlockerDataVolumes) + populate(objectMap, "credentialGuardEnforced", d.CredentialGuardEnforced) + populate(objectMap, "driftControlEnforced", d.DriftControlEnforced) + populate(objectMap, "drtmProtection", d.DrtmProtection) + populate(objectMap, "hvciProtection", d.HvciProtection) + populate(objectMap, "sideChannelMitigationEnforced", d.SideChannelMitigationEnforced) + populate(objectMap, "smbClusterEncryption", d.SmbClusterEncryption) + populate(objectMap, "smbSigningEnforced", d.SmbSigningEnforced) + populate(objectMap, "wdacEnforced", d.WdacEnforced) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfileUpdate. -func (h *HardwareProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSecuritySettings. +func (d *DeploymentSecuritySettings) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "memoryMB": - err = unpopulate(val, "MemoryMB", &h.MemoryMB) + case "bitlockerBootVolume": + err = unpopulate(val, "BitlockerBootVolume", &d.BitlockerBootVolume) delete(rawMsg, key) - case "processors": - err = unpopulate(val, "Processors", &h.Processors) + case "bitlockerDataVolumes": + err = unpopulate(val, "BitlockerDataVolumes", &d.BitlockerDataVolumes) delete(rawMsg, key) - case "vmSize": - err = unpopulate(val, "VMSize", &h.VMSize) + case "credentialGuardEnforced": + err = unpopulate(val, "CredentialGuardEnforced", &d.CredentialGuardEnforced) + delete(rawMsg, key) + case "driftControlEnforced": + err = unpopulate(val, "DriftControlEnforced", &d.DriftControlEnforced) + delete(rawMsg, key) + case "drtmProtection": + err = unpopulate(val, "DrtmProtection", &d.DrtmProtection) + delete(rawMsg, key) + case "hvciProtection": + err = unpopulate(val, "HvciProtection", &d.HvciProtection) + delete(rawMsg, key) + case "sideChannelMitigationEnforced": + err = unpopulate(val, "SideChannelMitigationEnforced", &d.SideChannelMitigationEnforced) + delete(rawMsg, key) + case "smbClusterEncryption": + err = unpopulate(val, "SmbClusterEncryption", &d.SmbClusterEncryption) + delete(rawMsg, key) + case "smbSigningEnforced": + err = unpopulate(val, "SmbSigningEnforced", &d.SmbSigningEnforced) + delete(rawMsg, key) + case "wdacEnforced": + err = unpopulate(val, "WdacEnforced", &d.WdacEnforced) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. -func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSetting. +func (d DeploymentSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", h.ID) - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "systemData", h.SystemData) - populate(objectMap, "type", h.Type) + 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 HybridIdentityMetadata. -func (h *HybridIdentityMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSetting. +func (d *DeploymentSetting) UnmarshalJSON(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) + 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", &h.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &h.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &h.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. -func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSettingListResult. +func (d DeploymentSettingListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. -func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSettingListResult. +func (d *DeploymentSettingListResult) UnmarshalJSON(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) + 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", &h.NextLink) + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &h.Value) + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. -func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSettingsProperties. +func (d DeploymentSettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", h.Identity) - populate(objectMap, "provisioningState", h.ProvisioningState) - populate(objectMap, "publicKey", h.PublicKey) - populate(objectMap, "resourceUid", h.ResourceUID) + populate(objectMap, "arcNodeResourceIds", d.ArcNodeResourceIDs) + populate(objectMap, "deploymentConfiguration", d.DeploymentConfiguration) + populate(objectMap, "deploymentMode", d.DeploymentMode) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "reportedProperties", d.ReportedProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. -func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSettingsProperties. +func (d *DeploymentSettingsProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &h.Identity) + case "arcNodeResourceIds": + err = unpopulate(val, "ArcNodeResourceIDs", &d.ArcNodeResourceIDs) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + case "deploymentConfiguration": + err = unpopulate(val, "DeploymentConfiguration", &d.DeploymentConfiguration) delete(rawMsg, key) - case "publicKey": - err = unpopulate(val, "PublicKey", &h.PublicKey) + case "deploymentMode": + err = unpopulate(val, "DeploymentMode", &d.DeploymentMode) delete(rawMsg, key) - case "resourceUid": - err = unpopulate(val, "ResourceUID", &h.ResourceUID) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "reportedProperties": + err = unpopulate(val, "ReportedProperties", &d.ReportedProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPConfiguration. -func (i IPConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentStatus. +func (d DeploymentStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) + populate(objectMap, "status", d.Status) + populate(objectMap, "steps", d.Steps) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfiguration. -func (i *IPConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentStatus. +func (d *DeploymentStatus) UnmarshalJSON(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) + 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", &i.Name) + case "status": + err = unpopulate(val, "Status", &d.Status) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "steps": + err = unpopulate(val, "Steps", &d.Steps) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPConfigurationProperties. -func (i IPConfigurationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentStep. +func (d DeploymentStep) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "gateway", i.Gateway) - populate(objectMap, "prefixLength", i.PrefixLength) - populate(objectMap, "privateIPAddress", i.PrivateIPAddress) - populate(objectMap, "subnet", i.Subnet) + populate(objectMap, "description", d.Description) + populate(objectMap, "endTimeUtc", d.EndTimeUTC) + populate(objectMap, "exception", d.Exception) + populate(objectMap, "fullStepIndex", d.FullStepIndex) + populate(objectMap, "name", d.Name) + populate(objectMap, "startTimeUtc", d.StartTimeUTC) + populate(objectMap, "status", d.Status) + populate(objectMap, "steps", d.Steps) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationProperties. -func (i *IPConfigurationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentStep. +func (d *DeploymentStep) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "gateway": - err = unpopulate(val, "Gateway", &i.Gateway) + case "description": + err = unpopulate(val, "Description", &d.Description) delete(rawMsg, key) - case "prefixLength": - err = unpopulate(val, "PrefixLength", &i.PrefixLength) + case "endTimeUtc": + err = unpopulate(val, "EndTimeUTC", &d.EndTimeUTC) delete(rawMsg, key) - case "privateIPAddress": - err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) + case "exception": + err = unpopulate(val, "Exception", &d.Exception) delete(rawMsg, key) - case "subnet": - err = unpopulate(val, "Subnet", &i.Subnet) + case "fullStepIndex": + err = unpopulate(val, "FullStepIndex", &d.FullStepIndex) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulate(val, "StartTimeUTC", &d.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "steps": + err = unpopulate(val, "Steps", &d.Steps) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPConfigurationPropertiesSubnet. -func (i IPConfigurationPropertiesSubnet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeviceConfiguration. +func (d DeviceConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) + populate(objectMap, "deviceMetadata", d.DeviceMetadata) + populate(objectMap, "nicDetails", d.NicDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationPropertiesSubnet. -func (i *IPConfigurationPropertiesSubnet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceConfiguration. +func (d *DeviceConfiguration) UnmarshalJSON(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) + 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", &i.ID) + case "deviceMetadata": + err = unpopulate(val, "DeviceMetadata", &d.DeviceMetadata) + delete(rawMsg, key) + case "nicDetails": + err = unpopulate(val, "NicDetails", &d.NicDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPPool. -func (i IPPool) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EdgeDevice. +func (e EdgeDevice) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "end", i.End) - populate(objectMap, "ipPoolType", i.IPPoolType) - populate(objectMap, "info", i.Info) - populate(objectMap, "name", i.Name) - populate(objectMap, "start", i.Start) + 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) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPPool. -func (i *IPPool) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeDevice. +func (e *EdgeDevice) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "end": - err = unpopulate(val, "End", &i.End) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "ipPoolType": - err = unpopulate(val, "IPPoolType", &i.IPPoolType) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "info": - err = unpopulate(val, "Info", &i.Info) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) - case "start": - err = unpopulate(val, "Start", &i.Start) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPPoolInfo. -func (i IPPoolInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EdgeDeviceListResult. +func (e EdgeDeviceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "available", i.Available) - populate(objectMap, "used", i.Used) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPPoolInfo. -func (i *IPPoolInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeDeviceListResult. +func (e *EdgeDeviceListResult) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "available": - err = unpopulate(val, "Available", &i.Available) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "used": - err = unpopulate(val, "Used", &i.Used) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EdgeDeviceProperties. +func (e EdgeDeviceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "SystemAssigned" + populate(objectMap, "deviceConfiguration", e.DeviceConfiguration) + populate(objectMap, "provisioningState", e.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeDeviceProperties. +func (e *EdgeDeviceProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "deviceConfiguration": + err = unpopulate(val, "DeviceConfiguration", &e.DeviceConfiguration) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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", &i.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type InstanceViewStatus. -func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", i.Code) - populate(objectMap, "displayStatus", i.DisplayStatus) - populate(objectMap, "level", i.Level) - populate(objectMap, "message", i.Message) - populateDateTimeRFC3339(objectMap, "time", i.Time) + 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 InstanceViewStatus. -func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error { +// 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", i, 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", &i.Code) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "displayStatus": - err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &i.Level) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) case "message": - err = unpopulate(val, "Message", &i.Message) + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "time": - err = unpopulateDateTimeRFC3339(val, "Time", &i.Time) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type InterfaceDNSSettings. -func (i InterfaceDNSSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsServers", i.DNSServers) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceDNSSettings. -func (i *InterfaceDNSSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dnsServers": - err = unpopulate(val, "DNSServers", &i.DNSServers) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkProperties. -func (l LogicalNetworkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Extension. +func (e Extension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dhcpOptions", l.DhcpOptions) - populate(objectMap, "provisioningState", l.ProvisioningState) - populate(objectMap, "status", l.Status) - populate(objectMap, "subnets", l.Subnets) - populate(objectMap, "vmSwitchName", l.VMSwitchName) + 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) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkProperties. -func (l *LogicalNetworkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. +func (e *Extension) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dhcpOptions": - err = unpopulate(val, "DhcpOptions", &l.DhcpOptions) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &l.Status) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "subnets": - err = unpopulate(val, "Subnets", &l.Subnets) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) - case "vmSwitchName": - err = unpopulate(val, "VMSwitchName", &l.VMSwitchName) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkPropertiesDhcpOptions. -func (l LogicalNetworkPropertiesDhcpOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionInstanceView. +func (e ExtensionInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsServers", l.DNSServers) + populate(objectMap, "name", e.Name) + populate(objectMap, "status", e.Status) + populate(objectMap, "type", e.Type) + populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkPropertiesDhcpOptions. -func (l *LogicalNetworkPropertiesDhcpOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionInstanceView. +func (e *ExtensionInstanceView) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dnsServers": - err = unpopulate(val, "DNSServers", &l.DNSServers) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) + 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 LogicalNetworkStatus. -func (l LogicalNetworkStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionInstanceViewStatus. +func (e ExtensionInstanceViewStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", l.ErrorCode) - populate(objectMap, "errorMessage", l.ErrorMessage) - populate(objectMap, "provisioningStatus", l.ProvisioningStatus) + populate(objectMap, "code", e.Code) + populate(objectMap, "displayStatus", e.DisplayStatus) + populate(objectMap, "level", e.Level) + populate(objectMap, "message", e.Message) + populateDateTimeRFC3339(objectMap, "time", e.Time) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatus. -func (l *LogicalNetworkStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionInstanceViewStatus. +func (e *ExtensionInstanceViewStatus) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "errorCode": - err = unpopulate(val, "ErrorCode", &l.ErrorCode) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &l.ErrorMessage) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &e.DisplayStatus) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &l.ProvisioningStatus) + case "level": + err = unpopulate(val, "Level", &e.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(val, "Time", &e.Time) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkStatusProvisioningStatus. -func (l LogicalNetworkStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionList. +func (e ExtensionList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", l.OperationID) - populate(objectMap, "status", l.Status) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatusProvisioningStatus. -func (l *LogicalNetworkStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionList. +func (e *ExtensionList) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "operationId": - err = unpopulate(val, "OperationID", &l.OperationID) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &l.Status) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworks. -func (l LogicalNetworks) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionParameters. +func (e ExtensionParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", l.ExtendedLocation) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "systemData", l.SystemData) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) + populate(objectMap, "autoUpgradeMinorVersion", e.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", e.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", e.ForceUpdateTag) + populateAny(objectMap, "protectedSettings", e.ProtectedSettings) + populate(objectMap, "publisher", e.Publisher) + populateAny(objectMap, "settings", e.Settings) + populate(objectMap, "type", e.Type) + populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworks. -func (l *LogicalNetworks) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionParameters. +func (e *ExtensionParameters) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &l.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &l.ID) + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &e.AutoUpgradeMinorVersion) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &l.Location) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &e.EnableAutomaticUpgrade) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &e.ForceUpdateTag) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &l.Properties) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &e.ProtectedSettings) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &l.SystemData) + case "publisher": + err = unpopulate(val, "Publisher", &e.Publisher) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &l.Tags) + case "settings": + err = unpopulate(val, "Settings", &e.Settings) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &l.Type) + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksListResult. -func (l LogicalNetworksListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionPatch. +func (e ExtensionPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) + populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksListResult. -func (l *LogicalNetworksListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionPatch. +func (e *ExtensionPatch) UnmarshalJSON(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) + 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", &l.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksUpdateRequest. -func (l LogicalNetworksUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionPatchParameters. +func (e ExtensionPatchParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", l.Tags) + populate(objectMap, "enableAutomaticUpgrade", e.EnableAutomaticUpgrade) + populateAny(objectMap, "protectedSettings", e.ProtectedSettings) + populateAny(objectMap, "settings", e.Settings) + populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksUpdateRequest. -func (l *LogicalNetworksUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionPatchParameters. +func (e *ExtensionPatchParameters) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &l.Tags) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &e.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &e.ProtectedSettings) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &e.Settings) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageProperties. -func (m MarketplaceGalleryImageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionPatchProperties. +func (e ExtensionPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cloudInitDataSource", m.CloudInitDataSource) - populate(objectMap, "containerId", m.ContainerID) - populate(objectMap, "hyperVGeneration", m.HyperVGeneration) - populate(objectMap, "identifier", m.Identifier) - populate(objectMap, "osType", m.OSType) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "status", m.Status) - populate(objectMap, "version", m.Version) + populate(objectMap, "extensionParameters", e.ExtensionParameters) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageProperties. -func (m *MarketplaceGalleryImageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionPatchProperties. +func (e *ExtensionPatchProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "cloudInitDataSource": - err = unpopulate(val, "CloudInitDataSource", &m.CloudInitDataSource) - delete(rawMsg, key) - case "containerId": - err = unpopulate(val, "ContainerID", &m.ContainerID) - delete(rawMsg, key) - case "hyperVGeneration": - err = unpopulate(val, "HyperVGeneration", &m.HyperVGeneration) - delete(rawMsg, key) - case "identifier": - err = unpopulate(val, "Identifier", &m.Identifier) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &m.OSType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &m.Version) + case "extensionParameters": + err = unpopulate(val, "ExtensionParameters", &e.ExtensionParameters) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatus. -func (m MarketplaceGalleryImageStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadStatus", m.DownloadStatus) - populate(objectMap, "errorCode", m.ErrorCode) - populate(objectMap, "errorMessage", m.ErrorMessage) - populate(objectMap, "progressPercentage", m.ProgressPercentage) - populate(objectMap, "provisioningStatus", m.ProvisioningStatus) + populate(objectMap, "aggregateState", e.AggregateState) + populate(objectMap, "extensionParameters", e.ExtensionParameters) + populate(objectMap, "managedBy", e.ManagedBy) + populate(objectMap, "perNodeExtensionDetails", e.PerNodeExtensionDetails) + populate(objectMap, "provisioningState", e.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatus. -func (m *MarketplaceGalleryImageStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionProperties. +func (e *ExtensionProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "downloadStatus": - err = unpopulate(val, "DownloadStatus", &m.DownloadStatus) + case "aggregateState": + err = unpopulate(val, "AggregateState", &e.AggregateState) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &m.ErrorCode) + case "extensionParameters": + err = unpopulate(val, "ExtensionParameters", &e.ExtensionParameters) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) + case "managedBy": + err = unpopulate(val, "ManagedBy", &e.ManagedBy) delete(rawMsg, key) - case "progressPercentage": - err = unpopulate(val, "ProgressPercentage", &m.ProgressPercentage) + case "perNodeExtensionDetails": + err = unpopulate(val, "PerNodeExtensionDetails", &e.PerNodeExtensionDetails) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &m.ProvisioningStatus) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. -func (m MarketplaceGalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionUpgradeParameters. +func (e ExtensionUpgradeParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadSizeInMB", m.DownloadSizeInMB) + populate(objectMap, "targetVersion", e.TargetVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. -func (m *MarketplaceGalleryImageStatusDownloadStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionUpgradeParameters. +func (e *ExtensionUpgradeParameters) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "downloadSizeInMB": - err = unpopulate(val, "DownloadSizeInMB", &m.DownloadSizeInMB) + case "targetVersion": + err = unpopulate(val, "TargetVersion", &e.TargetVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatusProvisioningStatus. -func (m MarketplaceGalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. +func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", m.OperationID) - populate(objectMap, "status", m.Status) + populate(objectMap, "offer", g.Offer) + populate(objectMap, "publisher", g.Publisher) + populate(objectMap, "sku", g.SKU) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusProvisioningStatus. -func (m *MarketplaceGalleryImageStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageIdentifier. +func (g *GalleryImageIdentifier) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "operationId": - err = unpopulate(val, "OperationID", &m.OperationID) + case "offer": + err = unpopulate(val, "Offer", &g.Offer) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) + case "publisher": + err = unpopulate(val, "Publisher", &g.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &g.SKU) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImages. -func (m MarketplaceGalleryImages) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. +func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", m.ExtendedLocation) - populate(objectMap, "id", m.ID) - 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) + populate(objectMap, "cloudInitDataSource", g.CloudInitDataSource) + populate(objectMap, "containerId", g.ContainerID) + populate(objectMap, "hyperVGeneration", g.HyperVGeneration) + populate(objectMap, "identifier", g.Identifier) + populate(objectMap, "imagePath", g.ImagePath) + populate(objectMap, "osType", g.OSType) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "status", g.Status) + populate(objectMap, "version", g.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImages. -func (m *MarketplaceGalleryImages) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties. +func (g *GalleryImageProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) + case "cloudInitDataSource": + err = unpopulate(val, "CloudInitDataSource", &g.CloudInitDataSource) + delete(rawMsg, key) + case "containerId": + err = unpopulate(val, "ContainerID", &g.ContainerID) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &g.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &g.Identifier) + delete(rawMsg, key) + case "imagePath": + err = unpopulate(val, "ImagePath", &g.ImagePath) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &g.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &g.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatus. +func (g GalleryImageStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadStatus", g.DownloadStatus) + populate(objectMap, "errorCode", g.ErrorCode) + populate(objectMap, "errorMessage", g.ErrorMessage) + populate(objectMap, "progressPercentage", g.ProgressPercentage) + populate(objectMap, "provisioningStatus", g.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatus. +func (g *GalleryImageStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadStatus": + err = unpopulate(val, "DownloadStatus", &g.DownloadStatus) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &g.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &g.ErrorMessage) + delete(rawMsg, key) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &g.ProgressPercentage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &g.ProvisioningStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusDownloadStatus. +func (g GalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadSizeInMB", g.DownloadSizeInMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusDownloadStatus. +func (g *GalleryImageStatusDownloadStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadSizeInMB": + err = unpopulate(val, "DownloadSizeInMB", &g.DownloadSizeInMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusProvisioningStatus. +func (g GalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", g.OperationID) + populate(objectMap, "status", g.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusProvisioningStatus. +func (g *GalleryImageStatusProvisioningStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationId": + err = unpopulate(val, "OperationID", &g.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion. +func (g GalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersion. +func (g *GalleryImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties. +func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storageProfile", g.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionProperties. +func (g *GalleryImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "storageProfile": + err = unpopulate(val, "StorageProfile", &g.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile. +func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "osDiskImage", g.OSDiskImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionStorageProfile. +func (g *GalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &g.OSDiskImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImages. +func (g GalleryImages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", g.ExtendedLocation) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImages. +func (g *GalleryImages) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &g.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &m.Location) + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImagesListResult. +func (g GalleryImagesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesListResult. +func (g *GalleryImagesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImagesUpdateRequest. +func (g GalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", g.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesUpdateRequest. +func (g *GalleryImagesUpdateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage. +func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sizeInMB", g.SizeInMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryOSDiskImage. +func (g *GalleryOSDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sizeInMB": + err = unpopulate(val, "SizeInMB", &g.SizeInMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgent. +func (g GuestAgent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgent. +func (g *GuestAgent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgentInstallStatus. +func (g GuestAgentInstallStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentVersion", g.AgentVersion) + populate(objectMap, "errorDetails", g.ErrorDetails) + populateDateTimeRFC3339(objectMap, "lastStatusChange", g.LastStatusChange) + populate(objectMap, "status", g.Status) + populate(objectMap, "vmUuid", g.VMUUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentInstallStatus. +func (g *GuestAgentInstallStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentVersion": + err = unpopulate(val, "AgentVersion", &g.AgentVersion) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &g.ErrorDetails) + delete(rawMsg, key) + case "lastStatusChange": + err = unpopulateDateTimeRFC3339(val, "LastStatusChange", &g.LastStatusChange) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + case "vmUuid": + err = unpopulate(val, "VMUUID", &g.VMUUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgentList. +func (g GuestAgentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentList. +func (g *GuestAgentList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestAgentProperties. +func (g GuestAgentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentials", g.Credentials) + populate(objectMap, "provisioningAction", g.ProvisioningAction) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "status", g.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentProperties. +func (g *GuestAgentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "credentials": + err = unpopulate(val, "Credentials", &g.Credentials) + delete(rawMsg, key) + case "provisioningAction": + err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuestCredential. +func (g GuestCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "password", g.Password) + populate(objectMap, "username", g.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuestCredential. +func (g *GuestCredential) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, "Password", &g.Password) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &g.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfiguration. +func (h HTTPProxyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "httpProxy", h.HTTPProxy) + populate(objectMap, "httpsProxy", h.HTTPSProxy) + populate(objectMap, "noProxy", h.NoProxy) + populate(objectMap, "trustedCa", h.TrustedCa) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPProxyConfiguration. +func (h *HTTPProxyConfiguration) UnmarshalJSON(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 "httpProxy": + err = unpopulate(val, "HTTPProxy", &h.HTTPProxy) + delete(rawMsg, key) + case "httpsProxy": + err = unpopulate(val, "HTTPSProxy", &h.HTTPSProxy) + delete(rawMsg, key) + case "noProxy": + err = unpopulate(val, "NoProxy", &h.NoProxy) + delete(rawMsg, key) + case "trustedCa": + err = unpopulate(val, "TrustedCa", &h.TrustedCa) + 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 HardwareProfileUpdate. +func (h HardwareProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "memoryMB", h.MemoryMB) + populate(objectMap, "processors", h.Processors) + populate(objectMap, "vmSize", h.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfileUpdate. +func (h *HardwareProfileUpdate) UnmarshalJSON(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 "memoryMB": + err = unpopulate(val, "MemoryMB", &h.MemoryMB) + delete(rawMsg, key) + case "processors": + err = unpopulate(val, "Processors", &h.Processors) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &h.VMSize) + 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 HostNetwork. +func (h HostNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableStorageAutoIp", h.EnableStorageAutoIP) + populate(objectMap, "intents", h.Intents) + populate(objectMap, "storageConnectivitySwitchless", h.StorageConnectivitySwitchless) + populate(objectMap, "storageNetworks", h.StorageNetworks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HostNetwork. +func (h *HostNetwork) UnmarshalJSON(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 "enableStorageAutoIp": + err = unpopulate(val, "EnableStorageAutoIP", &h.EnableStorageAutoIP) + delete(rawMsg, key) + case "intents": + err = unpopulate(val, "Intents", &h.Intents) + delete(rawMsg, key) + case "storageConnectivitySwitchless": + err = unpopulate(val, "StorageConnectivitySwitchless", &h.StorageConnectivitySwitchless) + delete(rawMsg, key) + case "storageNetworks": + err = unpopulate(val, "StorageNetworks", &h.StorageNetworks) + 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 HybridIdentityMetadata. +func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. +func (h *HybridIdentityMetadata) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + 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 HybridIdentityMetadataList. +func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. +func (h *HybridIdentityMetadataList) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + 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 HybridIdentityMetadataProperties. +func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", h.Identity) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "publicKey", h.PublicKey) + populate(objectMap, "resourceUid", h.ResourceUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. +func (h *HybridIdentityMetadataProperties) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &h.Identity) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &h.PublicKey) + delete(rawMsg, key) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &h.ResourceUID) + 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 IPConfiguration. +func (i IPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfiguration. +func (i *IPConfiguration) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + 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 IPConfigurationProperties. +func (i IPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gateway", i.Gateway) + populate(objectMap, "prefixLength", i.PrefixLength) + populate(objectMap, "privateIPAddress", i.PrivateIPAddress) + populate(objectMap, "subnet", i.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationProperties. +func (i *IPConfigurationProperties) UnmarshalJSON(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 "gateway": + err = unpopulate(val, "Gateway", &i.Gateway) + delete(rawMsg, key) + case "prefixLength": + err = unpopulate(val, "PrefixLength", &i.PrefixLength) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + 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 IPConfigurationPropertiesSubnet. +func (i IPConfigurationPropertiesSubnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationPropertiesSubnet. +func (i *IPConfigurationPropertiesSubnet) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &i.ID) + 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 IPPool. +func (i IPPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "end", i.End) + populate(objectMap, "ipPoolType", i.IPPoolType) + populate(objectMap, "info", i.Info) + populate(objectMap, "name", i.Name) + populate(objectMap, "start", i.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPool. +func (i *IPPool) UnmarshalJSON(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 "end": + err = unpopulate(val, "End", &i.End) + delete(rawMsg, key) + case "ipPoolType": + err = unpopulate(val, "IPPoolType", &i.IPPoolType) + delete(rawMsg, key) + case "info": + err = unpopulate(val, "Info", &i.Info) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &i.Start) + 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 IPPoolInfo. +func (i IPPoolInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "available", i.Available) + populate(objectMap, "used", i.Used) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPoolInfo. +func (i *IPPoolInfo) UnmarshalJSON(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 "available": + err = unpopulate(val, "Available", &i.Available) + delete(rawMsg, key) + case "used": + err = unpopulate(val, "Used", &i.Used) + 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 IPPools. +func (i IPPools) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endingAddress", i.EndingAddress) + populate(objectMap, "startingAddress", i.StartingAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPools. +func (i *IPPools) UnmarshalJSON(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 "endingAddress": + err = unpopulate(val, "EndingAddress", &i.EndingAddress) + delete(rawMsg, key) + case "startingAddress": + err = unpopulate(val, "StartingAddress", &i.StartingAddress) + 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 Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + objectMap["type"] = "SystemAssigned" + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InfrastructureNetwork. +func (i InfrastructureNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", i.DNSServers) + populate(objectMap, "gateway", i.Gateway) + populate(objectMap, "ipPools", i.IPPools) + populate(objectMap, "subnetMask", i.SubnetMask) + populate(objectMap, "useDhcp", i.UseDhcp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureNetwork. +func (i *InfrastructureNetwork) UnmarshalJSON(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 "dnsServers": + err = unpopulate(val, "DNSServers", &i.DNSServers) + delete(rawMsg, key) + case "gateway": + err = unpopulate(val, "Gateway", &i.Gateway) + delete(rawMsg, key) + case "ipPools": + err = unpopulate(val, "IPPools", &i.IPPools) + delete(rawMsg, key) + case "subnetMask": + err = unpopulate(val, "SubnetMask", &i.SubnetMask) + delete(rawMsg, key) + case "useDhcp": + err = unpopulate(val, "UseDhcp", &i.UseDhcp) + 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 InstanceViewStatus. +func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", i.Code) + populate(objectMap, "displayStatus", i.DisplayStatus) + populate(objectMap, "level", i.Level) + populate(objectMap, "message", i.Message) + populateDateTimeRFC3339(objectMap, "time", i.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatus. +func (i *InstanceViewStatus) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &i.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(val, "Time", &i.Time) + 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 Intents. +func (i Intents) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adapter", i.Adapter) + populate(objectMap, "adapterPropertyOverrides", i.AdapterPropertyOverrides) + populate(objectMap, "name", i.Name) + populate(objectMap, "overrideAdapterProperty", i.OverrideAdapterProperty) + populate(objectMap, "overrideQosPolicy", i.OverrideQosPolicy) + populate(objectMap, "overrideVirtualSwitchConfiguration", i.OverrideVirtualSwitchConfiguration) + populate(objectMap, "qosPolicyOverrides", i.QosPolicyOverrides) + populate(objectMap, "trafficType", i.TrafficType) + populate(objectMap, "virtualSwitchConfigurationOverrides", i.VirtualSwitchConfigurationOverrides) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Intents. +func (i *Intents) UnmarshalJSON(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 "adapter": + err = unpopulate(val, "Adapter", &i.Adapter) + delete(rawMsg, key) + case "adapterPropertyOverrides": + err = unpopulate(val, "AdapterPropertyOverrides", &i.AdapterPropertyOverrides) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "overrideAdapterProperty": + err = unpopulate(val, "OverrideAdapterProperty", &i.OverrideAdapterProperty) + delete(rawMsg, key) + case "overrideQosPolicy": + err = unpopulate(val, "OverrideQosPolicy", &i.OverrideQosPolicy) + delete(rawMsg, key) + case "overrideVirtualSwitchConfiguration": + err = unpopulate(val, "OverrideVirtualSwitchConfiguration", &i.OverrideVirtualSwitchConfiguration) + delete(rawMsg, key) + case "qosPolicyOverrides": + err = unpopulate(val, "QosPolicyOverrides", &i.QosPolicyOverrides) + delete(rawMsg, key) + case "trafficType": + err = unpopulate(val, "TrafficType", &i.TrafficType) + delete(rawMsg, key) + case "virtualSwitchConfigurationOverrides": + err = unpopulate(val, "VirtualSwitchConfigurationOverrides", &i.VirtualSwitchConfigurationOverrides) + 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 InterfaceDNSSettings. +func (i InterfaceDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", i.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceDNSSettings. +func (i *InterfaceDNSSettings) UnmarshalJSON(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 "dnsServers": + err = unpopulate(val, "DNSServers", &i.DNSServers) + 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 IsolatedVMAttestationConfiguration. +func (i IsolatedVMAttestationConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attestationResourceId", i.AttestationResourceID) + populate(objectMap, "attestationServiceEndpoint", i.AttestationServiceEndpoint) + populate(objectMap, "relyingPartyServiceEndpoint", i.RelyingPartyServiceEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IsolatedVMAttestationConfiguration. +func (i *IsolatedVMAttestationConfiguration) UnmarshalJSON(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 "attestationResourceId": + err = unpopulate(val, "AttestationResourceID", &i.AttestationResourceID) + delete(rawMsg, key) + case "attestationServiceEndpoint": + err = unpopulate(val, "AttestationServiceEndpoint", &i.AttestationServiceEndpoint) + delete(rawMsg, key) + case "relyingPartyServiceEndpoint": + err = unpopulate(val, "RelyingPartyServiceEndpoint", &i.RelyingPartyServiceEndpoint) + 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 LogicalNetworkProperties. +func (l LogicalNetworkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dhcpOptions", l.DhcpOptions) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "status", l.Status) + populate(objectMap, "subnets", l.Subnets) + populate(objectMap, "vmSwitchName", l.VMSwitchName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkProperties. +func (l *LogicalNetworkProperties) UnmarshalJSON(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 "dhcpOptions": + err = unpopulate(val, "DhcpOptions", &l.DhcpOptions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &l.Subnets) + delete(rawMsg, key) + case "vmSwitchName": + err = unpopulate(val, "VMSwitchName", &l.VMSwitchName) + 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 LogicalNetworkPropertiesDhcpOptions. +func (l LogicalNetworkPropertiesDhcpOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", l.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkPropertiesDhcpOptions. +func (l *LogicalNetworkPropertiesDhcpOptions) UnmarshalJSON(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 "dnsServers": + err = unpopulate(val, "DNSServers", &l.DNSServers) + 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 LogicalNetworkStatus. +func (l LogicalNetworkStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", l.ErrorCode) + populate(objectMap, "errorMessage", l.ErrorMessage) + populate(objectMap, "provisioningStatus", l.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatus. +func (l *LogicalNetworkStatus) UnmarshalJSON(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 "errorCode": + err = unpopulate(val, "ErrorCode", &l.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &l.ErrorMessage) + 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 LogicalNetworkStatusProvisioningStatus. +func (l LogicalNetworkStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", l.OperationID) + populate(objectMap, "status", l.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatusProvisioningStatus. +func (l *LogicalNetworkStatusProvisioningStatus) UnmarshalJSON(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 "operationId": + err = unpopulate(val, "OperationID", &l.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + 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 LogicalNetworks. +func (l LogicalNetworks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", l.ExtendedLocation) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworks. +func (l *LogicalNetworks) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &l.ExtendedLocation) + delete(rawMsg, 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 "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + 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 LogicalNetworksListResult. +func (l LogicalNetworksListResult) 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 LogicalNetworksListResult. +func (l *LogicalNetworksListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + 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 LogicalNetworksUpdateRequest. +func (l LogicalNetworksUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksUpdateRequest. +func (l *LogicalNetworksUpdateRequest) UnmarshalJSON(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 "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 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 MarketplaceGalleryImageProperties. +func (m MarketplaceGalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cloudInitDataSource", m.CloudInitDataSource) + populate(objectMap, "containerId", m.ContainerID) + populate(objectMap, "hyperVGeneration", m.HyperVGeneration) + populate(objectMap, "identifier", m.Identifier) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "status", m.Status) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageProperties. +func (m *MarketplaceGalleryImageProperties) UnmarshalJSON(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 "cloudInitDataSource": + err = unpopulate(val, "CloudInitDataSource", &m.CloudInitDataSource) + delete(rawMsg, key) + case "containerId": + err = unpopulate(val, "ContainerID", &m.ContainerID) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &m.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &m.Identifier) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + 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 MarketplaceGalleryImageStatus. +func (m MarketplaceGalleryImageStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadStatus", m.DownloadStatus) + populate(objectMap, "errorCode", m.ErrorCode) + populate(objectMap, "errorMessage", m.ErrorMessage) + populate(objectMap, "progressPercentage", m.ProgressPercentage) + populate(objectMap, "provisioningStatus", m.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatus. +func (m *MarketplaceGalleryImageStatus) UnmarshalJSON(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 "downloadStatus": + err = unpopulate(val, "DownloadStatus", &m.DownloadStatus) + 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 "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &m.ProgressPercentage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &m.ProvisioningStatus) + 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 MarketplaceGalleryImageStatusDownloadStatus. +func (m MarketplaceGalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadSizeInMB", m.DownloadSizeInMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. +func (m *MarketplaceGalleryImageStatusDownloadStatus) UnmarshalJSON(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 "downloadSizeInMB": + err = unpopulate(val, "DownloadSizeInMB", &m.DownloadSizeInMB) + 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 MarketplaceGalleryImageStatusProvisioningStatus. +func (m MarketplaceGalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", m.OperationID) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusProvisioningStatus. +func (m *MarketplaceGalleryImageStatusProvisioningStatus) UnmarshalJSON(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 "operationId": + err = unpopulate(val, "OperationID", &m.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + 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 MarketplaceGalleryImages. +func (m MarketplaceGalleryImages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", m.ExtendedLocation) + populate(objectMap, "id", m.ID) + 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 MarketplaceGalleryImages. +func (m *MarketplaceGalleryImages) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) + delete(rawMsg, 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 "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 MarketplaceGalleryImagesListResult. +func (m MarketplaceGalleryImagesListResult) 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 MarketplaceGalleryImagesListResult. +func (m *MarketplaceGalleryImagesListResult) UnmarshalJSON(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 MarketplaceGalleryImagesUpdateRequest. +func (m MarketplaceGalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesUpdateRequest. +func (m *MarketplaceGalleryImagesUpdateRequest) UnmarshalJSON(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 "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 NetworkInterfaceProperties. +func (n NetworkInterfaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsSettings", n.DNSSettings) + populate(objectMap, "ipConfigurations", n.IPConfigurations) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "status", n.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceProperties. +func (n *NetworkInterfaceProperties) UnmarshalJSON(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 "dnsSettings": + err = unpopulate(val, "DNSSettings", &n.DNSSettings) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &n.IPConfigurations) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &n.MacAddress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &n.Status) + 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 NetworkInterfaceStatus. +func (n NetworkInterfaceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", n.ErrorCode) + populate(objectMap, "errorMessage", n.ErrorMessage) + populate(objectMap, "provisioningStatus", n.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatus. +func (n *NetworkInterfaceStatus) UnmarshalJSON(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 "errorCode": + err = unpopulate(val, "ErrorCode", &n.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &n.ErrorMessage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &n.ProvisioningStatus) + 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 NetworkInterfaceStatusProvisioningStatus. +func (n NetworkInterfaceStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", n.OperationID) + populate(objectMap, "status", n.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatusProvisioningStatus. +func (n *NetworkInterfaceStatusProvisioningStatus) UnmarshalJSON(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 "operationId": + err = unpopulate(val, "OperationID", &n.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &n.Status) + 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 NetworkInterfaces. +func (n NetworkInterfaces) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", n.ExtendedLocation) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaces. +func (n *NetworkInterfaces) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &n.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkInterfacesListResult. +func (n NetworkInterfacesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesListResult. +func (n *NetworkInterfacesListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + 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 NetworkInterfacesUpdateRequest. +func (n NetworkInterfacesUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesUpdateRequest. +func (n *NetworkInterfacesUpdateRequest) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &n.Tags) + 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 NetworkProfileUpdate. +func (n NetworkProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileUpdate. +func (n *NetworkProfileUpdate) UnmarshalJSON(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 "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + 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 NetworkProfileUpdateNetworkInterfacesItem. +func (n NetworkProfileUpdateNetworkInterfacesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileUpdateNetworkInterfacesItem. +func (n *NetworkProfileUpdateNetworkInterfacesItem) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &n.ID) + 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 NicDetail. +func (n NicDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adapterName", n.AdapterName) + populate(objectMap, "componentId", n.ComponentID) + populate(objectMap, "dnsServers", n.DNSServers) + populate(objectMap, "defaultGateway", n.DefaultGateway) + populate(objectMap, "defaultIsolationId", n.DefaultIsolationID) + populate(objectMap, "driverVersion", n.DriverVersion) + populate(objectMap, "interfaceDescription", n.InterfaceDescription) + populate(objectMap, "ip4Address", n.Ip4Address) + populate(objectMap, "subnetMask", n.SubnetMask) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NicDetail. +func (n *NicDetail) UnmarshalJSON(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 "adapterName": + err = unpopulate(val, "AdapterName", &n.AdapterName) + delete(rawMsg, key) + case "componentId": + err = unpopulate(val, "ComponentID", &n.ComponentID) + delete(rawMsg, key) + case "dnsServers": + err = unpopulate(val, "DNSServers", &n.DNSServers) + delete(rawMsg, key) + case "defaultGateway": + err = unpopulate(val, "DefaultGateway", &n.DefaultGateway) + delete(rawMsg, key) + case "defaultIsolationId": + err = unpopulate(val, "DefaultIsolationID", &n.DefaultIsolationID) + delete(rawMsg, key) + case "driverVersion": + err = unpopulate(val, "DriverVersion", &n.DriverVersion) + delete(rawMsg, key) + case "interfaceDescription": + err = unpopulate(val, "InterfaceDescription", &n.InterfaceDescription) + delete(rawMsg, key) + case "ip4Address": + err = unpopulate(val, "Ip4Address", &n.Ip4Address) + delete(rawMsg, key) + case "subnetMask": + err = unpopulate(val, "SubnetMask", &n.SubnetMask) + 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 Observability. +func (o Observability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "episodicDataUpload", o.EpisodicDataUpload) + populate(objectMap, "euLocation", o.EuLocation) + populate(objectMap, "streamingDataClient", o.StreamingDataClient) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Observability. +func (o *Observability) UnmarshalJSON(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 "episodicDataUpload": + err = unpopulate(val, "EpisodicDataUpload", &o.EpisodicDataUpload) + delete(rawMsg, key) + case "euLocation": + err = unpopulate(val, "EuLocation", &o.EuLocation) + delete(rawMsg, key) + case "streamingDataClient": + err = unpopulate(val, "StreamingDataClient", &o.StreamingDataClient) + 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 Offer. +func (o Offer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Offer. +func (o *Offer) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + 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 OfferList. +func (o OfferList) 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 OfferList. +func (o *OfferList) UnmarshalJSON(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 OfferProperties. +func (o OfferProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", o.Content) + populate(objectMap, "contentVersion", o.ContentVersion) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "publisherId", o.PublisherID) + populate(objectMap, "skuMappings", o.SKUMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfferProperties. +func (o *OfferProperties) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &o.Content) + delete(rawMsg, key) + case "contentVersion": + err = unpopulate(val, "ContentVersion", &o.ContentVersion) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &o.PublisherID) + delete(rawMsg, key) + case "skuMappings": + err = unpopulate(val, "SKUMappings", &o.SKUMappings) + 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 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 OptionalServices. +func (o OptionalServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customLocation", o.CustomLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OptionalServices. +func (o *OptionalServices) UnmarshalJSON(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 "customLocation": + err = unpopulate(val, "CustomLocation", &o.CustomLocation) + 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 OsProfileUpdate. +func (o OsProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) + populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdate. +func (o *OsProfileUpdate) UnmarshalJSON(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 "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + 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 OsProfileUpdateLinuxConfiguration. +func (o OsProfileUpdateLinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateLinuxConfiguration. +func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(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 "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + 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 OsProfileUpdateWindowsConfiguration. +func (o OsProfileUpdateWindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateWindowsConfiguration. +func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(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 "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + 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 PackageVersionInfo. +func (p PackageVersionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastUpdated", p.LastUpdated) + populate(objectMap, "packageType", p.PackageType) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageVersionInfo. +func (p *PackageVersionInfo) UnmarshalJSON(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 "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &p.LastUpdated) + delete(rawMsg, key) + case "packageType": + err = unpopulate(val, "PackageType", &p.PackageType) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + 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 PasswordCredential. +func (p PasswordCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endDateTime", p.EndDateTime) + populate(objectMap, "keyId", p.KeyID) + populate(objectMap, "secretText", p.SecretText) + populateDateTimeRFC3339(objectMap, "startDateTime", p.StartDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PasswordCredential. +func (p *PasswordCredential) UnmarshalJSON(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 "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &p.EndDateTime) + delete(rawMsg, key) + case "keyId": + err = unpopulate(val, "KeyID", &p.KeyID) + delete(rawMsg, key) + case "secretText": + err = unpopulate(val, "SecretText", &p.SecretText) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &p.StartDateTime) + 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 PerNodeExtensionState. +func (p PerNodeExtensionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extension", p.Extension) + populate(objectMap, "instanceView", p.InstanceView) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + populate(objectMap, "typeHandlerVersion", p.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeExtensionState. +func (p *PerNodeExtensionState) UnmarshalJSON(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 "extension": + err = unpopulate(val, "Extension", &p.Extension) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &p.InstanceView) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &p.TypeHandlerVersion) + 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 PerNodeState. +func (p PerNodeState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arcInstance", p.ArcInstance) + populate(objectMap, "arcNodeServicePrincipalObjectId", p.ArcNodeServicePrincipalObjectID) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeState. +func (p *PerNodeState) UnmarshalJSON(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 "arcInstance": + err = unpopulate(val, "ArcInstance", &p.ArcInstance) + delete(rawMsg, key) + case "arcNodeServicePrincipalObjectId": + err = unpopulate(val, "ArcNodeServicePrincipalObjectID", &p.ArcNodeServicePrincipalObjectID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + 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 PhysicalNodes. +func (p PhysicalNodes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv4Address", p.IPv4Address) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalNodes. +func (p *PhysicalNodes) UnmarshalJSON(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 "ipv4Address": + err = unpopulate(val, "IPv4Address", &p.IPv4Address) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + 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 PrecheckResult. +func (p PrecheckResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalData", p.AdditionalData) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "healthCheckSource", p.HealthCheckSource) + populate(objectMap, "name", p.Name) + populate(objectMap, "remediation", p.Remediation) + populate(objectMap, "severity", p.Severity) + populate(objectMap, "status", p.Status) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "targetResourceID", p.TargetResourceID) + populate(objectMap, "targetResourceName", p.TargetResourceName) + populateDateTimeRFC3339(objectMap, "timestamp", p.Timestamp) + populate(objectMap, "title", p.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrecheckResult. +func (p *PrecheckResult) UnmarshalJSON(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 "additionalData": + err = unpopulate(val, "AdditionalData", &p.AdditionalData) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "healthCheckSource": + err = unpopulate(val, "HealthCheckSource", &p.HealthCheckSource) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "remediation": + err = unpopulate(val, "Remediation", &p.Remediation) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &p.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "targetResourceID": + err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) + delete(rawMsg, key) + case "targetResourceName": + err = unpopulate(val, "TargetResourceName", &p.TargetResourceName) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &p.Timestamp) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &p.Title) + 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 PrecheckResultTags. +func (p PrecheckResultTags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", p.Key) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrecheckResultTags. +func (p *PrecheckResultTags) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &p.Key) + 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 Publisher. +func (p Publisher) 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 Publisher. +func (p *Publisher) UnmarshalJSON(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 PublisherList. +func (p PublisherList) 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 PublisherList. +func (p *PublisherList) UnmarshalJSON(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 PublisherProperties. +func (p PublisherProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherProperties. +func (p *PublisherProperties) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QosPolicyOverrides. +func (q QosPolicyOverrides) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bandwidthPercentage_SMB", q.BandwidthPercentageSMB) + populate(objectMap, "priorityValue8021Action_Cluster", q.PriorityValue8021ActionCluster) + populate(objectMap, "priorityValue8021Action_SMB", q.PriorityValue8021ActionSMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QosPolicyOverrides. +func (q *QosPolicyOverrides) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "bandwidthPercentage_SMB": + err = unpopulate(val, "BandwidthPercentageSMB", &q.BandwidthPercentageSMB) + delete(rawMsg, key) + case "priorityValue8021Action_Cluster": + err = unpopulate(val, "PriorityValue8021ActionCluster", &q.PriorityValue8021ActionCluster) + delete(rawMsg, key) + case "priorityValue8021Action_SMB": + err = unpopulate(val, "PriorityValue8021ActionSMB", &q.PriorityValue8021ActionSMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RawCertificateData. +func (r RawCertificateData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificates", r.Certificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RawCertificateData. +func (r *RawCertificateData) UnmarshalJSON(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 "certificates": + err = unpopulate(val, "Certificates", &r.Certificates) + 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 ReportedProperties. +func (r ReportedProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentStatus", r.DeploymentStatus) + populate(objectMap, "validationStatus", r.ValidationStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportedProperties. +func (r *ReportedProperties) UnmarshalJSON(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 "deploymentStatus": + err = unpopulate(val, "DeploymentStatus", &r.DeploymentStatus) + delete(rawMsg, key) + case "validationStatus": + err = unpopulate(val, "ValidationStatus", &r.ValidationStatus) + 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 Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Route. +func (r *Route) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + 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 RoutePropertiesFormat. +func (r RoutePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", r.AddressPrefix) + populate(objectMap, "nextHopIpAddress", r.NextHopIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutePropertiesFormat. +func (r *RoutePropertiesFormat) UnmarshalJSON(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 "addressPrefix": + err = unpopulate(val, "AddressPrefix", &r.AddressPrefix) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &r.NextHopIPAddress) + 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 RouteTable. +func (r RouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTable. +func (r *RouteTable) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + 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 RouteTablePropertiesFormat. +func (r RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "routes", r.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTablePropertiesFormat. +func (r *RouteTablePropertiesFormat) UnmarshalJSON(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 "routes": + err = unpopulate(val, "Routes", &r.Routes) + 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 SKU. +func (s SKU) 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 SKU. +func (s *SKU) UnmarshalJSON(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 SKUList. +func (s SKUList) 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 SKUList. +func (s *SKUList) UnmarshalJSON(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 SKUMappings. +func (s SKUMappings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "catalogPlanId", s.CatalogPlanID) + populate(objectMap, "marketplaceSkuId", s.MarketplaceSKUID) + populate(objectMap, "marketplaceSkuVersions", s.MarketplaceSKUVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUMappings. +func (s *SKUMappings) UnmarshalJSON(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 "catalogPlanId": + err = unpopulate(val, "CatalogPlanID", &s.CatalogPlanID) + delete(rawMsg, key) + case "marketplaceSkuId": + err = unpopulate(val, "MarketplaceSKUID", &s.MarketplaceSKUID) + delete(rawMsg, key) + case "marketplaceSkuVersions": + err = unpopulate(val, "MarketplaceSKUVersions", &s.MarketplaceSKUVersions) + 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 SKUProperties. +func (s SKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", s.Content) + populate(objectMap, "contentVersion", s.ContentVersion) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publisherId", s.PublisherID) + populate(objectMap, "skuMappings", s.SKUMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUProperties. +func (s *SKUProperties) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "contentVersion": + err = unpopulate(val, "ContentVersion", &s.ContentVersion) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &s.OfferID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &s.PublisherID) + delete(rawMsg, key) + case "skuMappings": + err = unpopulate(val, "SKUMappings", &s.SKUMappings) + 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 SSHConfiguration. +func (s SSHConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicKeys", s.PublicKeys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConfiguration. +func (s *SSHConfiguration) UnmarshalJSON(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 "publicKeys": + err = unpopulate(val, "PublicKeys", &s.PublicKeys) + 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 SSHPublicKey. +func (s SSHPublicKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyData", s.KeyData) + populate(objectMap, "path", s.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKey. +func (s *SSHPublicKey) UnmarshalJSON(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 "keyData": + err = unpopulate(val, "KeyData", &s.KeyData) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &s.Path) + 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 ScaleUnits. +func (s ScaleUnits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentData", s.DeploymentData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleUnits. +func (s *ScaleUnits) UnmarshalJSON(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 "deploymentData": + err = unpopulate(val, "DeploymentData", &s.DeploymentData) + 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 SecurityComplianceStatus. +func (s SecurityComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataAtRestEncrypted", s.DataAtRestEncrypted) + populate(objectMap, "dataInTransitProtected", s.DataInTransitProtected) + populateDateTimeRFC3339(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "securedCoreCompliance", s.SecuredCoreCompliance) + populate(objectMap, "wdacCompliance", s.WdacCompliance) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityComplianceStatus. +func (s *SecurityComplianceStatus) UnmarshalJSON(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 "dataAtRestEncrypted": + err = unpopulate(val, "DataAtRestEncrypted", &s.DataAtRestEncrypted) + delete(rawMsg, key) + case "dataInTransitProtected": + err = unpopulate(val, "DataInTransitProtected", &s.DataInTransitProtected) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &s.LastUpdated) + delete(rawMsg, key) + case "securedCoreCompliance": + err = unpopulate(val, "SecuredCoreCompliance", &s.SecuredCoreCompliance) + delete(rawMsg, key) + case "wdacCompliance": + err = unpopulate(val, "WdacCompliance", &s.WdacCompliance) + 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 SecurityProperties. +func (s SecurityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "securedCoreComplianceAssignment", s.SecuredCoreComplianceAssignment) + populate(objectMap, "securityComplianceStatus", s.SecurityComplianceStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityProperties. +func (s *SecurityProperties) UnmarshalJSON(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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "securedCoreComplianceAssignment": + err = unpopulate(val, "SecuredCoreComplianceAssignment", &s.SecuredCoreComplianceAssignment) + delete(rawMsg, key) + case "securityComplianceStatus": + err = unpopulate(val, "SecurityComplianceStatus", &s.SecurityComplianceStatus) + 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 SecuritySetting. +func (s SecuritySetting) 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 SecuritySetting. +func (s *SecuritySetting) UnmarshalJSON(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", &m.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &m.Properties) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &m.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImagesListResult. -func (m MarketplaceGalleryImagesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecuritySettingListResult. +func (s SecuritySettingListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesListResult. -func (m *MarketplaceGalleryImagesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySettingListResult. +func (s *SecuritySettingListResult) UnmarshalJSON(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) + 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", &m.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &m.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImagesUpdateRequest. -func (m MarketplaceGalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceChangeRequest. +func (s SoftwareAssuranceChangeRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", m.Tags) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesUpdateRequest. -func (m *MarketplaceGalleryImagesUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceChangeRequest. +func (s *SoftwareAssuranceChangeRequest) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &m.Tags) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceProperties. -func (n NetworkInterfaceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceChangeRequestProperties. +func (s SoftwareAssuranceChangeRequestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsSettings", n.DNSSettings) - populate(objectMap, "ipConfigurations", n.IPConfigurations) - populate(objectMap, "macAddress", n.MacAddress) - populate(objectMap, "provisioningState", n.ProvisioningState) - populate(objectMap, "status", n.Status) + populate(objectMap, "softwareAssuranceIntent", s.SoftwareAssuranceIntent) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceProperties. -func (n *NetworkInterfaceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceChangeRequestProperties. +func (s *SoftwareAssuranceChangeRequestProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "dnsSettings": - err = unpopulate(val, "DNSSettings", &n.DNSSettings) + case "softwareAssuranceIntent": + err = unpopulate(val, "SoftwareAssuranceIntent", &s.SoftwareAssuranceIntent) delete(rawMsg, key) - case "ipConfigurations": - err = unpopulate(val, "IPConfigurations", &n.IPConfigurations) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceProperties. +func (s SoftwareAssuranceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "softwareAssuranceIntent", s.SoftwareAssuranceIntent) + populate(objectMap, "softwareAssuranceStatus", s.SoftwareAssuranceStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceProperties. +func (s *SoftwareAssuranceProperties) UnmarshalJSON(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 "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &s.LastUpdated) delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &n.MacAddress) + case "softwareAssuranceIntent": + err = unpopulate(val, "SoftwareAssuranceIntent", &s.SoftwareAssuranceIntent) + delete(rawMsg, key) + case "softwareAssuranceStatus": + err = unpopulate(val, "SoftwareAssuranceStatus", &s.SoftwareAssuranceStatus) + 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 Step. +func (s Step) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populateDateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + populate(objectMap, "errorMessage", s.ErrorMessage) + populateDateTimeRFC3339(objectMap, "lastUpdatedTimeUtc", s.LastUpdatedTimeUTC) + populate(objectMap, "name", s.Name) + populateDateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populate(objectMap, "status", s.Status) + populate(objectMap, "steps", s.Steps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Step. +func (s *Step) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + delete(rawMsg, key) + case "lastUpdatedTimeUtc": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimeUTC", &s.LastUpdatedTimeUTC) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateDateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "steps": + err = unpopulate(val, "Steps", &s.Steps) + 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 Storage. +func (s Storage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configurationMode", s.ConfigurationMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Storage. +func (s *Storage) UnmarshalJSON(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 "configurationMode": + err = unpopulate(val, "ConfigurationMode", &s.ConfigurationMode) + 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 StorageContainerProperties. +func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "path", s.Path) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "path": + err = unpopulate(val, "Path", &s.Path) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &n.Status) + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceStatus. -func (n NetworkInterfaceStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatus. +func (s StorageContainerStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", n.ErrorCode) - populate(objectMap, "errorMessage", n.ErrorMessage) - populate(objectMap, "provisioningStatus", n.ProvisioningStatus) + populate(objectMap, "availableSizeMB", s.AvailableSizeMB) + populate(objectMap, "containerSizeMB", s.ContainerSizeMB) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "errorMessage", s.ErrorMessage) + populate(objectMap, "provisioningStatus", s.ProvisioningStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatus. -func (n *NetworkInterfaceStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatus. +func (s *StorageContainerStatus) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { + case "availableSizeMB": + err = unpopulate(val, "AvailableSizeMB", &s.AvailableSizeMB) + delete(rawMsg, key) + case "containerSizeMB": + err = unpopulate(val, "ContainerSizeMB", &s.ContainerSizeMB) + delete(rawMsg, key) case "errorCode": - err = unpopulate(val, "ErrorCode", &n.ErrorCode) + err = unpopulate(val, "ErrorCode", &s.ErrorCode) delete(rawMsg, key) case "errorMessage": - err = unpopulate(val, "ErrorMessage", &n.ErrorMessage) + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) delete(rawMsg, key) case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &n.ProvisioningStatus) + err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceStatusProvisioningStatus. -func (n NetworkInterfaceStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatusProvisioningStatus. +func (s StorageContainerStatusProvisioningStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", n.OperationID) - populate(objectMap, "status", n.Status) + populate(objectMap, "operationId", s.OperationID) + populate(objectMap, "status", s.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatusProvisioningStatus. -func (n *NetworkInterfaceStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatusProvisioningStatus. +func (s *StorageContainerStatusProvisioningStatus) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "operationId": - err = unpopulate(val, "OperationID", &n.OperationID) + err = unpopulate(val, "OperationID", &s.OperationID) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &n.Status) + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaces. -func (n NetworkInterfaces) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainers. +func (s StorageContainers) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", n.ExtendedLocation) - populate(objectMap, "id", n.ID) - populate(objectMap, "location", n.Location) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "systemData", n.SystemData) - populate(objectMap, "tags", n.Tags) - populate(objectMap, "type", n.Type) + populate(objectMap, "extendedLocation", s.ExtendedLocation) + populate(objectMap, "id", s.ID) + 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 NetworkInterfaces. -func (n *NetworkInterfaces) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainers. +func (s *StorageContainers) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &n.ExtendedLocation) + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &n.ID) + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &n.Location) + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &n.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &n.Properties) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &n.Tags) + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &n.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfacesListResult. -func (n NetworkInterfacesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainersListResult. +func (s StorageContainersListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesListResult. -func (n *NetworkInterfacesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersListResult. +func (s *StorageContainersListResult) UnmarshalJSON(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) + 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", &n.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &n.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfacesUpdateRequest. -func (n NetworkInterfacesUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainersUpdateRequest. +func (s StorageContainersUpdateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", n.Tags) + populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesUpdateRequest. -func (n *NetworkInterfacesUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersUpdateRequest. +func (s *StorageContainersUpdateRequest) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "tags": - err = unpopulate(val, "Tags", &n.Tags) - 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 NetworkProfileUpdate. -func (n NetworkProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "networkInterfaces", n.NetworkInterfaces) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileUpdate. -func (n *NetworkProfileUpdate) UnmarshalJSON(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 "networkInterfaces": - err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) - 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 NetworkProfileUpdateNetworkInterfacesItem. -func (n NetworkProfileUpdateNetworkInterfacesItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileUpdateNetworkInterfacesItem. -func (n *NetworkProfileUpdateNetworkInterfacesItem) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &n.ID) + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } 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 StorageNetworks. +func (s StorageNetworks) 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) + populate(objectMap, "name", s.Name) + populate(objectMap, "networkAdapterName", s.NetworkAdapterName) + populate(objectMap, "vlanId", s.VlanID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageNetworks. +func (s *StorageNetworks) UnmarshalJSON(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", s, 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) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "networkAdapterName": + err = unpopulate(val, "NetworkAdapterName", &s.NetworkAdapterName) + delete(rawMsg, key) + case "vlanId": + err = unpopulate(val, "VlanID", &s.VlanID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdate. +func (s StorageProfileUpdate) 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) + populate(objectMap, "dataDisks", s.DataDisks) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdate. +func (s *StorageProfileUpdate) UnmarshalJSON(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", s, 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) + case "dataDisks": + err = unpopulate(val, "DataDisks", &s.DataDisks) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdateDataDisksItem. +func (s StorageProfileUpdateDataDisksItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "id", s.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdateDataDisksItem. +func (s *StorageProfileUpdateDataDisksItem) UnmarshalJSON(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", s, 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) + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdate. -func (o OsProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "computerName", o.ComputerName) - populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) - populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdate. -func (o *OsProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. +func (s *Subnet) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "computerName": - err = unpopulate(val, "ComputerName", &o.ComputerName) - delete(rawMsg, key) - case "linuxConfiguration": - err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "windowsConfiguration": - err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateLinuxConfiguration. -func (o OsProfileUpdateLinuxConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormat. +func (s SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) - populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + populate(objectMap, "addressPrefix", s.AddressPrefix) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "ipAllocationMethod", s.IPAllocationMethod) + populate(objectMap, "ipConfigurationReferences", s.IPConfigurationReferences) + populate(objectMap, "ipPools", s.IPPools) + populate(objectMap, "routeTable", s.RouteTable) + populate(objectMap, "vlan", s.Vlan) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateLinuxConfiguration. -func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormat. +func (s *SubnetPropertiesFormat) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "provisionVMAgent": - err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) delete(rawMsg, key) - case "provisionVMConfigAgent": - err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) + delete(rawMsg, key) + case "ipAllocationMethod": + err = unpopulate(val, "IPAllocationMethod", &s.IPAllocationMethod) + delete(rawMsg, key) + case "ipConfigurationReferences": + err = unpopulate(val, "IPConfigurationReferences", &s.IPConfigurationReferences) + delete(rawMsg, key) + case "ipPools": + err = unpopulate(val, "IPPools", &s.IPPools) + delete(rawMsg, key) + case "routeTable": + err = unpopulate(val, "RouteTable", &s.RouteTable) + delete(rawMsg, key) + case "vlan": + err = unpopulate(val, "Vlan", &s.Vlan) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateWindowsConfiguration. -func (o OsProfileUpdateWindowsConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. +func (s SubnetPropertiesFormatIPConfigurationReferencesItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) - populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + populate(objectMap, "ID", s.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateWindowsConfiguration. -func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. +func (s *SubnetPropertiesFormatIPConfigurationReferencesItem) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "provisionVMAgent": - err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) - delete(rawMsg, key) - case "provisionVMConfigAgent": - err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + case "ID": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Route. -func (r Route) 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, "name", r.Name) - populate(objectMap, "properties", r.Properties) + 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 Route. -func (r *Route) 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", r, err) + 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", &r.Name) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoutePropertiesFormat. -func (r RoutePropertiesFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "addressPrefix", r.AddressPrefix) - populate(objectMap, "nextHopIpAddress", r.NextHopIPAddress) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoutePropertiesFormat. -func (r *RoutePropertiesFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "addressPrefix": - err = unpopulate(val, "AddressPrefix", &r.AddressPrefix) + case "id": + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) - case "nextHopIpAddress": - err = unpopulate(val, "NextHopIPAddress", &r.NextHopIPAddress) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RouteTable. -func (r RouteTable) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateList. +func (u UpdateList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", r.Etag) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTable. -func (r *RouteTable) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateList. +func (u *UpdateList) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &r.Etag) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "value": + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RouteTablePropertiesFormat. -func (r RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdatePrerequisite. +func (u UpdatePrerequisite) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "routes", r.Routes) + populate(objectMap, "packageName", u.PackageName) + populate(objectMap, "updateType", u.UpdateType) + populate(objectMap, "version", u.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTablePropertiesFormat. -func (r *RouteTablePropertiesFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdatePrerequisite. +func (u *UpdatePrerequisite) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "routes": - err = unpopulate(val, "Routes", &r.Routes) + case "packageName": + err = unpopulate(val, "PackageName", &u.PackageName) + delete(rawMsg, key) + case "updateType": + err = unpopulate(val, "UpdateType", &u.UpdateType) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SSHConfiguration. -func (s SSHConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateProperties. +func (u UpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "publicKeys", s.PublicKeys) + populate(objectMap, "additionalProperties", u.AdditionalProperties) + populate(objectMap, "availabilityType", u.AvailabilityType) + populate(objectMap, "componentVersions", u.ComponentVersions) + populate(objectMap, "description", u.Description) + populate(objectMap, "displayName", u.DisplayName) + populateDateTimeRFC3339(objectMap, "healthCheckDate", u.HealthCheckDate) + populate(objectMap, "healthCheckResult", u.HealthCheckResult) + populate(objectMap, "healthState", u.HealthState) + populateDateTimeRFC3339(objectMap, "installedDate", u.InstalledDate) + populate(objectMap, "packagePath", u.PackagePath) + populate(objectMap, "packageSizeInMb", u.PackageSizeInMb) + populate(objectMap, "packageType", u.PackageType) + populate(objectMap, "prerequisites", u.Prerequisites) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "publisher", u.Publisher) + populate(objectMap, "rebootRequired", u.RebootRequired) + populate(objectMap, "releaseLink", u.ReleaseLink) + populate(objectMap, "state", u.State) + populate(objectMap, "updateStateProperties", u.UpdateStateProperties) + populate(objectMap, "version", u.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConfiguration. -func (s *SSHConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties. +func (u *UpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "publicKeys": - err = unpopulate(val, "PublicKeys", &s.PublicKeys) + case "additionalProperties": + err = unpopulate(val, "AdditionalProperties", &u.AdditionalProperties) + delete(rawMsg, key) + case "availabilityType": + err = unpopulate(val, "AvailabilityType", &u.AvailabilityType) + delete(rawMsg, key) + case "componentVersions": + err = unpopulate(val, "ComponentVersions", &u.ComponentVersions) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &u.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &u.DisplayName) + delete(rawMsg, key) + case "healthCheckDate": + err = unpopulateDateTimeRFC3339(val, "HealthCheckDate", &u.HealthCheckDate) + delete(rawMsg, key) + case "healthCheckResult": + err = unpopulate(val, "HealthCheckResult", &u.HealthCheckResult) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &u.HealthState) + delete(rawMsg, key) + case "installedDate": + err = unpopulateDateTimeRFC3339(val, "InstalledDate", &u.InstalledDate) + delete(rawMsg, key) + case "packagePath": + err = unpopulate(val, "PackagePath", &u.PackagePath) + delete(rawMsg, key) + case "packageSizeInMb": + err = unpopulate(val, "PackageSizeInMb", &u.PackageSizeInMb) + delete(rawMsg, key) + case "packageType": + err = unpopulate(val, "PackageType", &u.PackageType) + delete(rawMsg, key) + case "prerequisites": + err = unpopulate(val, "Prerequisites", &u.Prerequisites) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &u.Publisher) + delete(rawMsg, key) + case "rebootRequired": + err = unpopulate(val, "RebootRequired", &u.RebootRequired) + delete(rawMsg, key) + case "releaseLink": + err = unpopulate(val, "ReleaseLink", &u.ReleaseLink) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + case "updateStateProperties": + err = unpopulate(val, "UpdateStateProperties", &u.UpdateStateProperties) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SSHPublicKey. -func (s SSHPublicKey) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateRun. +func (u UpdateRun) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyData", s.KeyData) - populate(objectMap, "path", s.Path) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKey. -func (s *SSHPublicKey) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRun. +func (u *UpdateRun) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "keyData": - err = unpopulate(val, "KeyData", &s.KeyData) + case "id": + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &s.Path) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, 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 UpdateRunList. +func (u UpdateRunList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "path", s.Path) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "status", s.Status) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) 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 UpdateRunList. +func (u *UpdateRunList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "path": - err = unpopulate(val, "Path", &s.Path) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "value": + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatus. -func (s StorageContainerStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateRunProperties. +func (u UpdateRunProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "availableSizeMB", s.AvailableSizeMB) - populate(objectMap, "containerSizeMB", s.ContainerSizeMB) - populate(objectMap, "errorCode", s.ErrorCode) - populate(objectMap, "errorMessage", s.ErrorMessage) - populate(objectMap, "provisioningStatus", s.ProvisioningStatus) + populate(objectMap, "duration", u.Duration) + populateDateTimeRFC3339(objectMap, "lastUpdatedTime", u.LastUpdatedTime) + populate(objectMap, "progress", u.Progress) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "state", u.State) + populateDateTimeRFC3339(objectMap, "timeStarted", u.TimeStarted) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatus. -func (s *StorageContainerStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRunProperties. +func (u *UpdateRunProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "availableSizeMB": - err = unpopulate(val, "AvailableSizeMB", &s.AvailableSizeMB) + case "duration": + err = unpopulate(val, "Duration", &u.Duration) delete(rawMsg, key) - case "containerSizeMB": - err = unpopulate(val, "ContainerSizeMB", &s.ContainerSizeMB) + case "lastUpdatedTime": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &u.LastUpdatedTime) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) + case "progress": + err = unpopulate(val, "Progress", &u.Progress) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + case "timeStarted": + err = unpopulateDateTimeRFC3339(val, "TimeStarted", &u.TimeStarted) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatusProvisioningStatus. -func (s StorageContainerStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateStateProperties. +func (u UpdateStateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", s.OperationID) - populate(objectMap, "status", s.Status) + populate(objectMap, "notifyMessage", u.NotifyMessage) + populate(objectMap, "progressPercentage", u.ProgressPercentage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatusProvisioningStatus. -func (s *StorageContainerStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateStateProperties. +func (u *UpdateStateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "operationId": - err = unpopulate(val, "OperationID", &s.OperationID) + case "notifyMessage": + err = unpopulate(val, "NotifyMessage", &u.NotifyMessage) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &u.ProgressPercentage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainers. -func (s StorageContainers) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSummaries. +func (u UpdateSummaries) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", s.ExtendedLocation) - populate(objectMap, "id", s.ID) - 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) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainers. -func (s *StorageContainers) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummaries. +func (u *UpdateSummaries) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &s.ID) + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &s.Location) + err = unpopulate(val, "Location", &u.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &s.Name) + err = unpopulate(val, "Name", &u.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &s.Properties) + err = unpopulate(val, "Properties", &u.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + err = unpopulate(val, "SystemData", &u.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &s.Type) + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainersListResult. -func (s StorageContainersListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSummariesList. +func (u UpdateSummariesList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersListResult. -func (s *StorageContainersListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummariesList. +func (u *UpdateSummariesList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &s.Value) + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainersUpdateRequest. -func (s StorageContainersUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSummariesProperties. +func (u UpdateSummariesProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", s.Tags) + populate(objectMap, "currentVersion", u.CurrentVersion) + populate(objectMap, "hardwareModel", u.HardwareModel) + populateDateTimeRFC3339(objectMap, "healthCheckDate", u.HealthCheckDate) + populate(objectMap, "healthCheckResult", u.HealthCheckResult) + populate(objectMap, "healthState", u.HealthState) + populateDateTimeRFC3339(objectMap, "lastChecked", u.LastChecked) + populateDateTimeRFC3339(objectMap, "lastUpdated", u.LastUpdated) + populate(objectMap, "oemFamily", u.OemFamily) + populate(objectMap, "packageVersions", u.PackageVersions) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "state", u.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersUpdateRequest. -func (s *StorageContainersUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummariesProperties. +func (u *UpdateSummariesProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &u.CurrentVersion) 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 StorageProfileUpdate. -func (s StorageProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataDisks", s.DataDisks) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdate. -func (s *StorageProfileUpdate) UnmarshalJSON(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 "dataDisks": - err = unpopulate(val, "DataDisks", &s.DataDisks) + case "hardwareModel": + err = unpopulate(val, "HardwareModel", &u.HardwareModel) + delete(rawMsg, key) + case "healthCheckDate": + err = unpopulateDateTimeRFC3339(val, "HealthCheckDate", &u.HealthCheckDate) + delete(rawMsg, key) + case "healthCheckResult": + err = unpopulate(val, "HealthCheckResult", &u.HealthCheckResult) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &u.HealthState) + delete(rawMsg, key) + case "lastChecked": + err = unpopulateDateTimeRFC3339(val, "LastChecked", &u.LastChecked) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &u.LastUpdated) + delete(rawMsg, key) + case "oemFamily": + err = unpopulate(val, "OemFamily", &u.OemFamily) + delete(rawMsg, key) + case "packageVersions": + err = unpopulate(val, "PackageVersions", &u.PackageVersions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdateDataDisksItem. -func (s StorageProfileUpdateDataDisksItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UploadCertificateRequest. +func (u UploadCertificateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) + populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdateDataDisksItem. -func (s *StorageProfileUpdateDataDisksItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UploadCertificateRequest. +func (u *UploadCertificateRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Subnet. -func (s Subnet) 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", s.Name) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. -func (s *Subnet) 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", s, 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", &s.Name) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormat. -func (s SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ValidateRequest. +func (v ValidateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "addressPrefix", s.AddressPrefix) - populate(objectMap, "addressPrefixes", s.AddressPrefixes) - populate(objectMap, "ipAllocationMethod", s.IPAllocationMethod) - populate(objectMap, "ipConfigurationReferences", s.IPConfigurationReferences) - populate(objectMap, "ipPools", s.IPPools) - populate(objectMap, "routeTable", s.RouteTable) - populate(objectMap, "vlan", s.Vlan) + populate(objectMap, "additionalInfo", v.AdditionalInfo) + populate(objectMap, "edgeDeviceIds", v.EdgeDeviceIDs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormat. -func (s *SubnetPropertiesFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRequest. +func (v *ValidateRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "addressPrefix": - err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) - delete(rawMsg, key) - case "addressPrefixes": - err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) - delete(rawMsg, key) - case "ipAllocationMethod": - err = unpopulate(val, "IPAllocationMethod", &s.IPAllocationMethod) - delete(rawMsg, key) - case "ipConfigurationReferences": - err = unpopulate(val, "IPConfigurationReferences", &s.IPConfigurationReferences) - delete(rawMsg, key) - case "ipPools": - err = unpopulate(val, "IPPools", &s.IPPools) - delete(rawMsg, key) - case "routeTable": - err = unpopulate(val, "RouteTable", &s.RouteTable) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &v.AdditionalInfo) delete(rawMsg, key) - case "vlan": - err = unpopulate(val, "Vlan", &s.Vlan) + case "edgeDeviceIds": + err = unpopulate(val, "EdgeDeviceIDs", &v.EdgeDeviceIDs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. -func (s SubnetPropertiesFormatIPConfigurationReferencesItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ValidateResponse. +func (v ValidateResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ID", s.ID) + populate(objectMap, "status", v.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. -func (s *SubnetPropertiesFormatIPConfigurationReferencesItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateResponse. +func (v *ValidateResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "ID": - err = unpopulate(val, "ID", &s.ID) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ValidationStatus. +func (v ValidationStatus) 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) + populate(objectMap, "status", v.Status) + populate(objectMap, "steps", v.Steps) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationStatus. +func (v *ValidationStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, 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) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + case "steps": + err = unpopulate(val, "Steps", &v.Steps) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil @@ -3844,6 +7778,37 @@ func (v *VirtualMachineInstanceView) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VirtualSwitchConfigurationOverrides. +func (v VirtualSwitchConfigurationOverrides) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableIov", v.EnableIov) + populate(objectMap, "loadBalancingAlgorithm", v.LoadBalancingAlgorithm) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualSwitchConfigurationOverrides. +func (v *VirtualSwitchConfigurationOverrides) UnmarshalJSON(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 "enableIov": + err = unpopulate(val, "EnableIov", &v.EnableIov) + delete(rawMsg, key) + case "loadBalancingAlgorithm": + err = unpopulate(val, "LoadBalancingAlgorithm", &v.LoadBalancingAlgorithm) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return @@ -3865,7 +7830,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/azurestackhci/armazurestackhci/networkinterfaces_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go index 084ffc2e04b3..f1b16b4e6496 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go @@ -47,7 +47,7 @@ func NewNetworkInterfacesClient(subscriptionID string, credential azcore.TokenCr // during network interface creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkInterfaceName - Name of the network interface // - options - NetworkInterfacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkInterfacesClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *NetworkInterfacesClient) BeginCreateOrUpdate(ctx context.Context, // network interface creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *NetworkInterfacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfaces, options *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkInterfacesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *NetworkInterfacesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, networkInterfaces); err != nil { @@ -128,7 +128,7 @@ func (client *NetworkInterfacesClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkInterfaceName - Name of the network interface // - options - NetworkInterfacesClientBeginDeleteOptions contains the optional parameters for the NetworkInterfacesClient.BeginDelete @@ -154,7 +154,7 @@ func (client *NetworkInterfacesClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *NetworkInterfacesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "NetworkInterfacesClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *NetworkInterfacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *NetworkInterfacesClient) deleteCreateRequest(ctx context.Context, // Get - Gets a network interface // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkInterfaceName - Name of the network interface // - options - NetworkInterfacesClientGetOptions contains the optional parameters for the NetworkInterfacesClient.Get method. @@ -251,7 +251,7 @@ func (client *NetworkInterfacesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *NetworkInterfacesClient) getHandleResponse(resp *http.Response) (N // NewListPager - Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response // to get the next page of network interfaces. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - NetworkInterfacesClientListOptions contains the optional parameters for the NetworkInterfacesClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *NetworkInterfacesClient) listHandleResponse(resp *http.Response) ( // NewListAllPager - Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response // to get the next page of network interfaces. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - NetworkInterfacesClientListAllOptions contains the optional parameters for the NetworkInterfacesClient.NewListAllPager // method. func (client *NetworkInterfacesClient) NewListAllPager(options *NetworkInterfacesClientListAllOptions) *runtime.Pager[NetworkInterfacesClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *NetworkInterfacesClient) listAllHandleResponse(resp *http.Response // BeginUpdate - The operation to update a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkInterfaceName - Name of the network interface // - options - NetworkInterfacesClientBeginUpdateOptions contains the optional parameters for the NetworkInterfacesClient.BeginUpdate @@ -412,7 +412,7 @@ func (client *NetworkInterfacesClient) BeginUpdate(ctx context.Context, resource // Update - The operation to update a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *NetworkInterfacesClient) update(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfacesUpdateRequest, options *NetworkInterfacesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkInterfacesClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *NetworkInterfacesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, networkInterfaces); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go deleted file mode 100644 index e22143d50040..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go +++ /dev/null @@ -1,295 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetNetworkInterface.json -func ExampleNetworkInterfacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkInterfacesClient().Get(ctx, "test-rg", "test-nic", 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.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("external"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutNetworkInterface.json -func ExampleNetworkInterfacesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkInterfacesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-nic", armazurestackhci.NetworkInterfaces{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.NetworkInterfaceProperties{ - IPConfigurations: []*armazurestackhci.IPConfiguration{ - { - Name: to.Ptr("ipconfig-sample"), - Properties: &armazurestackhci.IPConfigurationProperties{ - Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - ID: to.Ptr("test-lnet"), - }, - }, - }}, - }, - }, 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.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("test-lnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteNetworkInterface.json -func ExampleNetworkInterfacesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkInterfacesClient().BeginDelete(ctx, "test-rg", "test-nic", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateNetworkInterface.json -func ExampleNetworkInterfacesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkInterfacesClient().BeginUpdate(ctx, "test-rg", "test-nic", armazurestackhci.NetworkInterfacesUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, 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.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("test-lnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListNetworkInterfaceByResourceGroup.json -func ExampleNetworkInterfacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkInterfacesClient().NewListPager("test-rg", 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.NetworkInterfacesListResult = armazurestackhci.NetworkInterfacesListResult{ - // Value: []*armazurestackhci.NetworkInterfaces{ - // { - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("external"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListNetworkInterfaceBySubscription.json -func ExampleNetworkInterfacesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkInterfacesClient().NewListAllPager(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.NetworkInterfacesListResult = armazurestackhci.NetworkInterfacesListResult{ - // Value: []*armazurestackhci.NetworkInterfaces{ - // { - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("external"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go new file mode 100644 index 000000000000..b7f25dc493dc --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go @@ -0,0 +1,262 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// OffersClient contains the methods for the Offers group. +// Don't use this type directly, use NewOffersClient() instead. +type OffersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOffersClient creates a new instance of OffersClient 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 NewOffersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OffersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OffersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get Offer resource details within a publisher of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - offerName - The name of the offer available within HCI cluster. +// - options - OffersClientGetOptions contains the optional parameters for the OffersClient.Get method. +func (client *OffersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *OffersClientGetOptions) (OffersClientGetResponse, error) { + var err error + const operationName = "OffersClient.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, clusterName, publisherName, offerName, options) + if err != nil { + return OffersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OffersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OffersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OffersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *OffersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + 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.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OffersClient) getHandleResponse(resp *http.Response) (OffersClientGetResponse, error) { + result := OffersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Offer); err != nil { + return OffersClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List Offers available across publishers for the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - OffersClientListByClusterOptions contains the optional parameters for the OffersClient.NewListByClusterPager +// method. +func (client *OffersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *OffersClientListByClusterOptions) *runtime.Pager[OffersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[OffersClientListByClusterResponse]{ + More: func(page OffersClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OffersClientListByClusterResponse) (OffersClientListByClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OffersClient.NewListByClusterPager") + 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.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return OffersClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *OffersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *OffersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/offers" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *OffersClient) listByClusterHandleResponse(resp *http.Response) (OffersClientListByClusterResponse, error) { + result := OffersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OfferList); err != nil { + return OffersClientListByClusterResponse{}, err + } + return result, nil +} + +// NewListByPublisherPager - List Offers available for a publisher within the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - options - OffersClientListByPublisherOptions contains the optional parameters for the OffersClient.NewListByPublisherPager +// method. +func (client *OffersClient) NewListByPublisherPager(resourceGroupName string, clusterName string, publisherName string, options *OffersClientListByPublisherOptions) *runtime.Pager[OffersClientListByPublisherResponse] { + return runtime.NewPager(runtime.PagingHandler[OffersClientListByPublisherResponse]{ + More: func(page OffersClientListByPublisherResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OffersClientListByPublisherResponse) (OffersClientListByPublisherResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OffersClient.NewListByPublisherPager") + 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.listByPublisherCreateRequest(ctx, resourceGroupName, clusterName, publisherName, options) + }, nil) + if err != nil { + return OffersClientListByPublisherResponse{}, err + } + return client.listByPublisherHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByPublisherCreateRequest creates the ListByPublisher request. +func (client *OffersClient) listByPublisherCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *OffersClientListByPublisherOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + 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.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByPublisherHandleResponse handles the ListByPublisher response. +func (client *OffersClient) listByPublisherHandleResponse(resp *http.Response) (OffersClientListByPublisherResponse, error) { + result := OffersClientListByPublisherResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OfferList); err != nil { + return OffersClientListByPublisherResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go index cd54cd2ac9f4..63b6e4c923d3 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go @@ -37,31 +37,31 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List all the supported operations. +// List - List all available Microsoft.AzureStackHCI provider operations +// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-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(), - }) +// Generated from API version 2024-01-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 } // listCreateRequest creates the List request. @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go deleted file mode 100644 index a29fb22b8856..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go +++ /dev/null @@ -1,57 +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 armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListOperations.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 := armazurestackhci.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 = armazurestackhci.OperationListResult{ - // Value: []*armazurestackhci.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/galleryImages/read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("List or get the Addresses"), - // Operation: to.Ptr("List or Get Addresses"), - // Provider: to.Ptr("Azure Stack HCI"), - // Resource: to.Ptr("GalleryImages"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armazurestackhci.OriginUser), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go index 68d5c353c92a..9c053745d5b9 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go @@ -8,6 +8,200 @@ package armazurestackhci +// ArcSettingsClientBeginCreateIdentityOptions contains the optional parameters for the ArcSettingsClient.BeginCreateIdentity +// method. +type ArcSettingsClientBeginCreateIdentityOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArcSettingsClientBeginDeleteOptions contains the optional parameters for the ArcSettingsClient.BeginDelete method. +type ArcSettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArcSettingsClientBeginInitializeDisableProcessOptions contains the optional parameters for the ArcSettingsClient.BeginInitializeDisableProcess +// method. +type ArcSettingsClientBeginInitializeDisableProcessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArcSettingsClientConsentAndInstallDefaultExtensionsOptions contains the optional parameters for the ArcSettingsClient.ConsentAndInstallDefaultExtensions +// method. +type ArcSettingsClientConsentAndInstallDefaultExtensionsOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientCreateOptions contains the optional parameters for the ArcSettingsClient.Create method. +type ArcSettingsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientGeneratePasswordOptions contains the optional parameters for the ArcSettingsClient.GeneratePassword method. +type ArcSettingsClientGeneratePasswordOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientGetOptions contains the optional parameters for the ArcSettingsClient.Get method. +type ArcSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.NewListByClusterPager +// method. +type ArcSettingsClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientUpdateOptions contains the optional parameters for the ArcSettingsClient.Update method. +type ArcSettingsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity method. +type ClustersClientBeginCreateIdentityOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// ClustersClientBeginExtendSoftwareAssuranceBenefitOptions contains the optional parameters for the ClustersClient.BeginExtendSoftwareAssuranceBenefit +// method. +type ClustersClientBeginExtendSoftwareAssuranceBenefitOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate +// method. +type ClustersClientBeginUploadCertificateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientCreateOptions contains the optional parameters for the ClustersClient.Create method. +type ClustersClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +type ClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager +// method. +type ClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager +// method. +type ClustersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. +type ClustersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DeploymentSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentSettingsClient.BeginCreateOrUpdate +// method. +type DeploymentSettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentSettingsClientBeginDeleteOptions contains the optional parameters for the DeploymentSettingsClient.BeginDelete +// method. +type DeploymentSettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentSettingsClientGetOptions contains the optional parameters for the DeploymentSettingsClient.Get method. +type DeploymentSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentSettingsClientListByClustersOptions contains the optional parameters for the DeploymentSettingsClient.NewListByClustersPager +// method. +type DeploymentSettingsClientListByClustersOptions struct { + // placeholder for future optional parameters +} + +// EdgeDevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the EdgeDevicesClient.BeginCreateOrUpdate +// method. +type EdgeDevicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EdgeDevicesClientBeginDeleteOptions contains the optional parameters for the EdgeDevicesClient.BeginDelete method. +type EdgeDevicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EdgeDevicesClientBeginValidateOptions contains the optional parameters for the EdgeDevicesClient.BeginValidate method. +type EdgeDevicesClientBeginValidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EdgeDevicesClientGetOptions contains the optional parameters for the EdgeDevicesClient.Get method. +type EdgeDevicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EdgeDevicesClientListOptions contains the optional parameters for the EdgeDevicesClient.NewListPager method. +type EdgeDevicesClientListOptions struct { + // placeholder for future optional parameters +} + +// ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. +type ExtensionsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientBeginDeleteOptions contains the optional parameters for the ExtensionsClient.BeginDelete method. +type ExtensionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientBeginUpdateOptions contains the optional parameters for the ExtensionsClient.BeginUpdate method. +type ExtensionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientBeginUpgradeOptions contains the optional parameters for the ExtensionsClient.BeginUpgrade method. +type ExtensionsClientBeginUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. +type ExtensionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtensionsClientListByArcSettingOptions contains the optional parameters for the ExtensionsClient.NewListByArcSettingPager +// method. +type ExtensionsClientListByArcSettingOptions struct { + // placeholder for future optional parameters +} + // GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate // method. type GalleryImagesClientBeginCreateOrUpdateOptions struct { @@ -187,11 +381,75 @@ type NetworkInterfacesClientListOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +// OffersClientGetOptions contains the optional parameters for the OffersClient.Get method. +type OffersClientGetOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OffersClientListByClusterOptions contains the optional parameters for the OffersClient.NewListByClusterPager method. +type OffersClientListByClusterOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OffersClientListByPublisherOptions contains the optional parameters for the OffersClient.NewListByPublisherPager method. +type OffersClientListByPublisherOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters } +// PublishersClientGetOptions contains the optional parameters for the PublishersClient.Get method. +type PublishersClientGetOptions struct { + // placeholder for future optional parameters +} + +// PublishersClientListByClusterOptions contains the optional parameters for the PublishersClient.NewListByClusterPager method. +type PublishersClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientGetOptions contains the optional parameters for the SKUsClient.Get method. +type SKUsClientGetOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// SKUsClientListByOfferOptions contains the optional parameters for the SKUsClient.NewListByOfferPager method. +type SKUsClientListByOfferOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// SecuritySettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the SecuritySettingsClient.BeginCreateOrUpdate +// method. +type SecuritySettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecuritySettingsClientBeginDeleteOptions contains the optional parameters for the SecuritySettingsClient.BeginDelete method. +type SecuritySettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecuritySettingsClientGetOptions contains the optional parameters for the SecuritySettingsClient.Get method. +type SecuritySettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecuritySettingsClientListByClustersOptions contains the optional parameters for the SecuritySettingsClient.NewListByClustersPager +// method. +type SecuritySettingsClientListByClustersOptions struct { + // placeholder for future optional parameters +} + // StorageContainersClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageContainersClient.BeginCreateOrUpdate // method. type StorageContainersClientBeginCreateOrUpdateOptions struct { @@ -229,6 +487,75 @@ type StorageContainersClientListOptions struct { // placeholder for future optional parameters } +// UpdateRunsClientBeginDeleteOptions contains the optional parameters for the UpdateRunsClient.BeginDelete method. +type UpdateRunsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. +type UpdateRunsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientListOptions contains the optional parameters for the UpdateRunsClient.NewListPager method. +type UpdateRunsClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientPutOptions contains the optional parameters for the UpdateRunsClient.Put method. +type UpdateRunsClientPutOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientBeginDeleteOptions contains the optional parameters for the UpdateSummariesClient.BeginDelete method. +type UpdateSummariesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdateSummariesClientGetOptions contains the optional parameters for the UpdateSummariesClient.Get method. +type UpdateSummariesClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientListOptions contains the optional parameters for the UpdateSummariesClient.NewListPager method. +type UpdateSummariesClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientPutOptions contains the optional parameters for the UpdateSummariesClient.Put method. +type UpdateSummariesClientPutOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientBeginDeleteOptions contains the optional parameters for the UpdatesClient.BeginDelete method. +type UpdatesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdatesClientBeginPostOptions contains the optional parameters for the UpdatesClient.BeginPost method. +type UpdatesClientBeginPostOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdatesClientGetOptions contains the optional parameters for the UpdatesClient.Get method. +type UpdatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientListOptions contains the optional parameters for the UpdatesClient.NewListPager method. +type UpdatesClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientPutOptions contains the optional parameters for the UpdatesClient.Put method. +type UpdatesClientPutOptions struct { + // placeholder for future optional parameters +} + // VirtualHardDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginCreateOrUpdate // method. type VirtualHardDisksClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go new file mode 100644 index 000000000000..06d32dadd50c --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// PublishersClient contains the methods for the Publishers group. +// Don't use this type directly, use NewPublishersClient() instead. +type PublishersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPublishersClient creates a new instance of PublishersClient 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 NewPublishersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublishersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PublishersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get Publisher resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - options - PublishersClientGetOptions contains the optional parameters for the PublishersClient.Get method. +func (client *PublishersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *PublishersClientGetOptions) (PublishersClientGetResponse, error) { + var err error + const operationName = "PublishersClient.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, clusterName, publisherName, options) + if err != nil { + return PublishersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublishersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublishersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PublishersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *PublishersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublishersClient) getHandleResponse(resp *http.Response) (PublishersClientGetResponse, error) { + result := PublishersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Publisher); err != nil { + return PublishersClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List Publishers available for the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - PublishersClientListByClusterOptions contains the optional parameters for the PublishersClient.NewListByClusterPager +// method. +func (client *PublishersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *PublishersClientListByClusterOptions) *runtime.Pager[PublishersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PublishersClientListByClusterResponse]{ + More: func(page PublishersClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublishersClientListByClusterResponse) (PublishersClientListByClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PublishersClient.NewListByClusterPager") + 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.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return PublishersClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *PublishersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PublishersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *PublishersClient) listByClusterHandleResponse(resp *http.Response) (PublishersClientListByClusterResponse, error) { + result := PublishersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublisherList); err != nil { + return PublishersClientListByClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/responses.go similarity index 50% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/responses.go index fa2dcffd9882..5fafa751a7c6 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/responses.go @@ -8,6 +8,195 @@ package armazurestackhci +// ArcSettingsClientConsentAndInstallDefaultExtensionsResponse contains the response from method ArcSettingsClient.ConsentAndInstallDefaultExtensions. +type ArcSettingsClientConsentAndInstallDefaultExtensionsResponse struct { + // ArcSetting details. + ArcSetting +} + +// ArcSettingsClientCreateIdentityResponse contains the response from method ArcSettingsClient.BeginCreateIdentity. +type ArcSettingsClientCreateIdentityResponse struct { + // ArcIdentity details. + ArcIdentityResponse +} + +// ArcSettingsClientCreateResponse contains the response from method ArcSettingsClient.Create. +type ArcSettingsClientCreateResponse struct { + // ArcSetting details. + ArcSetting +} + +// ArcSettingsClientDeleteResponse contains the response from method ArcSettingsClient.BeginDelete. +type ArcSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// ArcSettingsClientGeneratePasswordResponse contains the response from method ArcSettingsClient.GeneratePassword. +type ArcSettingsClientGeneratePasswordResponse struct { + PasswordCredential +} + +// ArcSettingsClientGetResponse contains the response from method ArcSettingsClient.Get. +type ArcSettingsClientGetResponse struct { + // ArcSetting details. + ArcSetting +} + +// ArcSettingsClientInitializeDisableProcessResponse contains the response from method ArcSettingsClient.BeginInitializeDisableProcess. +type ArcSettingsClientInitializeDisableProcessResponse struct { + // placeholder for future response values +} + +// ArcSettingsClientListByClusterResponse contains the response from method ArcSettingsClient.NewListByClusterPager. +type ArcSettingsClientListByClusterResponse struct { + // List of ArcSetting proxy resources for the HCI cluster. + ArcSettingList +} + +// ArcSettingsClientUpdateResponse contains the response from method ArcSettingsClient.Update. +type ArcSettingsClientUpdateResponse struct { + // ArcSetting details. + ArcSetting +} + +// ClustersClientCreateIdentityResponse contains the response from method ClustersClient.BeginCreateIdentity. +type ClustersClientCreateIdentityResponse struct { + // Cluster Identity details. + ClusterIdentityResponse +} + +// ClustersClientCreateResponse contains the response from method ClustersClient.Create. +type ClustersClientCreateResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientDeleteResponse contains the response from method ClustersClient.BeginDelete. +type ClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// ClustersClientExtendSoftwareAssuranceBenefitResponse contains the response from method ClustersClient.BeginExtendSoftwareAssuranceBenefit. +type ClustersClientExtendSoftwareAssuranceBenefitResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientGetResponse contains the response from method ClustersClient.Get. +type ClustersClientGetResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.NewListByResourceGroupPager. +type ClustersClientListByResourceGroupResponse struct { + // List of clusters. + ClusterList +} + +// ClustersClientListBySubscriptionResponse contains the response from method ClustersClient.NewListBySubscriptionPager. +type ClustersClientListBySubscriptionResponse struct { + // List of clusters. + ClusterList +} + +// ClustersClientUpdateResponse contains the response from method ClustersClient.Update. +type ClustersClientUpdateResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientUploadCertificateResponse contains the response from method ClustersClient.BeginUploadCertificate. +type ClustersClientUploadCertificateResponse struct { + // placeholder for future response values +} + +// DeploymentSettingsClientCreateOrUpdateResponse contains the response from method DeploymentSettingsClient.BeginCreateOrUpdate. +type DeploymentSettingsClientCreateOrUpdateResponse struct { + // Edge device resource + DeploymentSetting +} + +// DeploymentSettingsClientDeleteResponse contains the response from method DeploymentSettingsClient.BeginDelete. +type DeploymentSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// DeploymentSettingsClientGetResponse contains the response from method DeploymentSettingsClient.Get. +type DeploymentSettingsClientGetResponse struct { + // Edge device resource + DeploymentSetting +} + +// DeploymentSettingsClientListByClustersResponse contains the response from method DeploymentSettingsClient.NewListByClustersPager. +type DeploymentSettingsClientListByClustersResponse struct { + // The response of a DeploymentSetting list operation. + DeploymentSettingListResult +} + +// EdgeDevicesClientCreateOrUpdateResponse contains the response from method EdgeDevicesClient.BeginCreateOrUpdate. +type EdgeDevicesClientCreateOrUpdateResponse struct { + // Edge device resource + EdgeDevice +} + +// EdgeDevicesClientDeleteResponse contains the response from method EdgeDevicesClient.BeginDelete. +type EdgeDevicesClientDeleteResponse struct { + // placeholder for future response values +} + +// EdgeDevicesClientGetResponse contains the response from method EdgeDevicesClient.Get. +type EdgeDevicesClientGetResponse struct { + // Edge device resource + EdgeDevice +} + +// EdgeDevicesClientListResponse contains the response from method EdgeDevicesClient.NewListPager. +type EdgeDevicesClientListResponse struct { + // The response of a EdgeDevice list operation. + EdgeDeviceListResult +} + +// EdgeDevicesClientValidateResponse contains the response from method EdgeDevicesClient.BeginValidate. +type EdgeDevicesClientValidateResponse struct { + // An Accepted response with an Operation-Location header. + ValidateResponse +} + +// ExtensionsClientCreateResponse contains the response from method ExtensionsClient.BeginCreate. +type ExtensionsClientCreateResponse struct { + // Details of a particular extension in HCI Cluster. + Extension +} + +// ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.BeginDelete. +type ExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. +type ExtensionsClientGetResponse struct { + // Details of a particular extension in HCI Cluster. + Extension +} + +// ExtensionsClientListByArcSettingResponse contains the response from method ExtensionsClient.NewListByArcSettingPager. +type ExtensionsClientListByArcSettingResponse struct { + // List of Extensions in HCI cluster. + ExtensionList +} + +// ExtensionsClientUpdateResponse contains the response from method ExtensionsClient.BeginUpdate. +type ExtensionsClientUpdateResponse struct { + // Details of a particular extension in HCI Cluster. + Extension +} + +// ExtensionsClientUpgradeResponse contains the response from method ExtensionsClient.BeginUpgrade. +type ExtensionsClientUpgradeResponse struct { + // placeholder for future response values +} + // GalleryImagesClientCreateOrUpdateResponse contains the response from method GalleryImagesClient.BeginCreateOrUpdate. type GalleryImagesClientCreateOrUpdateResponse struct { // The gallery images resource definition. @@ -177,12 +366,77 @@ type NetworkInterfacesClientUpdateResponse struct { NetworkInterfaces } -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +// OffersClientGetResponse contains the response from method OffersClient.Get. +type OffersClientGetResponse struct { + // Offer details. + Offer +} + +// OffersClientListByClusterResponse contains the response from method OffersClient.NewListByClusterPager. +type OffersClientListByClusterResponse struct { + // List of Offer proxy resources for the HCI cluster. + OfferList +} + +// OffersClientListByPublisherResponse contains the response from method OffersClient.NewListByPublisherPager. +type OffersClientListByPublisherResponse struct { + // List of Offer proxy resources for the HCI cluster. + OfferList +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. 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 } +// PublishersClientGetResponse contains the response from method PublishersClient.Get. +type PublishersClientGetResponse struct { + // Publisher details. + Publisher +} + +// PublishersClientListByClusterResponse contains the response from method PublishersClient.NewListByClusterPager. +type PublishersClientListByClusterResponse struct { + // List of Publisher proxy resources for the HCI cluster. + PublisherList +} + +// SKUsClientGetResponse contains the response from method SKUsClient.Get. +type SKUsClientGetResponse struct { + // Sku details. + SKU +} + +// SKUsClientListByOfferResponse contains the response from method SKUsClient.NewListByOfferPager. +type SKUsClientListByOfferResponse struct { + // List of SKU proxy resources for the HCI cluster. + SKUList +} + +// SecuritySettingsClientCreateOrUpdateResponse contains the response from method SecuritySettingsClient.BeginCreateOrUpdate. +type SecuritySettingsClientCreateOrUpdateResponse struct { + // Security settings proxy resource + SecuritySetting +} + +// SecuritySettingsClientDeleteResponse contains the response from method SecuritySettingsClient.BeginDelete. +type SecuritySettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecuritySettingsClientGetResponse contains the response from method SecuritySettingsClient.Get. +type SecuritySettingsClientGetResponse struct { + // Security settings proxy resource + SecuritySetting +} + +// SecuritySettingsClientListByClustersResponse contains the response from method SecuritySettingsClient.NewListByClustersPager. +type SecuritySettingsClientListByClustersResponse struct { + // The response of a SecuritySetting list operation. + SecuritySettingListResult +} + // StorageContainersClientCreateOrUpdateResponse contains the response from method StorageContainersClient.BeginCreateOrUpdate. type StorageContainersClientCreateOrUpdateResponse struct { // The storage container resource definition. @@ -216,6 +470,80 @@ type StorageContainersClientUpdateResponse struct { StorageContainers } +// UpdateRunsClientDeleteResponse contains the response from method UpdateRunsClient.BeginDelete. +type UpdateRunsClientDeleteResponse struct { + // placeholder for future response values +} + +// UpdateRunsClientGetResponse contains the response from method UpdateRunsClient.Get. +type UpdateRunsClientGetResponse struct { + // Details of an Update run + UpdateRun +} + +// UpdateRunsClientListResponse contains the response from method UpdateRunsClient.NewListPager. +type UpdateRunsClientListResponse struct { + // List of Update runs + UpdateRunList +} + +// UpdateRunsClientPutResponse contains the response from method UpdateRunsClient.Put. +type UpdateRunsClientPutResponse struct { + // Details of an Update run + UpdateRun +} + +// UpdateSummariesClientDeleteResponse contains the response from method UpdateSummariesClient.BeginDelete. +type UpdateSummariesClientDeleteResponse struct { + // placeholder for future response values +} + +// UpdateSummariesClientGetResponse contains the response from method UpdateSummariesClient.Get. +type UpdateSummariesClientGetResponse struct { + // Get the update summaries for the cluster + UpdateSummaries +} + +// UpdateSummariesClientListResponse contains the response from method UpdateSummariesClient.NewListPager. +type UpdateSummariesClientListResponse struct { + // List of Update Summaries + UpdateSummariesList +} + +// UpdateSummariesClientPutResponse contains the response from method UpdateSummariesClient.Put. +type UpdateSummariesClientPutResponse struct { + // Get the update summaries for the cluster + UpdateSummaries +} + +// UpdatesClientDeleteResponse contains the response from method UpdatesClient.BeginDelete. +type UpdatesClientDeleteResponse struct { + // placeholder for future response values +} + +// UpdatesClientGetResponse contains the response from method UpdatesClient.Get. +type UpdatesClientGetResponse struct { + // Update details + Update +} + +// UpdatesClientListResponse contains the response from method UpdatesClient.NewListPager. +type UpdatesClientListResponse struct { + // List of Updates + UpdateList +} + +// UpdatesClientPostResponse contains the response from method UpdatesClient.BeginPost. +type UpdatesClientPostResponse struct { + // placeholder for future response values +} + +// UpdatesClientPutResponse contains the response from method UpdatesClient.Put. +type UpdatesClientPutResponse struct { + // Update details + Update +} + // VirtualHardDisksClientCreateOrUpdateResponse contains the response from method VirtualHardDisksClient.BeginCreateOrUpdate. type VirtualHardDisksClientCreateOrUpdateResponse struct { // The virtual hard disk resource definition. diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/securitysettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/securitysettings_client.go new file mode 100644 index 000000000000..640fc46f9892 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/securitysettings_client.go @@ -0,0 +1,346 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// SecuritySettingsClient contains the methods for the SecuritySettings group. +// Don't use this type directly, use NewSecuritySettingsClient() instead. +type SecuritySettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSecuritySettingsClient creates a new instance of SecuritySettingsClient 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 NewSecuritySettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecuritySettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecuritySettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a security setting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - securitySettingsName - Name of security setting +// - resource - Resource create parameters. +// - options - SecuritySettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the SecuritySettingsClient.BeginCreateOrUpdate +// method. +func (client *SecuritySettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource SecuritySetting, options *SecuritySettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecuritySettingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, securitySettingsName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecuritySettingsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecuritySettingsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a security setting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *SecuritySettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource SecuritySetting, options *SecuritySettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SecuritySettingsClient.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, clusterName, securitySettingsName, 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 *SecuritySettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource SecuritySetting, options *SecuritySettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings/{securitySettingsName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if securitySettingsName == "" { + return nil, errors.New("parameter securitySettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securitySettingsName}", url.PathEscape(securitySettingsName)) + 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-01") + 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 - Delete a SecuritySetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - securitySettingsName - Name of security setting +// - options - SecuritySettingsClientBeginDeleteOptions contains the optional parameters for the SecuritySettingsClient.BeginDelete +// method. +func (client *SecuritySettingsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientBeginDeleteOptions) (*runtime.Poller[SecuritySettingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, securitySettingsName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecuritySettingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecuritySettingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a SecuritySetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *SecuritySettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SecuritySettingsClient.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, clusterName, securitySettingsName, 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 *SecuritySettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings/{securitySettingsName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if securitySettingsName == "" { + return nil, errors.New("parameter securitySettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securitySettingsName}", url.PathEscape(securitySettingsName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SecuritySetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - securitySettingsName - Name of security setting +// - options - SecuritySettingsClientGetOptions contains the optional parameters for the SecuritySettingsClient.Get method. +func (client *SecuritySettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientGetOptions) (SecuritySettingsClientGetResponse, error) { + var err error + const operationName = "SecuritySettingsClient.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, clusterName, securitySettingsName, options) + if err != nil { + return SecuritySettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecuritySettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecuritySettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SecuritySettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings/{securitySettingsName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if securitySettingsName == "" { + return nil, errors.New("parameter securitySettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securitySettingsName}", url.PathEscape(securitySettingsName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecuritySettingsClient) getHandleResponse(resp *http.Response) (SecuritySettingsClientGetResponse, error) { + result := SecuritySettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySetting); err != nil { + return SecuritySettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByClustersPager - List SecuritySetting resources by Clusters +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - SecuritySettingsClientListByClustersOptions contains the optional parameters for the SecuritySettingsClient.NewListByClustersPager +// method. +func (client *SecuritySettingsClient) NewListByClustersPager(resourceGroupName string, clusterName string, options *SecuritySettingsClientListByClustersOptions) *runtime.Pager[SecuritySettingsClientListByClustersResponse] { + return runtime.NewPager(runtime.PagingHandler[SecuritySettingsClientListByClustersResponse]{ + More: func(page SecuritySettingsClientListByClustersResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecuritySettingsClientListByClustersResponse) (SecuritySettingsClientListByClustersResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecuritySettingsClient.NewListByClustersPager") + 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.listByClustersCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return SecuritySettingsClientListByClustersResponse{}, err + } + return client.listByClustersHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClustersCreateRequest creates the ListByClusters request. +func (client *SecuritySettingsClient) listByClustersCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *SecuritySettingsClientListByClustersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClustersHandleResponse handles the ListByClusters response. +func (client *SecuritySettingsClient) listByClustersHandleResponse(resp *http.Response) (SecuritySettingsClientListByClustersResponse, error) { + result := SecuritySettingsClientListByClustersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySettingListResult); err != nil { + return SecuritySettingsClientListByClustersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go new file mode 100644 index 000000000000..c413bade303a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go @@ -0,0 +1,203 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// SKUsClient contains the methods for the SKUs group. +// Don't use this type directly, use NewSKUsClient() instead. +type SKUsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSKUsClient creates a new instance of SKUsClient 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 NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get SKU resource details within a offer of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - offerName - The name of the offer available within HCI cluster. +// - skuName - The name of the SKU available within HCI cluster. +// - options - SKUsClientGetOptions contains the optional parameters for the SKUsClient.Get method. +func (client *SKUsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *SKUsClientGetOptions) (SKUsClientGetResponse, error) { + var err error + const operationName = "SKUsClient.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, clusterName, publisherName, offerName, skuName, options) + if err != nil { + return SKUsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SKUsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SKUsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SKUsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *SKUsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + 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.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SKUsClient) getHandleResponse(resp *http.Response) (SKUsClientGetResponse, error) { + result := SKUsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKU); err != nil { + return SKUsClientGetResponse{}, err + } + return result, nil +} + +// NewListByOfferPager - List Skus available for a offer within the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - offerName - The name of the offer available within HCI cluster. +// - options - SKUsClientListByOfferOptions contains the optional parameters for the SKUsClient.NewListByOfferPager method. +func (client *SKUsClient) NewListByOfferPager(resourceGroupName string, clusterName string, publisherName string, offerName string, options *SKUsClientListByOfferOptions) *runtime.Pager[SKUsClientListByOfferResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUsClientListByOfferResponse]{ + More: func(page SKUsClientListByOfferResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SKUsClientListByOfferResponse) (SKUsClientListByOfferResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListByOfferPager") + 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.listByOfferCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, options) + }, nil) + if err != nil { + return SKUsClientListByOfferResponse{}, err + } + return client.listByOfferHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByOfferCreateRequest creates the ListByOffer request. +func (client *SKUsClient) listByOfferCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *SKUsClientListByOfferOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + 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.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByOfferHandleResponse handles the ListByOffer response. +func (client *SKUsClient) listByOfferHandleResponse(resp *http.Response) (SKUsClientListByOfferResponse, error) { + result := SKUsClientListByOfferResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return SKUsClientListByOfferResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go index 169d92cf5208..b35bdcff3c0b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go @@ -47,7 +47,7 @@ func NewStorageContainersClient(subscriptionID string, credential azcore.TokenCr // during storage container creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageContainerName - Name of the storage container // - options - StorageContainersClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageContainersClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *StorageContainersClient) BeginCreateOrUpdate(ctx context.Context, // storage container creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *StorageContainersClient) createOrUpdate(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainers, options *StorageContainersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "StorageContainersClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *StorageContainersClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageContainers); err != nil { @@ -128,7 +128,7 @@ func (client *StorageContainersClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageContainerName - Name of the storage container // - options - StorageContainersClientBeginDeleteOptions contains the optional parameters for the StorageContainersClient.BeginDelete @@ -154,7 +154,7 @@ func (client *StorageContainersClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *StorageContainersClient) deleteOperation(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "StorageContainersClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *StorageContainersClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *StorageContainersClient) deleteCreateRequest(ctx context.Context, // Get - Gets a storage container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageContainerName - Name of the storage container // - options - StorageContainersClientGetOptions contains the optional parameters for the StorageContainersClient.Get method. @@ -251,7 +251,7 @@ func (client *StorageContainersClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *StorageContainersClient) getHandleResponse(resp *http.Response) (S // NewListPager - Lists all of the storage containers in the specified resource group. Use the nextLink property in the response // to get the next page of storage containers. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - StorageContainersClientListOptions contains the optional parameters for the StorageContainersClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *StorageContainersClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *StorageContainersClient) listHandleResponse(resp *http.Response) ( // NewListAllPager - Lists all of the storage containers in the specified subscription. Use the nextLink property in the response // to get the next page of storage containers. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - StorageContainersClientListAllOptions contains the optional parameters for the StorageContainersClient.NewListAllPager // method. func (client *StorageContainersClient) NewListAllPager(options *StorageContainersClientListAllOptions) *runtime.Pager[StorageContainersClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *StorageContainersClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *StorageContainersClient) listAllHandleResponse(resp *http.Response // BeginUpdate - The operation to update a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - storageContainerName - Name of the storage container // - options - StorageContainersClientBeginUpdateOptions contains the optional parameters for the StorageContainersClient.BeginUpdate @@ -412,7 +412,7 @@ func (client *StorageContainersClient) BeginUpdate(ctx context.Context, resource // Update - The operation to update a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *StorageContainersClient) update(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainersUpdateRequest, options *StorageContainersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "StorageContainersClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *StorageContainersClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageContainers); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go deleted file mode 100644 index 7337c9072a8a..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go +++ /dev/null @@ -1,250 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetStorageContainer.json -func ExampleStorageContainersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewStorageContainersClient().Get(ctx, "test-rg", "Default_Container", 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.StorageContainers = armazurestackhci.StorageContainers{ - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutStorageContainer.json -func ExampleStorageContainersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageContainersClient().BeginCreateOrUpdate(ctx, "test-rg", "Default_Container", armazurestackhci.StorageContainers{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.StorageContainerProperties{ - Path: to.Ptr("C:\\container_storage"), - }, - }, 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.StorageContainers = armazurestackhci.StorageContainers{ - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-galimg3325"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteStorageContainer.json -func ExampleStorageContainersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageContainersClient().BeginDelete(ctx, "test-rg", "Default_Container", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateStorageContainer.json -func ExampleStorageContainersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageContainersClient().BeginUpdate(ctx, "test-rg", "Default_Container", armazurestackhci.StorageContainersUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, 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.StorageContainers = armazurestackhci.StorageContainers{ - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-galimg3325"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListStorageContainerByResourceGroup.json -func ExampleStorageContainersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStorageContainersClient().NewListPager("test-rg", 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.StorageContainersListResult = armazurestackhci.StorageContainersListResult{ - // Value: []*armazurestackhci.StorageContainers{ - // { - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListStorageContainerBySubscription.json -func ExampleStorageContainersClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStorageContainersClient().NewListAllPager(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.StorageContainersListResult = armazurestackhci.StorageContainersListResult{ - // Value: []*armazurestackhci.StorageContainers{ - // { - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go index 0e827bf74e6c..85a86504409f 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/azurestackhci/armazurestackhci/updateruns_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go new file mode 100644 index 000000000000..551306f7359c --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go @@ -0,0 +1,351 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// UpdateRunsClient contains the methods for the UpdateRuns group. +// Don't use this type directly, use NewUpdateRunsClient() instead. +type UpdateRunsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpdateRunsClient creates a new instance of UpdateRunsClient 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 NewUpdateRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateRunsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpdateRunsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete specified Update Run +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateRunName - The name of the Update Run +// - options - UpdateRunsClientBeginDeleteOptions contains the optional parameters for the UpdateRunsClient.BeginDelete method. +func (client *UpdateRunsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*runtime.Poller[UpdateRunsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, updateName, updateRunName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdateRunsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete specified Update Run +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdateRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpdateRunsClient.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, clusterName, updateName, updateRunName, 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 *UpdateRunsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the Update run for a specified update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateRunName - The name of the Update Run +// - options - UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. +func (client *UpdateRunsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientGetOptions) (UpdateRunsClientGetResponse, error) { + var err error + const operationName = "UpdateRunsClient.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, clusterName, updateName, updateRunName, options) + if err != nil { + return UpdateRunsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateRunsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateRunsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdateRunsClient) getHandleResponse(resp *http.Response) (UpdateRunsClientGetResponse, error) { + result := UpdateRunsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRun); err != nil { + return UpdateRunsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Update runs for a specified update +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdateRunsClientListOptions contains the optional parameters for the UpdateRunsClient.NewListPager method. +func (client *UpdateRunsClient) NewListPager(resourceGroupName string, clusterName string, updateName string, options *UpdateRunsClientListOptions) *runtime.Pager[UpdateRunsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdateRunsClientListResponse]{ + More: func(page UpdateRunsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdateRunsClientListResponse) (UpdateRunsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpdateRunsClient.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, clusterName, updateName, options) + }, nil) + if err != nil { + return UpdateRunsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *UpdateRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdateRunsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdateRunsClient) listHandleResponse(resp *http.Response) (UpdateRunsClientListResponse, error) { + result := UpdateRunsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRunList); err != nil { + return UpdateRunsClientListResponse{}, err + } + return result, nil +} + +// Put - Put Update runs for a specified update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateRunName - The name of the Update Run +// - updateRunsProperties - Properties of the updateRuns object +// - options - UpdateRunsClientPutOptions contains the optional parameters for the UpdateRunsClient.Put method. +func (client *UpdateRunsClient) Put(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, updateRunsProperties UpdateRun, options *UpdateRunsClientPutOptions) (UpdateRunsClientPutResponse, error) { + var err error + const operationName = "UpdateRunsClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateRunName, updateRunsProperties, options) + if err != nil { + return UpdateRunsClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateRunsClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateRunsClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *UpdateRunsClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, updateRunsProperties UpdateRun, options *UpdateRunsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateRunsProperties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *UpdateRunsClient) putHandleResponse(resp *http.Response) (UpdateRunsClientPutResponse, error) { + result := UpdateRunsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRun); err != nil { + return UpdateRunsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go new file mode 100644 index 000000000000..b57a5c6246d0 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go @@ -0,0 +1,412 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// UpdatesClient contains the methods for the Updates group. +// Don't use this type directly, use NewUpdatesClient() instead. +type UpdatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpdatesClient creates a new instance of UpdatesClient 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 NewUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdatesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpdatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdatesClientBeginDeleteOptions contains the optional parameters for the UpdatesClient.BeginDelete method. +func (client *UpdatesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginDeleteOptions) (*runtime.Poller[UpdatesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdatesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdatesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdatesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpdatesClient.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, clusterName, updateName, 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 *UpdatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdatesClientGetOptions contains the optional parameters for the UpdatesClient.Get method. +func (client *UpdatesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientGetOptions) (UpdatesClientGetResponse, error) { + var err error + const operationName = "UpdatesClient.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, clusterName, updateName, options) + if err != nil { + return UpdatesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdatesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpdatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdatesClient) getHandleResponse(resp *http.Response) (UpdatesClientGetResponse, error) { + result := UpdatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Update); err != nil { + return UpdatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Updates +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdatesClientListOptions contains the optional parameters for the UpdatesClient.NewListPager method. +func (client *UpdatesClient) NewListPager(resourceGroupName string, clusterName string, options *UpdatesClientListOptions) *runtime.Pager[UpdatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdatesClientListResponse]{ + More: func(page UpdatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdatesClientListResponse) (UpdatesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpdatesClient.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, clusterName, options) + }, nil) + if err != nil { + return UpdatesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *UpdatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdatesClient) listHandleResponse(resp *http.Response) (UpdatesClientListResponse, error) { + result := UpdatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateList); err != nil { + return UpdatesClientListResponse{}, err + } + return result, nil +} + +// BeginPost - Apply Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdatesClientBeginPostOptions contains the optional parameters for the UpdatesClient.BeginPost method. +func (client *UpdatesClient) BeginPost(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*runtime.Poller[UpdatesClientPostResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.post(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdatesClientPostResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdatesClientPostResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Post - Apply Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdatesClient) post(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*http.Response, error) { + var err error + const operationName = "UpdatesClient.BeginPost" + 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, clusterName, updateName, 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 +} + +// postCreateRequest creates the Post request. +func (client *UpdatesClient) postCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Put - Put specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateProperties - Properties of the Updates object +// - options - UpdatesClientPutOptions contains the optional parameters for the UpdatesClient.Put method. +func (client *UpdatesClient) Put(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateProperties Update, options *UpdatesClientPutOptions) (UpdatesClientPutResponse, error) { + var err error + const operationName = "UpdatesClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateProperties, options) + if err != nil { + return UpdatesClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdatesClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdatesClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *UpdatesClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateProperties Update, options *UpdatesClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateProperties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *UpdatesClient) putHandleResponse(resp *http.Response) (UpdatesClientPutResponse, error) { + result := UpdatesClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Update); err != nil { + return UpdatesClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go new file mode 100644 index 000000000000..3eb83eaf03d9 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go @@ -0,0 +1,318 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armazurestackhci + +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" +) + +// UpdateSummariesClient contains the methods for the UpdateSummaries group. +// Don't use this type directly, use NewUpdateSummariesClient() instead. +type UpdateSummariesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpdateSummariesClient creates a new instance of UpdateSummariesClient 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 NewUpdateSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateSummariesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpdateSummariesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete Update Summaries +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdateSummariesClientBeginDeleteOptions contains the optional parameters for the UpdateSummariesClient.BeginDelete +// method. +func (client *UpdateSummariesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientBeginDeleteOptions) (*runtime.Poller[UpdateSummariesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateSummariesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdateSummariesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete Update Summaries +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdateSummariesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpdateSummariesClient.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, clusterName, 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 *UpdateSummariesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get all Update summaries under the HCI cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdateSummariesClientGetOptions contains the optional parameters for the UpdateSummariesClient.Get method. +func (client *UpdateSummariesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientGetOptions) (UpdateSummariesClientGetResponse, error) { + var err error + const operationName = "UpdateSummariesClient.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, clusterName, options) + if err != nil { + return UpdateSummariesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateSummariesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateSummariesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpdateSummariesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdateSummariesClient) getHandleResponse(resp *http.Response) (UpdateSummariesClientGetResponse, error) { + result := UpdateSummariesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummaries); err != nil { + return UpdateSummariesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Update summaries under the HCI cluster +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdateSummariesClientListOptions contains the optional parameters for the UpdateSummariesClient.NewListPager +// method. +func (client *UpdateSummariesClient) NewListPager(resourceGroupName string, clusterName string, options *UpdateSummariesClientListOptions) *runtime.Pager[UpdateSummariesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdateSummariesClientListResponse]{ + More: func(page UpdateSummariesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdateSummariesClientListResponse) (UpdateSummariesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpdateSummariesClient.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, clusterName, options) + }, nil) + if err != nil { + return UpdateSummariesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *UpdateSummariesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries" + 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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdateSummariesClient) listHandleResponse(resp *http.Response) (UpdateSummariesClientListResponse, error) { + result := UpdateSummariesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummariesList); err != nil { + return UpdateSummariesClientListResponse{}, err + } + return result, nil +} + +// Put - Put Update summaries under the HCI cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateLocationProperties - Properties of the UpdateSummaries resource +// - options - UpdateSummariesClientPutOptions contains the optional parameters for the UpdateSummariesClient.Put method. +func (client *UpdateSummariesClient) Put(ctx context.Context, resourceGroupName string, clusterName string, updateLocationProperties UpdateSummaries, options *UpdateSummariesClientPutOptions) (UpdateSummariesClientPutResponse, error) { + var err error + const operationName = "UpdateSummariesClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, updateLocationProperties, options) + if err != nil { + return UpdateSummariesClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateSummariesClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateSummariesClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *UpdateSummariesClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateLocationProperties UpdateSummaries, options *UpdateSummariesClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/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 clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateLocationProperties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *UpdateSummariesClient) putHandleResponse(resp *http.Response) (UpdateSummariesClientPutResponse, error) { + result := UpdateSummariesClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummaries); err != nil { + return UpdateSummariesClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go index f572bf41a9ce..960814d11613 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go @@ -47,7 +47,7 @@ func NewVirtualHardDisksClient(subscriptionID string, credential azcore.TokenCre // during virtual hard disk creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualHardDiskName - Name of the virtual hard disk // - options - VirtualHardDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *VirtualHardDisksClient) BeginCreateOrUpdate(ctx context.Context, r // virtual hard disk creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualHardDisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisks, options *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualHardDisksClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *VirtualHardDisksClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualHardDisks); err != nil { @@ -128,7 +128,7 @@ func (client *VirtualHardDisksClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - The operation to delete a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualHardDiskName - Name of the virtual hard disk // - options - VirtualHardDisksClientBeginDeleteOptions contains the optional parameters for the VirtualHardDisksClient.BeginDelete @@ -154,7 +154,7 @@ func (client *VirtualHardDisksClient) BeginDelete(ctx context.Context, resourceG // Delete - The operation to delete a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualHardDisksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualHardDisksClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *VirtualHardDisksClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualHardDisksClient) deleteCreateRequest(ctx context.Context, r // Get - Gets a virtual hard disk // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualHardDiskName - Name of the virtual hard disk // - options - VirtualHardDisksClientGetOptions contains the optional parameters for the VirtualHardDisksClient.Get method. @@ -251,7 +251,7 @@ func (client *VirtualHardDisksClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *VirtualHardDisksClient) getHandleResponse(resp *http.Response) (Vi // NewListPager - Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response // to get the next page of virtual hard disks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualHardDisksClientListOptions contains the optional parameters for the VirtualHardDisksClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *VirtualHardDisksClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *VirtualHardDisksClient) listHandleResponse(resp *http.Response) (V // NewListAllPager - Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response // to get the next page of virtual hard disks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - VirtualHardDisksClientListAllOptions contains the optional parameters for the VirtualHardDisksClient.NewListAllPager // method. func (client *VirtualHardDisksClient) NewListAllPager(options *VirtualHardDisksClientListAllOptions) *runtime.Pager[VirtualHardDisksClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *VirtualHardDisksClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *VirtualHardDisksClient) listAllHandleResponse(resp *http.Response) // BeginUpdate - The operation to update a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualHardDiskName - Name of the virtual hard disk // - options - VirtualHardDisksClientBeginUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginUpdate @@ -412,7 +412,7 @@ func (client *VirtualHardDisksClient) BeginUpdate(ctx context.Context, resourceG // Update - The operation to update a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualHardDisksClient) update(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisksUpdateRequest, options *VirtualHardDisksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualHardDisksClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *VirtualHardDisksClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualHardDisks); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go deleted file mode 100644 index b748f67a2209..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetVirtualHardDisk.json -func ExampleVirtualHardDisksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHardDisksClient().Get(ctx, "test-rg", "test-vhd", 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.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualHardDisk.json -func ExampleVirtualHardDisksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHardDisksClient().BeginCreateOrUpdate(ctx, "test-rg", "test-vhd", armazurestackhci.VirtualHardDisks{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualHardDiskProperties{ - DiskSizeGB: 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.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteVirtualHardDisk.json -func ExampleVirtualHardDisksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHardDisksClient().BeginDelete(ctx, "test-rg", "test-vhd", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateVirtualHardDisk.json -func ExampleVirtualHardDisksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHardDisksClient().BeginUpdate(ctx, "test-rg", "test-vhd", armazurestackhci.VirtualHardDisksUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, 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.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualHardDiskByResourceGroup.json -func ExampleVirtualHardDisksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHardDisksClient().NewListPager("test-rg", 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.VirtualHardDisksListResult = armazurestackhci.VirtualHardDisksListResult{ - // Value: []*armazurestackhci.VirtualHardDisks{ - // { - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualHardDiskBySubscription.json -func ExampleVirtualHardDisksClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHardDisksClient().NewListAllPager(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.VirtualHardDisksListResult = armazurestackhci.VirtualHardDisksListResult{ - // Value: []*armazurestackhci.VirtualHardDisks{ - // { - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go index 94abc0fad9a7..11b7e3c012a6 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go @@ -42,7 +42,7 @@ func NewVirtualMachineInstancesClient(credential azcore.TokenCredential, options // set only during virtual machine instance creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateOrUpdate // method. @@ -68,7 +68,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-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginCreateOrUpdate" @@ -99,7 +99,7 @@ func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualMachineInstance); err != nil { @@ -111,7 +111,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-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDelete // method. @@ -136,7 +136,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-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) deleteOperation(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginDelete" @@ -167,7 +167,7 @@ func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +176,7 @@ func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Con // Get - Gets a virtual machine instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientGetOptions contains the optional parameters for the VirtualMachineInstancesClient.Get // method. @@ -211,7 +211,7 @@ func (client *VirtualMachineInstancesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +228,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-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientListOptions contains the optional parameters for the VirtualMachineInstancesClient.NewListPager // method. @@ -264,7 +264,7 @@ func (client *VirtualMachineInstancesClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +282,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-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart // method. @@ -307,7 +307,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-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) restart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginRestart" @@ -338,7 +338,7 @@ func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Co // BeginStart - The operation to start a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart // method. @@ -372,7 +372,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-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) start(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStart" @@ -403,7 +403,7 @@ func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -412,7 +412,7 @@ func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Cont // BeginStop - The operation to stop a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginStopOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStop // method. @@ -437,7 +437,7 @@ func (client *VirtualMachineInstancesClient) BeginStop(ctx context.Context, reso // Stop - The operation to stop a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStop" @@ -468,7 +468,7 @@ func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +477,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-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginUpdate // method. @@ -502,7 +502,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-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstanceUpdateRequest, options *VirtualMachineInstancesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginUpdate" @@ -533,7 +533,7 @@ func (client *VirtualMachineInstancesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualMachineInstance); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go deleted file mode 100644 index 5caf0436de5b..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go +++ /dev/null @@ -1,769 +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 armazurestackhci_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/azurestackhci/armazurestackhci/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineInstancesClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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 = armazurestackhci.VirtualMachineInstance{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithGalleryImage.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - AdminPassword: to.Ptr("password"), - AdminUsername: to.Ptr("localadmin"), - ComputerName: to.Ptr("luamaster"), - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithMarketplaceGalleryImage.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithMarketplaceGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - AdminPassword: to.Ptr("password"), - AdminUsername: to.Ptr("localadmin"), - ComputerName: to.Ptr("luamaster"), - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithOsDisk.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithOsDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - OSDisk: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileOsDisk{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // OSDisk: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileOsDisk{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithVMConfigAgent.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithVmConfigAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - AdminPassword: to.Ptr("password"), - AdminUsername: to.Ptr("localadmin"), - ComputerName: to.Ptr("luamaster"), - WindowsConfiguration: &armazurestackhci.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration{ - ProvisionVMConfigAgent: to.Ptr(true), - }, - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // InstanceView: &armazurestackhci.VirtualMachineInstanceView{ - // VMAgent: &armazurestackhci.VirtualMachineConfigAgentInstanceView{ - // Statuses: []*armazurestackhci.InstanceViewStatus{ - // { - // Code: to.Ptr("Ok"), - // DisplayStatus: to.Ptr("Ok"), - // Level: to.Ptr(armazurestackhci.StatusLevelTypesInfo), - // Message: to.Ptr("The agent is healthy"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2009-06-15T05:45:30.000Z"); return t}()), - // }}, - // VMConfigAgentVersion: to.Ptr("1.0.0"), - // }, - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDelete(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstanceUpdateRequest{ - Properties: &armazurestackhci.VirtualMachineInstanceUpdateProperties{ - StorageProfile: &armazurestackhci.StorageProfileUpdate{ - DataDisks: []*armazurestackhci.StorageProfileUpdateDataDisksItem{ - { - ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - }}, - }, - }, - }, 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 = armazurestackhci.VirtualMachineInstance{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // DataDisks: []*armazurestackhci.VirtualMachineInstancePropertiesStorageProfileDataDisksItem{ - // { - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // }}, - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/StartVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStart(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/StopVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStop(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/RestartVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestart(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", 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 = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualMachineInstances.json -func ExampleVirtualMachineInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineInstancesClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", 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 = armazurestackhci.VirtualMachineInstanceListResult{ - // Value: []*armazurestackhci.VirtualMachineInstance{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/CHANGELOG.md b/sdk/resourcemanager/communitytraining/armcommunitytraining/CHANGELOG.md new file mode 100644 index 000000000000..5860e874dfea --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining` 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/communitytraining/armcommunitytraining/LICENSE.txt b/sdk/resourcemanager/communitytraining/armcommunitytraining/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/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/communitytraining/armcommunitytraining/README.md b/sdk/resourcemanager/communitytraining/armcommunitytraining/README.md new file mode 100644 index 000000000000..0aff324e0268 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/README.md @@ -0,0 +1,92 @@ +# Azure Communitytraining Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining) + +The `armcommunitytraining` module provides operations for working with Azure Communitytraining. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/communitytraining/armcommunitytraining) + +# 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 Communitytraining module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Communitytraining. 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 Communitytraining 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 := armcommunitytraining.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 := armcommunitytraining.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.NewCommunityTrainingsClient() +``` + +## 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 `Communitytraining` 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/communitytraining/armcommunitytraining/autorest.md b/sdk/resourcemanager/communitytraining/armcommunitytraining/autorest.md new file mode 100644 index 000000000000..cd046f2f1cf4 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/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/communitytraining/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/communitytraining/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.0.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/build.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/build.go new file mode 100644 index 000000000000..a99ab22506ee --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/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/communitytraining/armcommunitytraining + +package armcommunitytraining diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/ci.yml b/sdk/resourcemanager/communitytraining/armcommunitytraining/ci.yml new file mode 100644 index 000000000000..2df5d762f18a --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/ci.yml @@ -0,0 +1,28 @@ +# 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/communitytraining/armcommunitytraining/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/communitytraining/armcommunitytraining/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/communitytraining/armcommunitytraining' diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/client_factory.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/client_factory.go new file mode 100644 index 000000000000..ea806b575839 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/client_factory.go @@ -0,0 +1,52 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +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. +// - 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 +} + +// NewCommunityTrainingsClient creates a new instance of CommunityTrainingsClient. +func (c *ClientFactory) NewCommunityTrainingsClient() *CommunityTrainingsClient { + return &CommunityTrainingsClient{ + 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/communitytraining/armcommunitytraining/communitytrainings_client.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/communitytrainings_client.go new file mode 100644 index 000000000000..e26451a153a7 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/communitytrainings_client.go @@ -0,0 +1,462 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +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" +) + +// CommunityTrainingsClient contains the methods for the CommunityTrainings group. +// Don't use this type directly, use NewCommunityTrainingsClient() instead. +type CommunityTrainingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCommunityTrainingsClient creates a new instance of CommunityTrainingsClient 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 NewCommunityTrainingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityTrainingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CommunityTrainingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - communityTrainingName - The name of the Community Training Resource +// - resource - Resource create parameters. +// - options - CommunityTrainingsClientBeginCreateOptions contains the optional parameters for the CommunityTrainingsClient.BeginCreate +// method. +func (client *CommunityTrainingsClient) BeginCreate(ctx context.Context, resourceGroupName string, communityTrainingName string, resource CommunityTraining, options *CommunityTrainingsClientBeginCreateOptions) (*runtime.Poller[CommunityTrainingsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, communityTrainingName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommunityTrainingsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CommunityTrainingsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CommunityTrainingsClient) create(ctx context.Context, resourceGroupName string, communityTrainingName string, resource CommunityTraining, options *CommunityTrainingsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CommunityTrainingsClient.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, communityTrainingName, 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 *CommunityTrainingsClient) createCreateRequest(ctx context.Context, resourceGroupName string, communityTrainingName string, resource CommunityTraining, options *CommunityTrainingsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + 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 communityTrainingName == "" { + return nil, errors.New("parameter communityTrainingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{communityTrainingName}", url.PathEscape(communityTrainingName)) + 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-11-01") + 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 - Delete a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - communityTrainingName - The name of the Community Training Resource +// - options - CommunityTrainingsClientBeginDeleteOptions contains the optional parameters for the CommunityTrainingsClient.BeginDelete +// method. +func (client *CommunityTrainingsClient) BeginDelete(ctx context.Context, resourceGroupName string, communityTrainingName string, options *CommunityTrainingsClientBeginDeleteOptions) (*runtime.Poller[CommunityTrainingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, communityTrainingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommunityTrainingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CommunityTrainingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CommunityTrainingsClient) deleteOperation(ctx context.Context, resourceGroupName string, communityTrainingName string, options *CommunityTrainingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CommunityTrainingsClient.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, communityTrainingName, 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 *CommunityTrainingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, communityTrainingName string, options *CommunityTrainingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + 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 communityTrainingName == "" { + return nil, errors.New("parameter communityTrainingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{communityTrainingName}", url.PathEscape(communityTrainingName)) + 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-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - communityTrainingName - The name of the Community Training Resource +// - options - CommunityTrainingsClientGetOptions contains the optional parameters for the CommunityTrainingsClient.Get method. +func (client *CommunityTrainingsClient) Get(ctx context.Context, resourceGroupName string, communityTrainingName string, options *CommunityTrainingsClientGetOptions) (CommunityTrainingsClientGetResponse, error) { + var err error + const operationName = "CommunityTrainingsClient.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, communityTrainingName, options) + if err != nil { + return CommunityTrainingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CommunityTrainingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommunityTrainingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CommunityTrainingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, communityTrainingName string, options *CommunityTrainingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + 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 communityTrainingName == "" { + return nil, errors.New("parameter communityTrainingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{communityTrainingName}", url.PathEscape(communityTrainingName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityTrainingsClient) getHandleResponse(resp *http.Response) (CommunityTrainingsClientGetResponse, error) { + result := CommunityTrainingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityTraining); err != nil { + return CommunityTrainingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List CommunityTraining resources by resource group +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CommunityTrainingsClientListByResourceGroupOptions contains the optional parameters for the CommunityTrainingsClient.NewListByResourceGroupPager +// method. +func (client *CommunityTrainingsClient) NewListByResourceGroupPager(resourceGroupName string, options *CommunityTrainingsClientListByResourceGroupOptions) *runtime.Pager[CommunityTrainingsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CommunityTrainingsClientListByResourceGroupResponse]{ + More: func(page CommunityTrainingsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CommunityTrainingsClientListByResourceGroupResponse) (CommunityTrainingsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CommunityTrainingsClient.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 CommunityTrainingsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CommunityTrainingsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CommunityTrainingsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings" + 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", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CommunityTrainingsClient) listByResourceGroupHandleResponse(resp *http.Response) (CommunityTrainingsClientListByResourceGroupResponse, error) { + result := CommunityTrainingsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { + return CommunityTrainingsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List CommunityTraining resources by subscription ID +// +// Generated from API version 2023-11-01 +// - options - CommunityTrainingsClientListBySubscriptionOptions contains the optional parameters for the CommunityTrainingsClient.NewListBySubscriptionPager +// method. +func (client *CommunityTrainingsClient) NewListBySubscriptionPager(options *CommunityTrainingsClientListBySubscriptionOptions) *runtime.Pager[CommunityTrainingsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CommunityTrainingsClientListBySubscriptionResponse]{ + More: func(page CommunityTrainingsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CommunityTrainingsClientListBySubscriptionResponse) (CommunityTrainingsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CommunityTrainingsClient.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 CommunityTrainingsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CommunityTrainingsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CommunityTrainingsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Community/communityTrainings" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CommunityTrainingsClient) listBySubscriptionHandleResponse(resp *http.Response) (CommunityTrainingsClientListBySubscriptionResponse, error) { + result := CommunityTrainingsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { + return CommunityTrainingsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - communityTrainingName - The name of the Community Training Resource +// - properties - The resource properties to be updated. +// - options - CommunityTrainingsClientBeginUpdateOptions contains the optional parameters for the CommunityTrainingsClient.BeginUpdate +// method. +func (client *CommunityTrainingsClient) BeginUpdate(ctx context.Context, resourceGroupName string, communityTrainingName string, properties Update, options *CommunityTrainingsClientBeginUpdateOptions) (*runtime.Poller[CommunityTrainingsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, communityTrainingName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommunityTrainingsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CommunityTrainingsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a CommunityTraining +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CommunityTrainingsClient) update(ctx context.Context, resourceGroupName string, communityTrainingName string, properties Update, options *CommunityTrainingsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CommunityTrainingsClient.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, communityTrainingName, 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 *CommunityTrainingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, communityTrainingName string, properties Update, options *CommunityTrainingsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}" + 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 communityTrainingName == "" { + return nil, errors.New("parameter communityTrainingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{communityTrainingName}", url.PathEscape(communityTrainingName)) + 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-11-01") + 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/communitytraining/armcommunitytraining/constants.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/constants.go new file mode 100644 index 000000000000..3c151ca14a0c --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/constants.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining" + moduleVersion = "v1.0.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, + } +} + +// SKUTier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but +// is not required on a PUT. +type SKUTier string + +const ( + SKUTierBasic SKUTier = "Basic" + SKUTierFree SKUTier = "Free" + SKUTierPremium SKUTier = "Premium" + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierBasic, + SKUTierFree, + SKUTierPremium, + SKUTierStandard, + } +} diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/communitytrainings_server.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/communitytrainings_server.go new file mode 100644 index 000000000000..ad16358d964c --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/communitytrainings_server.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/communitytraining/armcommunitytraining" + "net/http" + "net/url" + "regexp" +) + +// CommunityTrainingsServer is a fake server for instances of the armcommunitytraining.CommunityTrainingsClient type. +type CommunityTrainingsServer struct { + // BeginCreate is the fake for method CommunityTrainingsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, communityTrainingName string, resource armcommunitytraining.CommunityTraining, options *armcommunitytraining.CommunityTrainingsClientBeginCreateOptions) (resp azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CommunityTrainingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, communityTrainingName string, options *armcommunitytraining.CommunityTrainingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CommunityTrainingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, communityTrainingName string, options *armcommunitytraining.CommunityTrainingsClientGetOptions) (resp azfake.Responder[armcommunitytraining.CommunityTrainingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CommunityTrainingsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcommunitytraining.CommunityTrainingsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcommunitytraining.CommunityTrainingsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CommunityTrainingsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcommunitytraining.CommunityTrainingsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcommunitytraining.CommunityTrainingsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method CommunityTrainingsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, communityTrainingName string, properties armcommunitytraining.Update, options *armcommunitytraining.CommunityTrainingsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCommunityTrainingsServerTransport creates a new instance of CommunityTrainingsServerTransport with the provided implementation. +// The returned CommunityTrainingsServerTransport instance is connected to an instance of armcommunitytraining.CommunityTrainingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCommunityTrainingsServerTransport(srv *CommunityTrainingsServer) *CommunityTrainingsServerTransport { + return &CommunityTrainingsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcommunitytraining.CommunityTrainingsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcommunitytraining.CommunityTrainingsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientUpdateResponse]](), + } +} + +// CommunityTrainingsServerTransport connects instances of armcommunitytraining.CommunityTrainingsClient to instances of CommunityTrainingsServer. +// Don't use this type directly, use NewCommunityTrainingsServerTransport instead. +type CommunityTrainingsServerTransport struct { + srv *CommunityTrainingsServer + beginCreate *tracker[azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcommunitytraining.CommunityTrainingsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcommunitytraining.CommunityTrainingsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcommunitytraining.CommunityTrainingsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CommunityTrainingsServerTransport. +func (c *CommunityTrainingsServerTransport) 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 "CommunityTrainingsClient.BeginCreate": + resp, err = c.dispatchBeginCreate(req) + case "CommunityTrainingsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CommunityTrainingsClient.Get": + resp, err = c.dispatchGet(req) + case "CommunityTrainingsClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CommunityTrainingsClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CommunityTrainingsClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CommunityTrainingsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := c.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Community/communityTrainings/(?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[armcommunitytraining.CommunityTraining](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + communityTrainingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("communityTrainingName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameParam, communityTrainingNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + c.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) { + c.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) { + c.beginCreate.remove(req) + } + + return resp, nil +} + +func (c *CommunityTrainingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Community/communityTrainings/(?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 + } + communityTrainingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("communityTrainingName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, communityTrainingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.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) { + c.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) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CommunityTrainingsServerTransport) 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~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Community/communityTrainings/(?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 + } + communityTrainingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("communityTrainingName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, communityTrainingNameParam, 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).CommunityTraining, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CommunityTrainingsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Community/communityTrainings` + 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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcommunitytraining.CommunityTrainingsClientListByResourceGroupResponse, 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) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CommunityTrainingsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Community/communityTrainings` + 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 := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcommunitytraining.CommunityTrainingsClientListBySubscriptionResponse, 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) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CommunityTrainingsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Community/communityTrainings/(?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[armcommunitytraining.Update](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + communityTrainingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("communityTrainingName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, communityTrainingNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.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) { + c.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) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/internal.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/communitytraining/armcommunitytraining/fake/operations_server.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/operations_server.go new file mode 100644 index 000000000000..905fa95fcae0 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/communitytraining/armcommunitytraining" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcommunitytraining.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcommunitytraining.OperationsClientListOptions) (resp azfake.PagerResponder[armcommunitytraining.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcommunitytraining.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[armcommunitytraining.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcommunitytraining.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcommunitytraining.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armcommunitytraining.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 +} diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/server_factory.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/server_factory.go new file mode 100644 index 000000000000..8f941a6dd272 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/server_factory.go @@ -0,0 +1,82 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining.ClientFactory type. +type ServerFactory struct { + CommunityTrainingsServer CommunityTrainingsServer + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcommunitytraining.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 armcommunitytraining.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trCommunityTrainingsServer *CommunityTrainingsServerTransport + 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 "CommunityTrainingsClient": + initServer(s, &s.trCommunityTrainingsServer, func() *CommunityTrainingsServerTransport { + return NewCommunityTrainingsServerTransport(&s.srv.CommunityTrainingsServer) + }) + resp, err = s.trCommunityTrainingsServer.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/communitytraining/armcommunitytraining/fake/time_rfc3339.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/communitytraining/armcommunitytraining/go.mod b/sdk/resourcemanager/communitytraining/armcommunitytraining/go.mod new file mode 100644 index 000000000000..d108e2ded432 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/go.sum b/sdk/resourcemanager/communitytraining/armcommunitytraining/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/models.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/models.go new file mode 100644 index 000000000000..1179600177cc --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/models.go @@ -0,0 +1,243 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +import "time" + +// CommunityTraining - A CommunityProviderHub resource +type CommunityTraining struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *Properties + + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *SKU + + // 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 +} + +// IdentityConfigurationProperties - Details of the Community CommunityTraining Identity Configuration +type IdentityConfigurationProperties struct { + // REQUIRED; The clientId of the application registered in the selected identity provider for the Community Training Resource + ClientID *string + + // REQUIRED; The client secret of the application registered in the selected identity provider for the Community Training + // Resource + ClientSecret *string + + // REQUIRED; The domain name of the selected identity provider for the Community Training Resource + DomainName *string + + // REQUIRED; The identity type of the Community Training Resource + IdentityType *string + + // REQUIRED; The tenantId of the selected identity provider for the Community Training Resource + TenantID *string + + // The name of the authentication policy registered in ADB2C for the Community Training Resource + B2CAuthenticationPolicy *string + + // The name of the password reset policy registered in ADB2C for the Community Training Resource + B2CPasswordResetPolicy *string + + // The custom login parameters for the Community Training Resource + CustomLoginParameters *string + + // To indicate whether the Community Training Resource has Teams enabled + TeamsEnabled *bool +} + +// IdentityConfigurationPropertiesUpdate - Details of the Community CommunityTraining Identity Configuration +type IdentityConfigurationPropertiesUpdate struct { + // The name of the authentication policy registered in ADB2C for the Community Training Resource + B2CAuthenticationPolicy *string + + // The name of the password reset policy registered in ADB2C for the Community Training Resource + B2CPasswordResetPolicy *string + + // The clientId of the application registered in the selected identity provider for the Community Training Resource + ClientID *string + + // The client secret of the application registered in the selected identity provider for the Community Training Resource + ClientSecret *string + + // The custom login parameters for the Community Training Resource + CustomLoginParameters *string + + // The domain name of the selected identity provider for the Community Training Resource + DomainName *string + + // The identity type of the Community Training Resource + IdentityType *string + + // To indicate whether the Community Training Resource has Teams enabled + TeamsEnabled *bool + + // The tenantId of the selected identity provider for the Community Training Resource + TenantID *string +} + +// ListResult - The response of a CommunityTraining list operation. +type ListResult struct { + // REQUIRED; The CommunityTraining items on this page + Value []*CommunityTraining + + // The link to the next page of items + NextLink *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 +} + +// Properties - Details of the Community CommunityTraining. +type Properties struct { + // REQUIRED; To indicate whether the Community Training instance has Disaster Recovery enabled + DisasterRecoveryEnabled *bool + + // REQUIRED; The identity configuration of the Community Training resource + IdentityConfiguration *IdentityConfigurationProperties + + // REQUIRED; The email address of the portal admin + PortalAdminEmailAddress *string + + // REQUIRED; The portal name (website name) of the Community Training instance + PortalName *string + + // REQUIRED; The email address of the portal owner. Will be used as the primary contact + PortalOwnerEmailAddress *string + + // REQUIRED; The organization name of the portal owner + PortalOwnerOrganizationName *string + + // REQUIRED; To indicate whether the Community Training instance has Zone Redundancy enabled + ZoneRedundancyEnabled *bool + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// SKU - The resource model definition representing SKU +type SKU struct { + // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string + + // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the + // resource this may be omitted. + Capacity *int32 + + // If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string + + // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string + + // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required + // on a PUT. + Tier *SKUTier +} + +// 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 +} + +// Update - The type used for update operations of the CommunityTraining. +type Update struct { + // The resource-specific properties for this resource. + Properties *UpdateProperties + + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *SKU + + // Resource tags. + Tags map[string]*string +} + +// UpdateProperties - The updatable properties of the CommunityTraining. +type UpdateProperties struct { + // The identity configuration of the Community Training resource + IdentityConfiguration *IdentityConfigurationPropertiesUpdate +} diff --git a/sdk/resourcemanager/communitytraining/armcommunitytraining/models_serde.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/models_serde.go new file mode 100644 index 000000000000..9b159415d5f0 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/models_serde.go @@ -0,0 +1,560 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CommunityTraining. +func (c CommunityTraining) 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, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityTraining. +func (c *CommunityTraining) UnmarshalJSON(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 "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) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 IdentityConfigurationProperties. +func (i IdentityConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "b2cAuthenticationPolicy", i.B2CAuthenticationPolicy) + populate(objectMap, "b2cPasswordResetPolicy", i.B2CPasswordResetPolicy) + populate(objectMap, "clientId", i.ClientID) + populate(objectMap, "clientSecret", i.ClientSecret) + populate(objectMap, "customLoginParameters", i.CustomLoginParameters) + populate(objectMap, "domainName", i.DomainName) + populate(objectMap, "identityType", i.IdentityType) + populate(objectMap, "teamsEnabled", i.TeamsEnabled) + populate(objectMap, "tenantId", i.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityConfigurationProperties. +func (i *IdentityConfigurationProperties) UnmarshalJSON(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 "b2cAuthenticationPolicy": + err = unpopulate(val, "B2CAuthenticationPolicy", &i.B2CAuthenticationPolicy) + delete(rawMsg, key) + case "b2cPasswordResetPolicy": + err = unpopulate(val, "B2CPasswordResetPolicy", &i.B2CPasswordResetPolicy) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &i.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &i.ClientSecret) + delete(rawMsg, key) + case "customLoginParameters": + err = unpopulate(val, "CustomLoginParameters", &i.CustomLoginParameters) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &i.DomainName) + delete(rawMsg, key) + case "identityType": + err = unpopulate(val, "IdentityType", &i.IdentityType) + delete(rawMsg, key) + case "teamsEnabled": + err = unpopulate(val, "TeamsEnabled", &i.TeamsEnabled) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + 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 IdentityConfigurationPropertiesUpdate. +func (i IdentityConfigurationPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "b2cAuthenticationPolicy", i.B2CAuthenticationPolicy) + populate(objectMap, "b2cPasswordResetPolicy", i.B2CPasswordResetPolicy) + populate(objectMap, "clientId", i.ClientID) + populate(objectMap, "clientSecret", i.ClientSecret) + populate(objectMap, "customLoginParameters", i.CustomLoginParameters) + populate(objectMap, "domainName", i.DomainName) + populate(objectMap, "identityType", i.IdentityType) + populate(objectMap, "teamsEnabled", i.TeamsEnabled) + populate(objectMap, "tenantId", i.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityConfigurationPropertiesUpdate. +func (i *IdentityConfigurationPropertiesUpdate) UnmarshalJSON(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 "b2cAuthenticationPolicy": + err = unpopulate(val, "B2CAuthenticationPolicy", &i.B2CAuthenticationPolicy) + delete(rawMsg, key) + case "b2cPasswordResetPolicy": + err = unpopulate(val, "B2CPasswordResetPolicy", &i.B2CPasswordResetPolicy) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &i.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &i.ClientSecret) + delete(rawMsg, key) + case "customLoginParameters": + err = unpopulate(val, "CustomLoginParameters", &i.CustomLoginParameters) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &i.DomainName) + delete(rawMsg, key) + case "identityType": + err = unpopulate(val, "IdentityType", &i.IdentityType) + delete(rawMsg, key) + case "teamsEnabled": + err = unpopulate(val, "TeamsEnabled", &i.TeamsEnabled) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + 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 ListResult. +func (l ListResult) 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 ListResult. +func (l *ListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + 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 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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disasterRecoveryEnabled", p.DisasterRecoveryEnabled) + populate(objectMap, "identityConfiguration", p.IdentityConfiguration) + populate(objectMap, "portalAdminEmailAddress", p.PortalAdminEmailAddress) + populate(objectMap, "portalName", p.PortalName) + populate(objectMap, "portalOwnerEmailAddress", p.PortalOwnerEmailAddress) + populate(objectMap, "portalOwnerOrganizationName", p.PortalOwnerOrganizationName) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "zoneRedundancyEnabled", p.ZoneRedundancyEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(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 "disasterRecoveryEnabled": + err = unpopulate(val, "DisasterRecoveryEnabled", &p.DisasterRecoveryEnabled) + delete(rawMsg, key) + case "identityConfiguration": + err = unpopulate(val, "IdentityConfiguration", &p.IdentityConfiguration) + delete(rawMsg, key) + case "portalAdminEmailAddress": + err = unpopulate(val, "PortalAdminEmailAddress", &p.PortalAdminEmailAddress) + delete(rawMsg, key) + case "portalName": + err = unpopulate(val, "PortalName", &p.PortalName) + delete(rawMsg, key) + case "portalOwnerEmailAddress": + err = unpopulate(val, "PortalOwnerEmailAddress", &p.PortalOwnerEmailAddress) + delete(rawMsg, key) + case "portalOwnerOrganizationName": + err = unpopulate(val, "PortalOwnerOrganizationName", &p.PortalOwnerOrganizationName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "zoneRedundancyEnabled": + err = unpopulate(val, "ZoneRedundancyEnabled", &p.ZoneRedundancyEnabled) + 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 SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "family", s.Family) + populate(objectMap, "name", s.Name) + populate(objectMap, "size", s.Size) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(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 "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + 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 Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "sku", u.SKU) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &u.SKU) + 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 UpdateProperties. +func (u UpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identityConfiguration", u.IdentityConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties. +func (u *UpdateProperties) UnmarshalJSON(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 "identityConfiguration": + err = unpopulate(val, "IdentityConfiguration", &u.IdentityConfiguration) + 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 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/communitytraining/armcommunitytraining/operations_client.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/operations_client.go new file mode 100644 index 000000000000..408be23444de --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +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 2023-11-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]{ + 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.Community/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-11-01") + 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/communitytraining/armcommunitytraining/options.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/options.go new file mode 100644 index 000000000000..dc33dd376a96 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/options.go @@ -0,0 +1,52 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +// CommunityTrainingsClientBeginCreateOptions contains the optional parameters for the CommunityTrainingsClient.BeginCreate +// method. +type CommunityTrainingsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommunityTrainingsClientBeginDeleteOptions contains the optional parameters for the CommunityTrainingsClient.BeginDelete +// method. +type CommunityTrainingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommunityTrainingsClientBeginUpdateOptions contains the optional parameters for the CommunityTrainingsClient.BeginUpdate +// method. +type CommunityTrainingsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommunityTrainingsClientGetOptions contains the optional parameters for the CommunityTrainingsClient.Get method. +type CommunityTrainingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CommunityTrainingsClientListByResourceGroupOptions contains the optional parameters for the CommunityTrainingsClient.NewListByResourceGroupPager +// method. +type CommunityTrainingsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CommunityTrainingsClientListBySubscriptionOptions contains the optional parameters for the CommunityTrainingsClient.NewListBySubscriptionPager +// method. +type CommunityTrainingsClientListBySubscriptionOptions 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/communitytraining/armcommunitytraining/responses.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/responses.go new file mode 100644 index 000000000000..2c325c430d81 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/responses.go @@ -0,0 +1,50 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +// CommunityTrainingsClientCreateResponse contains the response from method CommunityTrainingsClient.BeginCreate. +type CommunityTrainingsClientCreateResponse struct { + // A CommunityProviderHub resource + CommunityTraining +} + +// CommunityTrainingsClientDeleteResponse contains the response from method CommunityTrainingsClient.BeginDelete. +type CommunityTrainingsClientDeleteResponse struct { + // placeholder for future response values +} + +// CommunityTrainingsClientGetResponse contains the response from method CommunityTrainingsClient.Get. +type CommunityTrainingsClientGetResponse struct { + // A CommunityProviderHub resource + CommunityTraining +} + +// CommunityTrainingsClientListByResourceGroupResponse contains the response from method CommunityTrainingsClient.NewListByResourceGroupPager. +type CommunityTrainingsClientListByResourceGroupResponse struct { + // The response of a CommunityTraining list operation. + ListResult +} + +// CommunityTrainingsClientListBySubscriptionResponse contains the response from method CommunityTrainingsClient.NewListBySubscriptionPager. +type CommunityTrainingsClientListBySubscriptionResponse struct { + // The response of a CommunityTraining list operation. + ListResult +} + +// CommunityTrainingsClientUpdateResponse contains the response from method CommunityTrainingsClient.BeginUpdate. +type CommunityTrainingsClientUpdateResponse struct { + // A CommunityProviderHub resource + CommunityTraining +} + +// 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/communitytraining/armcommunitytraining/time_rfc3339.go b/sdk/resourcemanager/communitytraining/armcommunitytraining/time_rfc3339.go new file mode 100644 index 000000000000..abec8b90b451 --- /dev/null +++ b/sdk/resourcemanager/communitytraining/armcommunitytraining/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcommunitytraining + +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/computefleet/armcomputefleet/CHANGELOG.md b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md index b61979e0d279..cc3eafe10a16 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md +++ b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-08-09) +### Other Changes + + ## 0.1.0 (2024-07-26) ### Other Changes diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go index c49940367a6f..823dc40ad57f 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go @@ -6,7 +6,7 @@ package armcomputefleet const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go new file mode 100644 index 000000000000..e31a88f00c6a --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go @@ -0,0 +1,3114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcomputefleet_test + +import ( + "context" + "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/computefleet/armcomputefleet" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_CreateOrUpdate.json +func ExampleFleetsClient_BeginCreateOrUpdate_fleetsCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginCreateOrUpdate(ctx, "rgazurefleet", "testFleet", armcomputefleet.Fleet{ + Properties: &armcomputefleet.FleetProperties{ + SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + Capacity: to.Ptr[int32](20), + MinCapacity: to.Ptr[int32](10), + MaxPricePerVM: to.Ptr[float32](0.00865), + EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + Maintain: to.Ptr(true), + }, + RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + Capacity: to.Ptr[int32](20), + MinCapacity: to.Ptr[int32](10), + AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + }, + VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + { + Name: to.Ptr("Standard_d1_v2"), + Rank: to.Ptr[int32](19225), + }, + }, + ComputeProfile: &armcomputefleet.ComputeProfile{ + BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + ComputerNamePrefix: to.Ptr("o"), + AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + AdminPassword: to.Ptr("adfbrdxpv"), + CustomData: to.Ptr("xjjib"), + WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + ProvisionVMAgent: to.Ptr(true), + EnableAutomaticUpdates: to.Ptr(true), + TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + { + PassName: to.Ptr("OobeSystem"), + ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + Content: to.Ptr("bubmqbxjkj"), + }, + }, + PatchSettings: &armcomputefleet.PatchSettings{ + PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + EnableHotpatching: to.Ptr(true), + AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + }, + }, + WinRM: &armcomputefleet.WinRMConfiguration{ + Listeners: []*armcomputefleet.WinRMListener{ + { + Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + CertificateURL: to.Ptr("phwesineizrl"), + }, + }, + }, + EnableVMAgentPlatformUpdates: to.Ptr(true), + }, + LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + SSH: &armcomputefleet.SSHConfiguration{ + PublicKeys: []*armcomputefleet.SSHPublicKey{ + { + Path: to.Ptr("kmqz"), + KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + }, + }, + }, + ProvisionVMAgent: to.Ptr(true), + PatchSettings: &armcomputefleet.LinuxPatchSettings{ + PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + }, + }, + EnableVMAgentPlatformUpdates: to.Ptr(true), + }, + Secrets: []*armcomputefleet.VaultSecretGroup{ + { + SourceVault: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + }, + VaultCertificates: []*armcomputefleet.VaultCertificate{ + { + CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + }, + }, + }, + }, + AllowExtensionOperations: to.Ptr(true), + RequireGuestProvisionSignal: to.Ptr(true), + }, + StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + ImageReference: &armcomputefleet.ImageReference{ + Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + Offer: to.Ptr("isxgumkarlkomp"), + SKU: to.Ptr("eojmppqcrnpmxirtp"), + Version: to.Ptr("wvpcqefgtmqdgltiuz"), + SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + CommunityGalleryImageID: to.Ptr("vlqe"), + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + }, + OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + Name: to.Ptr("wfttw"), + Caching: to.Ptr(armcomputefleet.CachingTypesNone), + WriteAcceleratorEnabled: to.Ptr(true), + CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + }, + DiskSizeGB: to.Ptr[int32](14), + OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + Image: &armcomputefleet.VirtualHardDisk{ + URI: to.Ptr("thqceubivdrjs"), + }, + VhdContainers: []*string{ + to.Ptr("tkzcwddtinkfpnfklatw"), + }, + ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + }, + }, + DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + }, + DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + { + Name: to.Ptr("eogiykmdmeikswxmigjws"), + Lun: to.Ptr[int32](14), + Caching: to.Ptr(armcomputefleet.CachingTypesNone), + WriteAcceleratorEnabled: to.Ptr(true), + CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + DiskSizeGB: to.Ptr[int32](6), + ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + }, + }, + DiskIOPSReadWrite: to.Ptr[int64](27), + DiskMBpsReadWrite: to.Ptr[int64](2), + DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + }, + }, + }, + NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + HealthProbe: &armcomputefleet.APIEntityReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + }, + NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + { + Name: to.Ptr("i"), + Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + Primary: to.Ptr(true), + EnableAcceleratedNetworking: to.Ptr(true), + DisableTCPStateTracking: to.Ptr(true), + EnableFpga: to.Ptr(true), + NetworkSecurityGroup: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + }, + DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + DNSServers: []*string{ + to.Ptr("nxmmfolhclsesu"), + }, + }, + IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + { + Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + Subnet: &armcomputefleet.APIEntityReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + }, + Primary: to.Ptr(true), + PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + Name: to.Ptr("fvpqf"), + Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + IdleTimeoutInMinutes: to.Ptr[int32](9), + DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + }, + IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + { + IPTagType: to.Ptr("sddgsoemnzgqizale"), + Tag: to.Ptr("wufmhrjsakbiaetyara"), + }, + }, + PublicIPPrefix: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + }, + PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + }, + SKU: &armcomputefleet.PublicIPAddressSKU{ + Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + }, + }, + PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + }, + }, + ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + }, + }, + LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + }, + }, + LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + }, + }, + }, + }, + }, + EnableIPForwarding: to.Ptr(true), + DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + }, + }, + }, + NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + }, + SecurityProfile: &armcomputefleet.SecurityProfile{ + UefiSettings: &armcomputefleet.UefiSettings{ + SecureBootEnabled: to.Ptr(true), + VTpmEnabled: to.Ptr(true), + }, + EncryptionAtHost: to.Ptr(true), + SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + }, + ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + Enabled: to.Ptr(true), + Mode: to.Ptr(armcomputefleet.ModeAudit), + KeyIncarnationID: to.Ptr[int32](20), + }, + }, + DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + BootDiagnostics: &armcomputefleet.BootDiagnostics{ + Enabled: to.Ptr(true), + StorageURI: to.Ptr("rzamfwghybpx"), + }, + }, + ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + { + Name: to.Ptr("bndxuxx"), + Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + ForceUpdateTag: to.Ptr("yhgxw"), + Publisher: to.Ptr("kpxtirxjfprhs"), + Type: to.Ptr("pgjilctjjwaa"), + TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + AutoUpgradeMinorVersion: to.Ptr(true), + EnableAutomaticUpgrade: to.Ptr(true), + Settings: map[string]any{}, + ProtectedSettings: map[string]any{}, + ProvisionAfterExtensions: []*string{ + to.Ptr("nftzosroolbcwmpupujzqwqe"), + }, + SuppressFailures: to.Ptr(true), + ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + SourceVault: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + }, + }, + }, + }, + }, + ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + }, + LicenseType: to.Ptr("v"), + ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + NotBeforeTimeout: to.Ptr("iljppmmw"), + Enable: to.Ptr(true), + }, + OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + Enable: to.Ptr(true), + }, + }, + UserData: to.Ptr("s"), + CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + CapacityReservationGroup: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + }, + }, + ApplicationProfile: &armcomputefleet.ApplicationProfile{ + GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + { + Tags: to.Ptr("eyrqjbib"), + Order: to.Ptr[int32](5), + PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + ConfigurationReference: to.Ptr("ulztmiavpojpbpbddgnuuiimxcpau"), + TreatFailureAsDeploymentFailure: to.Ptr(true), + EnableAutomaticUpgrade: to.Ptr(true), + }, + }, + }, + HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + VMSizeProperties: &armcomputefleet.VMSizeProperties{ + VCPUsAvailable: to.Ptr[int32](16), + VCPUsPerCore: to.Ptr[int32](23), + }, + }, + ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + }, + SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), + ExcludeExtensions: []*string{ + to.Ptr("{securityPostureVMExtensionName}"), + }, + IsOverridable: to.Ptr(true), + }, + }, + ComputeAPIVersion: to.Ptr("2023-07-01"), + PlatformFaultDomainCount: to.Ptr[int32](1), + }, + }, + Zones: []*string{ + to.Ptr("zone1"), + to.Ptr("zone2"), + }, + Identity: &armcomputefleet.ManagedServiceIdentity{ + Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{ + "key9851": {}, + }, + }, + Tags: map[string]*string{ + "key3518": to.Ptr("luvrnuvsgdpbuofdskkcoqhfh"), + }, + Location: to.Ptr("westus"), + Plan: &armcomputefleet.Plan{ + Name: to.Ptr("jwgrcrnrtfoxn"), + Publisher: to.Ptr("iozjbiqqckqm"), + Product: to.Ptr("cgopbyvdyqikahwyxfpzwaqk"), + PromotionCode: to.Ptr("naglezezplcaruqogtxnuizslqnnbr"), + Version: to.Ptr("wa"), + }, + }, 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 = armcomputefleet.FleetsClientCreateOrUpdateResponse{ + // Fleet: &armcomputefleet.Fleet{ + // Properties: &armcomputefleet.FleetProperties{ + // ProvisioningState: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + // Capacity: to.Ptr[int32](10), + // MinCapacity: to.Ptr[int32](20), + // MaxPricePerVM: to.Ptr[float32](0.00865), + // EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + // AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + // Maintain: to.Ptr(true), + // }, + // RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + // Capacity: to.Ptr[int32](10), + // MinCapacity: to.Ptr[int32](10), + // AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + // }, + // VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + // { + // Name: to.Ptr("Standard_d1_v2"), + // Rank: to.Ptr[int32](19225), + // }, + // }, + // ComputeProfile: &armcomputefleet.ComputeProfile{ + // BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + // OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + // ComputerNamePrefix: to.Ptr("o"), + // AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + // WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + // ProvisionVMAgent: to.Ptr(true), + // EnableAutomaticUpdates: to.Ptr(true), + // TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + // AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + // { + // PassName: to.Ptr("OobeSystem"), + // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + // SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + // }, + // }, + // PatchSettings: &armcomputefleet.PatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + // EnableHotpatching: to.Ptr(true), + // AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // WinRM: &armcomputefleet.WinRMConfiguration{ + // Listeners: []*armcomputefleet.WinRMListener{ + // { + // Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + // CertificateURL: to.Ptr("phwesineizrl"), + // }, + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // SSH: &armcomputefleet.SSHConfiguration{ + // PublicKeys: []*armcomputefleet.SSHPublicKey{ + // { + // Path: to.Ptr("kmqz"), + // KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + // }, + // }, + // }, + // ProvisionVMAgent: to.Ptr(true), + // PatchSettings: &armcomputefleet.LinuxPatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + // AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // Secrets: []*armcomputefleet.VaultSecretGroup{ + // { + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // VaultCertificates: []*armcomputefleet.VaultCertificate{ + // { + // CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + // CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + // }, + // }, + // }, + // }, + // AllowExtensionOperations: to.Ptr(true), + // RequireGuestProvisionSignal: to.Ptr(true), + // }, + // StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + // ImageReference: &armcomputefleet.ImageReference{ + // Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + // Offer: to.Ptr("isxgumkarlkomp"), + // SKU: to.Ptr("eojmppqcrnpmxirtp"), + // Version: to.Ptr("wvpcqefgtmqdgltiuz"), + // ExactVersion: to.Ptr("zjbntmiskjexlr"), + // SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + // CommunityGalleryImageID: to.Ptr("vlqe"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + // }, + // OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + // Name: to.Ptr("wfttw"), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + // Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + // Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + // }, + // DiskSizeGB: to.Ptr[int32](14), + // OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + // Image: &armcomputefleet.VirtualHardDisk{ + // URI: to.Ptr("thqceubivdrjs"), + // }, + // VhdContainers: []*string{ + // to.Ptr("tkzcwddtinkfpnfklatw"), + // }, + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + // { + // Name: to.Ptr("eogiykmdmeikswxmigjws"), + // Lun: to.Ptr[int32](14), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiskSizeGB: to.Ptr[int32](6), + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DiskIOPSReadWrite: to.Ptr[int64](27), + // DiskMBpsReadWrite: to.Ptr[int64](2), + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // }, + // }, + // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + // HealthProbe: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + // }, + // NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + // { + // Name: to.Ptr("i"), + // Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + // Primary: to.Ptr(true), + // EnableAcceleratedNetworking: to.Ptr(true), + // DisableTCPStateTracking: to.Ptr(true), + // EnableFpga: to.Ptr(true), + // NetworkSecurityGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + // }, + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + // DNSServers: []*string{ + // to.Ptr("nxmmfolhclsesu"), + // }, + // }, + // IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + // { + // Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + // Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + // Subnet: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + // }, + // Primary: to.Ptr(true), + // PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + // Name: to.Ptr("fvpqf"), + // Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + // IdleTimeoutInMinutes: to.Ptr[int32](9), + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + // DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + // DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + // }, + // IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + // { + // IPTagType: to.Ptr("sddgsoemnzgqizale"), + // Tag: to.Ptr("wufmhrjsakbiaetyara"), + // }, + // }, + // PublicIPPrefix: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + // }, + // PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // }, + // SKU: &armcomputefleet.PublicIPAddressSKU{ + // Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + // Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + // }, + // }, + // PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + // }, + // }, + // LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + // }, + // }, + // }, + // }, + // }, + // EnableIPForwarding: to.Ptr(true), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + // AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + // }, + // }, + // }, + // NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + // }, + // SecurityProfile: &armcomputefleet.SecurityProfile{ + // UefiSettings: &armcomputefleet.UefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // VTpmEnabled: to.Ptr(true), + // }, + // EncryptionAtHost: to.Ptr(true), + // SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + // EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + // }, + // ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + // Enabled: to.Ptr(true), + // Mode: to.Ptr(armcomputefleet.ModeAudit), + // KeyIncarnationID: to.Ptr[int32](20), + // }, + // }, + // DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + // BootDiagnostics: &armcomputefleet.BootDiagnostics{ + // Enabled: to.Ptr(true), + // StorageURI: to.Ptr("rzamfwghybpx"), + // }, + // }, + // ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + // Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + // { + // Name: to.Ptr("bndxuxx"), + // Type: to.Ptr("cmeam"), + // Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + // ForceUpdateTag: to.Ptr("yhgxw"), + // Publisher: to.Ptr("kpxtirxjfprhs"), + // Type: to.Ptr("pgjilctjjwaa"), + // TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + // AutoUpgradeMinorVersion: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // Settings: map[string]any{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // ProvisionAfterExtensions: []*string{ + // to.Ptr("nftzosroolbcwmpupujzqwqe"), + // }, + // SuppressFailures: to.Ptr(true), + // ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + // SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{extensionName}"), + // }, + // }, + // ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + // }, + // LicenseType: to.Ptr("v"), + // ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + // TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + // NotBeforeTimeout: to.Ptr("iljppmmw"), + // Enable: to.Ptr(true), + // }, + // OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + // NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + // Enable: to.Ptr(true), + // }, + // }, + // UserData: to.Ptr("s"), + // CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + // CapacityReservationGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + // }, + // }, + // ApplicationProfile: &armcomputefleet.ApplicationProfile{ + // GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + // { + // Tags: to.Ptr("eyrqjbib"), + // Order: to.Ptr[int32](5), + // PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + // TreatFailureAsDeploymentFailure: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // }, + // }, + // }, + // HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + // VMSizeProperties: &armcomputefleet.VMSizeProperties{ + // VCPUsAvailable: to.Ptr[int32](16), + // VCPUsPerCore: to.Ptr[int32](23), + // }, + // }, + // ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + // }, + // SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + // ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), + // ExcludeExtensions: []*string{ + // to.Ptr("{securityPostureVMExtensionName}"), + // }, + // IsOverridable: to.Ptr(true), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // ComputeAPIVersion: to.Ptr("2023-07-01"), + // PlatformFaultDomainCount: to.Ptr[int32](1), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-10T00:16:34.8590555+00:00"); return t}()), + // UniqueID: to.Ptr("a2f7fabd-bbc2-4a20-afe1-49fdb3885a28"), + // }, + // Zones: []*string{ + // to.Ptr("zone1"), + // to.Ptr("zone2"), + // }, + // Identity: &armcomputefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("4d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // TenantID: to.Ptr("5d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{ + // "key9851": &armcomputefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("6d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // ClientID: to.Ptr("7d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // }, + // }, + // }, + // Plan: &armcomputefleet.Plan{ + // Name: to.Ptr("jwgrcrnrtfoxn"), + // Publisher: to.Ptr("iozjbiqqckqm"), + // Product: to.Ptr("cgopbyvdyqikahwyxfpzwaqk"), + // PromotionCode: to.Ptr("naglezezplcaruqogtxnuizslqnnbr"), + // Version: to.Ptr("wa"), + // }, + // Tags: map[string]*string{ + // "key3518": to.Ptr("luvrnuvsgdpbuofdskkcoqhfh"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/testFleet"), + // Name: to.Ptr("testFleet"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets"), + // SystemData: &armcomputefleet.SystemData{ + // CreatedBy: to.Ptr("rowegentrpoajsv"), + // CreatedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // LastModifiedBy: to.Ptr("edwuayhhaoepxzisfaqjhmrxjq"), + // LastModifiedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_CreateOrUpdate_MinimumSet.json +func ExampleFleetsClient_BeginCreateOrUpdate_fleetsCreateOrUpdateMinimumSet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginCreateOrUpdate(ctx, "rgazurefleet", "testFleet", armcomputefleet.Fleet{ + Properties: &armcomputefleet.FleetProperties{ + SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + Capacity: to.Ptr[int32](2), + MinCapacity: to.Ptr[int32](1), + EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + Maintain: to.Ptr(true), + }, + RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + Capacity: to.Ptr[int32](2), + MinCapacity: to.Ptr[int32](1), + AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + }, + VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + { + Name: to.Ptr("Standard_D2s_v3"), + }, + { + Name: to.Ptr("Standard_D4s_v3"), + }, + { + Name: to.Ptr("Standard_E2s_v3"), + }, + }, + ComputeProfile: &armcomputefleet.ComputeProfile{ + BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + ImageReference: &armcomputefleet.ImageReference{ + Publisher: to.Ptr("canonical"), + Offer: to.Ptr("0001-com-ubuntu-server-focal"), + SKU: to.Ptr("20_04-lts-gen2"), + Version: to.Ptr("latest"), + }, + OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + Caching: to.Ptr(armcomputefleet.CachingTypesReadWrite), + CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + OSType: to.Ptr(armcomputefleet.OperatingSystemTypesLinux), + ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + }, + }, + }, + OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + ComputerNamePrefix: to.Ptr("prefix"), + AdminUsername: to.Ptr("azureuser"), + AdminPassword: to.Ptr("TestPassword$0"), + LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(false), + }, + }, + NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + { + Name: to.Ptr("vmNameTest"), + Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + Primary: to.Ptr(true), + EnableAcceleratedNetworking: to.Ptr(false), + IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + { + Name: to.Ptr("vmNameTest"), + Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + Subnet: &armcomputefleet.APIEntityReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + }, + Primary: to.Ptr(true), + LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + }, + }, + }, + }, + }, + EnableIPForwarding: to.Ptr(true), + }, + }, + }, + }, + }, + ComputeAPIVersion: to.Ptr("2023-09-01"), + PlatformFaultDomainCount: to.Ptr[int32](1), + }, + }, + Tags: map[string]*string{ + "key": to.Ptr("fleets-test"), + }, + Location: to.Ptr("eastus2euap"), + }, 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 = armcomputefleet.FleetsClientCreateOrUpdateResponse{ + // Fleet: &armcomputefleet.Fleet{ + // Properties: &armcomputefleet.FleetProperties{ + // ProvisioningState: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + // Capacity: to.Ptr[int32](2), + // MinCapacity: to.Ptr[int32](1), + // EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + // AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + // Maintain: to.Ptr(true), + // }, + // RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + // Capacity: to.Ptr[int32](2), + // MinCapacity: to.Ptr[int32](1), + // AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + // }, + // VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + // { + // Name: to.Ptr("Standard_D2s_v3"), + // }, + // { + // Name: to.Ptr("Standard_D4s_v3"), + // }, + // { + // Name: to.Ptr("Standard_E2s_v3"), + // }, + // }, + // ComputeProfile: &armcomputefleet.ComputeProfile{ + // BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + // StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + // ImageReference: &armcomputefleet.ImageReference{ + // Publisher: to.Ptr("canonical"), + // Offer: to.Ptr("0001-com-ubuntu-server-focal"), + // SKU: to.Ptr("20_04-lts-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + // Caching: to.Ptr(armcomputefleet.CachingTypesReadWrite), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // OSType: to.Ptr(armcomputefleet.OperatingSystemTypesLinux), + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // }, + // }, + // }, + // OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + // ComputerNamePrefix: to.Ptr("prefix"), + // AdminUsername: to.Ptr("azureuser"), + // LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(false), + // }, + // }, + // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + // NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + // { + // Name: to.Ptr("vmNameTest"), + // Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + // Primary: to.Ptr(true), + // EnableAcceleratedNetworking: to.Ptr(false), + // IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + // { + // Name: to.Ptr("vmNameTest"), + // Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + // Subnet: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + // }, + // Primary: to.Ptr(true), + // LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // }, + // }, + // }, + // EnableIPForwarding: to.Ptr(true), + // }, + // }, + // }, + // }, + // }, + // ComputeAPIVersion: to.Ptr("2023-09-01"), + // PlatformFaultDomainCount: to.Ptr[int32](1), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-10T00:16:34.8590555+00:00"); return t}()), + // UniqueID: to.Ptr("a2f7fabd-bbc2-4a20-afe1-49fdb3885a28"), + // }, + // Tags: map[string]*string{ + // "key": to.Ptr("fleets-test"), + // }, + // Location: to.Ptr("eastus2euap"), + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/testFleet"), + // Name: to.Ptr("testFleet"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets"), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_Delete.json +func ExampleFleetsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rgazurefleet", "testFleet", 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: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_Get.json +func ExampleFleetsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetsClient().Get(ctx, "rgazurefleet", "testFleet", 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 = armcomputefleet.FleetsClientGetResponse{ + // Fleet: &armcomputefleet.Fleet{ + // Properties: &armcomputefleet.FleetProperties{ + // ProvisioningState: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // MaxPricePerVM: to.Ptr[float32](0.00865), + // EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + // AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + // Maintain: to.Ptr(true), + // }, + // RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + // }, + // VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + // { + // Name: to.Ptr("Standard_d1_v2"), + // Rank: to.Ptr[int32](19225), + // }, + // }, + // ComputeProfile: &armcomputefleet.ComputeProfile{ + // BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + // OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + // ComputerNamePrefix: to.Ptr("o"), + // AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + // WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + // ProvisionVMAgent: to.Ptr(true), + // EnableAutomaticUpdates: to.Ptr(true), + // TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + // AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + // { + // PassName: to.Ptr("OobeSystem"), + // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + // SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + // }, + // }, + // PatchSettings: &armcomputefleet.PatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + // EnableHotpatching: to.Ptr(true), + // AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // WinRM: &armcomputefleet.WinRMConfiguration{ + // Listeners: []*armcomputefleet.WinRMListener{ + // { + // Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + // CertificateURL: to.Ptr("phwesineizrl"), + // }, + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // SSH: &armcomputefleet.SSHConfiguration{ + // PublicKeys: []*armcomputefleet.SSHPublicKey{ + // { + // Path: to.Ptr("kmqz"), + // KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + // }, + // }, + // }, + // ProvisionVMAgent: to.Ptr(true), + // PatchSettings: &armcomputefleet.LinuxPatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + // AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // Secrets: []*armcomputefleet.VaultSecretGroup{ + // { + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // VaultCertificates: []*armcomputefleet.VaultCertificate{ + // { + // CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + // CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + // }, + // }, + // }, + // }, + // AllowExtensionOperations: to.Ptr(true), + // RequireGuestProvisionSignal: to.Ptr(true), + // }, + // StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + // ImageReference: &armcomputefleet.ImageReference{ + // Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + // Offer: to.Ptr("isxgumkarlkomp"), + // SKU: to.Ptr("eojmppqcrnpmxirtp"), + // Version: to.Ptr("wvpcqefgtmqdgltiuz"), + // ExactVersion: to.Ptr("zjbntmiskjexlr"), + // SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + // CommunityGalleryImageID: to.Ptr("vlqe"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + // }, + // OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + // Name: to.Ptr("wfttw"), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + // Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + // Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + // }, + // DiskSizeGB: to.Ptr[int32](14), + // OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + // Image: &armcomputefleet.VirtualHardDisk{ + // URI: to.Ptr("thqceubivdrjs"), + // }, + // VhdContainers: []*string{ + // to.Ptr("tkzcwddtinkfpnfklatw"), + // }, + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + // { + // Name: to.Ptr("eogiykmdmeikswxmigjws"), + // Lun: to.Ptr[int32](14), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiskSizeGB: to.Ptr[int32](6), + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DiskIOPSReadWrite: to.Ptr[int64](27), + // DiskMBpsReadWrite: to.Ptr[int64](2), + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // }, + // }, + // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + // HealthProbe: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + // }, + // NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + // { + // Name: to.Ptr("i"), + // Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + // Primary: to.Ptr(true), + // EnableAcceleratedNetworking: to.Ptr(true), + // DisableTCPStateTracking: to.Ptr(true), + // EnableFpga: to.Ptr(true), + // NetworkSecurityGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + // }, + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + // DNSServers: []*string{ + // to.Ptr("nxmmfolhclsesu"), + // }, + // }, + // IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + // { + // Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + // Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + // Subnet: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + // }, + // Primary: to.Ptr(true), + // PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + // Name: to.Ptr("fvpqf"), + // Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + // IdleTimeoutInMinutes: to.Ptr[int32](9), + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + // DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + // DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + // }, + // IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + // { + // IPTagType: to.Ptr("sddgsoemnzgqizale"), + // Tag: to.Ptr("wufmhrjsakbiaetyara"), + // }, + // }, + // PublicIPPrefix: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + // }, + // PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // }, + // SKU: &armcomputefleet.PublicIPAddressSKU{ + // Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + // Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + // }, + // }, + // PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + // }, + // }, + // LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + // }, + // }, + // }, + // }, + // }, + // EnableIPForwarding: to.Ptr(true), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + // AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + // }, + // }, + // }, + // NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + // }, + // SecurityProfile: &armcomputefleet.SecurityProfile{ + // UefiSettings: &armcomputefleet.UefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // VTpmEnabled: to.Ptr(true), + // }, + // EncryptionAtHost: to.Ptr(true), + // SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + // EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + // }, + // ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + // Enabled: to.Ptr(true), + // Mode: to.Ptr(armcomputefleet.ModeAudit), + // KeyIncarnationID: to.Ptr[int32](20), + // }, + // }, + // DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + // BootDiagnostics: &armcomputefleet.BootDiagnostics{ + // Enabled: to.Ptr(true), + // StorageURI: to.Ptr("rzamfwghybpx"), + // }, + // }, + // ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + // Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + // { + // Name: to.Ptr("bndxuxx"), + // Type: to.Ptr("cmeam"), + // Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + // ForceUpdateTag: to.Ptr("yhgxw"), + // Publisher: to.Ptr("kpxtirxjfprhs"), + // Type: to.Ptr("pgjilctjjwaa"), + // TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + // AutoUpgradeMinorVersion: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // Settings: map[string]any{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // ProvisionAfterExtensions: []*string{ + // to.Ptr("nftzosroolbcwmpupujzqwqe"), + // }, + // SuppressFailures: to.Ptr(true), + // ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + // SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{extensionName}"), + // }, + // }, + // ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + // }, + // LicenseType: to.Ptr("v"), + // ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + // TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + // NotBeforeTimeout: to.Ptr("iljppmmw"), + // Enable: to.Ptr(true), + // }, + // OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + // NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + // Enable: to.Ptr(true), + // }, + // }, + // UserData: to.Ptr("s"), + // CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + // CapacityReservationGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + // }, + // }, + // ApplicationProfile: &armcomputefleet.ApplicationProfile{ + // GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + // { + // Tags: to.Ptr("eyrqjbib"), + // Order: to.Ptr[int32](5), + // PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + // TreatFailureAsDeploymentFailure: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // }, + // }, + // }, + // HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + // VMSizeProperties: &armcomputefleet.VMSizeProperties{ + // VCPUsAvailable: to.Ptr[int32](16), + // VCPUsPerCore: to.Ptr[int32](23), + // }, + // }, + // ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + // }, + // SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + // ID: to.Ptr("mubredelfbshboaxrsxiajihahaa"), + // ExcludeExtensions: []*string{ + // to.Ptr("{securityPostureVMExtensionName}"), + // }, + // IsOverridable: to.Ptr(true), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // ComputeAPIVersion: to.Ptr("2023-07-01"), + // PlatformFaultDomainCount: to.Ptr[int32](1), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-10T00:16:34.8590555+00:00"); return t}()), + // UniqueID: to.Ptr("a2f7fabd-bbc2-4a20-afe1-49fdb3885a28"), + // }, + // Zones: []*string{ + // to.Ptr("zone1"), + // to.Ptr("zone2"), + // }, + // Identity: &armcomputefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("4d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // TenantID: to.Ptr("5d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{ + // "key9851": &armcomputefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("6d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // ClientID: to.Ptr("7d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // }, + // }, + // }, + // Tags: map[string]*string{ + // "key3518": to.Ptr("luvrnuvsgdpbuofdskkcoqhfh"), + // }, + // Plan: &armcomputefleet.Plan{ + // Name: to.Ptr("jwgrcrnrtfoxn"), + // Publisher: to.Ptr("iozjbiqqckqm"), + // Product: to.Ptr("cgopbyvdyqikahwyxfpzwaqk"), + // PromotionCode: to.Ptr("naglezezplcaruqogtxnuizslqnnbr"), + // Version: to.Ptr("wa"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/testFleet"), + // Name: to.Ptr("testFleet"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets"), + // SystemData: &armcomputefleet.SystemData{ + // CreatedBy: to.Ptr("rowegentrpoajsv"), + // CreatedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // LastModifiedBy: to.Ptr("edwuayhhaoepxzisfaqjhmrxjq"), + // LastModifiedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_ListByResourceGroup.json +func ExampleFleetsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().NewListByResourceGroupPager("rgazurefleet", 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 = armcomputefleet.FleetsClientListByResourceGroupResponse{ + // FleetListResult: armcomputefleet.FleetListResult{ + // Value: []*armcomputefleet.Fleet{ + // { + // Properties: &armcomputefleet.FleetProperties{ + // ProvisioningState: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // MaxPricePerVM: to.Ptr[float32](0.00865), + // EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + // AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + // Maintain: to.Ptr(true), + // }, + // RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + // }, + // VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + // { + // Name: to.Ptr("Standard_d1_v2"), + // Rank: to.Ptr[int32](19225), + // }, + // }, + // ComputeProfile: &armcomputefleet.ComputeProfile{ + // BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + // OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + // ComputerNamePrefix: to.Ptr("o"), + // AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + // WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + // ProvisionVMAgent: to.Ptr(true), + // EnableAutomaticUpdates: to.Ptr(true), + // TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + // AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + // { + // PassName: to.Ptr("OobeSystem"), + // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + // SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + // }, + // }, + // PatchSettings: &armcomputefleet.PatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + // EnableHotpatching: to.Ptr(true), + // AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // WinRM: &armcomputefleet.WinRMConfiguration{ + // Listeners: []*armcomputefleet.WinRMListener{ + // { + // Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + // CertificateURL: to.Ptr("phwesineizrl"), + // }, + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // SSH: &armcomputefleet.SSHConfiguration{ + // PublicKeys: []*armcomputefleet.SSHPublicKey{ + // { + // Path: to.Ptr("kmqz"), + // KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + // }, + // }, + // }, + // ProvisionVMAgent: to.Ptr(true), + // PatchSettings: &armcomputefleet.LinuxPatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + // AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // Secrets: []*armcomputefleet.VaultSecretGroup{ + // { + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // VaultCertificates: []*armcomputefleet.VaultCertificate{ + // { + // CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + // CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + // }, + // }, + // }, + // }, + // AllowExtensionOperations: to.Ptr(true), + // RequireGuestProvisionSignal: to.Ptr(true), + // }, + // StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + // ImageReference: &armcomputefleet.ImageReference{ + // Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + // Offer: to.Ptr("isxgumkarlkomp"), + // SKU: to.Ptr("eojmppqcrnpmxirtp"), + // Version: to.Ptr("wvpcqefgtmqdgltiuz"), + // ExactVersion: to.Ptr("zjbntmiskjexlr"), + // SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + // CommunityGalleryImageID: to.Ptr("vlqe"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + // }, + // OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + // Name: to.Ptr("wfttw"), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + // Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + // Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + // }, + // DiskSizeGB: to.Ptr[int32](14), + // OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + // Image: &armcomputefleet.VirtualHardDisk{ + // URI: to.Ptr("thqceubivdrjs"), + // }, + // VhdContainers: []*string{ + // to.Ptr("tkzcwddtinkfpnfklatw"), + // }, + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + // { + // Name: to.Ptr("eogiykmdmeikswxmigjws"), + // Lun: to.Ptr[int32](14), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiskSizeGB: to.Ptr[int32](6), + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DiskIOPSReadWrite: to.Ptr[int64](27), + // DiskMBpsReadWrite: to.Ptr[int64](2), + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // }, + // }, + // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + // HealthProbe: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + // }, + // NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + // { + // Name: to.Ptr("i"), + // Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + // Primary: to.Ptr(true), + // EnableAcceleratedNetworking: to.Ptr(true), + // DisableTCPStateTracking: to.Ptr(true), + // EnableFpga: to.Ptr(true), + // NetworkSecurityGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + // }, + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + // DNSServers: []*string{ + // to.Ptr("nxmmfolhclsesu"), + // }, + // }, + // IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + // { + // Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + // Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + // Subnet: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + // }, + // Primary: to.Ptr(true), + // PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + // Name: to.Ptr("fvpqf"), + // Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + // IdleTimeoutInMinutes: to.Ptr[int32](9), + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + // DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + // DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + // }, + // IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + // { + // IPTagType: to.Ptr("sddgsoemnzgqizale"), + // Tag: to.Ptr("wufmhrjsakbiaetyara"), + // }, + // }, + // PublicIPPrefix: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + // }, + // PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // }, + // SKU: &armcomputefleet.PublicIPAddressSKU{ + // Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + // Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + // }, + // }, + // PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + // }, + // }, + // LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + // }, + // }, + // }, + // }, + // }, + // EnableIPForwarding: to.Ptr(true), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + // AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + // }, + // }, + // }, + // NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + // }, + // SecurityProfile: &armcomputefleet.SecurityProfile{ + // UefiSettings: &armcomputefleet.UefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // VTpmEnabled: to.Ptr(true), + // }, + // EncryptionAtHost: to.Ptr(true), + // SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + // EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + // }, + // ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + // Enabled: to.Ptr(true), + // Mode: to.Ptr(armcomputefleet.ModeAudit), + // KeyIncarnationID: to.Ptr[int32](20), + // }, + // }, + // DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + // BootDiagnostics: &armcomputefleet.BootDiagnostics{ + // Enabled: to.Ptr(true), + // StorageURI: to.Ptr("rzamfwghybpx"), + // }, + // }, + // ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + // Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + // { + // Name: to.Ptr("bndxuxx"), + // Type: to.Ptr("cmeam"), + // Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + // ForceUpdateTag: to.Ptr("yhgxw"), + // Publisher: to.Ptr("kpxtirxjfprhs"), + // Type: to.Ptr("pgjilctjjwaa"), + // TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + // AutoUpgradeMinorVersion: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // Settings: map[string]any{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // ProvisionAfterExtensions: []*string{ + // to.Ptr("nftzosroolbcwmpupujzqwqe"), + // }, + // SuppressFailures: to.Ptr(true), + // ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + // SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{extensionName}"), + // }, + // }, + // ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + // }, + // LicenseType: to.Ptr("v"), + // ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + // TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + // NotBeforeTimeout: to.Ptr("iljppmmw"), + // Enable: to.Ptr(true), + // }, + // OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + // NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + // Enable: to.Ptr(true), + // }, + // }, + // UserData: to.Ptr("s"), + // CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + // CapacityReservationGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + // }, + // }, + // ApplicationProfile: &armcomputefleet.ApplicationProfile{ + // GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + // { + // Tags: to.Ptr("eyrqjbib"), + // Order: to.Ptr[int32](5), + // PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + // TreatFailureAsDeploymentFailure: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // }, + // }, + // }, + // HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + // VMSizeProperties: &armcomputefleet.VMSizeProperties{ + // VCPUsAvailable: to.Ptr[int32](16), + // VCPUsPerCore: to.Ptr[int32](23), + // }, + // }, + // ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + // }, + // SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + // ID: to.Ptr("mubredelfbshboaxrsxiajihahaa"), + // ExcludeExtensions: []*string{ + // to.Ptr("{securityPostureVMExtensionName}"), + // }, + // IsOverridable: to.Ptr(true), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // ComputeAPIVersion: to.Ptr("2023-07-01"), + // PlatformFaultDomainCount: to.Ptr[int32](1), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-10T00:16:34.8590555+00:00"); return t}()), + // UniqueID: to.Ptr("a2f7fabd-bbc2-4a20-afe1-49fdb3885a28"), + // }, + // Zones: []*string{ + // to.Ptr("zone1"), + // to.Ptr("zone2"), + // }, + // Identity: &armcomputefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("4d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // TenantID: to.Ptr("5d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{ + // "key9851": &armcomputefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("6d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // ClientID: to.Ptr("7d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // }, + // }, + // }, + // Plan: &armcomputefleet.Plan{ + // Name: to.Ptr("jwgrcrnrtfoxn"), + // Publisher: to.Ptr("iozjbiqqckqm"), + // Product: to.Ptr("cgopbyvdyqikahwyxfpzwaqk"), + // PromotionCode: to.Ptr("naglezezplcaruqogtxnuizslqnnbr"), + // Version: to.Ptr("wa"), + // }, + // Tags: map[string]*string{ + // "key3518": to.Ptr("luvrnuvsgdpbuofdskkcoqhfh"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/testFleet"), + // Name: to.Ptr("testFleet"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets"), + // SystemData: &armcomputefleet.SystemData{ + // CreatedBy: to.Ptr("rowegentrpoajsv"), + // CreatedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // LastModifiedBy: to.Ptr("edwuayhhaoepxzisfaqjhmrxjq"), + // LastModifiedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_ListBySubscription.json +func ExampleFleetsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcomputefleet.FleetsClientListBySubscriptionResponse{ + // FleetListResult: armcomputefleet.FleetListResult{ + // Value: []*armcomputefleet.Fleet{ + // { + // Properties: &armcomputefleet.FleetProperties{ + // ProvisioningState: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // MaxPricePerVM: to.Ptr[float32](0.00865), + // EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + // AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + // Maintain: to.Ptr(true), + // }, + // RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + // }, + // VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + // { + // Name: to.Ptr("Standard_d1_v2"), + // Rank: to.Ptr[int32](19225), + // }, + // }, + // ComputeProfile: &armcomputefleet.ComputeProfile{ + // BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + // OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + // ComputerNamePrefix: to.Ptr("o"), + // AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + // WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + // ProvisionVMAgent: to.Ptr(true), + // EnableAutomaticUpdates: to.Ptr(true), + // TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + // AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + // { + // PassName: to.Ptr("OobeSystem"), + // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + // SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + // }, + // }, + // PatchSettings: &armcomputefleet.PatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + // EnableHotpatching: to.Ptr(true), + // AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // WinRM: &armcomputefleet.WinRMConfiguration{ + // Listeners: []*armcomputefleet.WinRMListener{ + // { + // Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + // CertificateURL: to.Ptr("phwesineizrl"), + // }, + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // SSH: &armcomputefleet.SSHConfiguration{ + // PublicKeys: []*armcomputefleet.SSHPublicKey{ + // { + // Path: to.Ptr("kmqz"), + // KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + // }, + // }, + // }, + // ProvisionVMAgent: to.Ptr(true), + // PatchSettings: &armcomputefleet.LinuxPatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + // AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // Secrets: []*armcomputefleet.VaultSecretGroup{ + // { + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // VaultCertificates: []*armcomputefleet.VaultCertificate{ + // { + // CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + // CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + // }, + // }, + // }, + // }, + // AllowExtensionOperations: to.Ptr(true), + // RequireGuestProvisionSignal: to.Ptr(true), + // }, + // StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + // ImageReference: &armcomputefleet.ImageReference{ + // Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + // Offer: to.Ptr("isxgumkarlkomp"), + // SKU: to.Ptr("eojmppqcrnpmxirtp"), + // Version: to.Ptr("wvpcqefgtmqdgltiuz"), + // ExactVersion: to.Ptr("zjbntmiskjexlr"), + // SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + // CommunityGalleryImageID: to.Ptr("vlqe"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + // }, + // OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + // Name: to.Ptr("wfttw"), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + // Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + // Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + // }, + // DiskSizeGB: to.Ptr[int32](14), + // OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + // Image: &armcomputefleet.VirtualHardDisk{ + // URI: to.Ptr("thqceubivdrjs"), + // }, + // VhdContainers: []*string{ + // to.Ptr("tkzcwddtinkfpnfklatw"), + // }, + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + // { + // Name: to.Ptr("eogiykmdmeikswxmigjws"), + // Lun: to.Ptr[int32](14), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiskSizeGB: to.Ptr[int32](6), + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DiskIOPSReadWrite: to.Ptr[int64](27), + // DiskMBpsReadWrite: to.Ptr[int64](2), + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // }, + // }, + // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + // HealthProbe: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + // }, + // NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + // { + // Name: to.Ptr("i"), + // Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + // Primary: to.Ptr(true), + // EnableAcceleratedNetworking: to.Ptr(true), + // DisableTCPStateTracking: to.Ptr(true), + // EnableFpga: to.Ptr(true), + // NetworkSecurityGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + // }, + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + // DNSServers: []*string{ + // to.Ptr("nxmmfolhclsesu"), + // }, + // }, + // IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + // { + // Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + // Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + // Subnet: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + // }, + // Primary: to.Ptr(true), + // PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + // Name: to.Ptr("fvpqf"), + // Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + // IdleTimeoutInMinutes: to.Ptr[int32](9), + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + // DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + // DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + // }, + // IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + // { + // IPTagType: to.Ptr("sddgsoemnzgqizale"), + // Tag: to.Ptr("wufmhrjsakbiaetyara"), + // }, + // }, + // PublicIPPrefix: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + // }, + // PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // }, + // SKU: &armcomputefleet.PublicIPAddressSKU{ + // Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + // Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + // }, + // }, + // PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + // }, + // }, + // LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + // }, + // }, + // }, + // }, + // }, + // EnableIPForwarding: to.Ptr(true), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + // AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + // }, + // }, + // }, + // NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + // }, + // SecurityProfile: &armcomputefleet.SecurityProfile{ + // UefiSettings: &armcomputefleet.UefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // VTpmEnabled: to.Ptr(true), + // }, + // EncryptionAtHost: to.Ptr(true), + // SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + // EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + // }, + // ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + // Enabled: to.Ptr(true), + // Mode: to.Ptr(armcomputefleet.ModeAudit), + // KeyIncarnationID: to.Ptr[int32](20), + // }, + // }, + // DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + // BootDiagnostics: &armcomputefleet.BootDiagnostics{ + // Enabled: to.Ptr(true), + // StorageURI: to.Ptr("rzamfwghybpx"), + // }, + // }, + // ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + // Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + // { + // Name: to.Ptr("bndxuxx"), + // Type: to.Ptr("cmeam"), + // Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + // ForceUpdateTag: to.Ptr("yhgxw"), + // Publisher: to.Ptr("kpxtirxjfprhs"), + // Type: to.Ptr("pgjilctjjwaa"), + // TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + // AutoUpgradeMinorVersion: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // Settings: map[string]any{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // ProvisionAfterExtensions: []*string{ + // to.Ptr("nftzosroolbcwmpupujzqwqe"), + // }, + // SuppressFailures: to.Ptr(true), + // ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + // SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{extensionName}"), + // }, + // }, + // ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + // }, + // LicenseType: to.Ptr("v"), + // ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + // TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + // NotBeforeTimeout: to.Ptr("iljppmmw"), + // Enable: to.Ptr(true), + // }, + // OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + // NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + // Enable: to.Ptr(true), + // }, + // }, + // UserData: to.Ptr("s"), + // CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + // CapacityReservationGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + // }, + // }, + // ApplicationProfile: &armcomputefleet.ApplicationProfile{ + // GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + // { + // Tags: to.Ptr("eyrqjbib"), + // Order: to.Ptr[int32](5), + // PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + // TreatFailureAsDeploymentFailure: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // }, + // }, + // }, + // HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + // VMSizeProperties: &armcomputefleet.VMSizeProperties{ + // VCPUsAvailable: to.Ptr[int32](16), + // VCPUsPerCore: to.Ptr[int32](23), + // }, + // }, + // ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + // }, + // SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + // ID: to.Ptr("mubredelfbshboaxrsxiajihahaa"), + // ExcludeExtensions: []*string{ + // to.Ptr("{securityPostureVMExtensionName}"), + // }, + // IsOverridable: to.Ptr(true), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // ComputeAPIVersion: to.Ptr("2023-07-01"), + // PlatformFaultDomainCount: to.Ptr[int32](1), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-10T00:16:34.8590555+00:00"); return t}()), + // UniqueID: to.Ptr("a2f7fabd-bbc2-4a20-afe1-49fdb3885a28"), + // }, + // Zones: []*string{ + // to.Ptr("zone1"), + // to.Ptr("zone2"), + // }, + // Identity: &armcomputefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("4d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // TenantID: to.Ptr("5d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{ + // "key9851": &armcomputefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("6d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // ClientID: to.Ptr("7d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // }, + // }, + // }, + // Plan: &armcomputefleet.Plan{ + // Name: to.Ptr("jwgrcrnrtfoxn"), + // Publisher: to.Ptr("iozjbiqqckqm"), + // Product: to.Ptr("cgopbyvdyqikahwyxfpzwaqk"), + // PromotionCode: to.Ptr("naglezezplcaruqogtxnuizslqnnbr"), + // Version: to.Ptr("wa"), + // }, + // Tags: map[string]*string{ + // "key3518": to.Ptr("luvrnuvsgdpbuofdskkcoqhfh"), + // }, + // Location: to.Ptr("westus"), + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/testFleet"), + // Name: to.Ptr("testFleet"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets"), + // SystemData: &armcomputefleet.SystemData{ + // CreatedBy: to.Ptr("rowegentrpoajsv"), + // CreatedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // LastModifiedBy: to.Ptr("edwuayhhaoepxzisfaqjhmrxjq"), + // LastModifiedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_ListVirtualMachineScaleSets.json +func ExampleFleetsClient_NewListVirtualMachineScaleSetsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().NewListVirtualMachineScaleSetsPager("rgazurefleet", "myFleet", 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 = armcomputefleet.FleetsClientListVirtualMachineScaleSetsResponse{ + // VirtualMachineScaleSetListResult: armcomputefleet.VirtualMachineScaleSetListResult{ + // Value: []*armcomputefleet.VirtualMachineScaleSet{ + // { + // Name: to.Ptr("myVmss"), + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/myFleet/virtualMachineScaleSets/myVmss"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets/virtualMachineScaleSets"), + // OperationStatus: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // Error: &armcomputefleet.APIError{ + // Details: []*armcomputefleet.APIErrorBase{ + // { + // Code: to.Ptr("gzhtOverconstrainedAllocationRequestyosk"), + // Target: to.Ptr("qfthabhrmndhfizfnrwpgxvnokpy"), + // Message: to.Ptr("Allocation Failed"), + // }, + // }, + // Innererror: &armcomputefleet.InnerError{ + // ExceptionType: to.Ptr("sfaomfpoaptnbxchrfskm"), + // ErrorDetail: to.Ptr("ihjwbwykq"), + // }, + // Code: to.Ptr("OverconstrainedAllocationRequest"), + // Target: to.Ptr("nhaj"), + // Message: to.Ptr("Allocation Failed"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/Fleets_Update.json +func ExampleFleetsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputefleet.NewClientFactory("1DC2F28C-A625-4B0E-9748-9885A3C9E9EB", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginUpdate(ctx, "rgazurefleet", "testFleet", armcomputefleet.FleetUpdate{ + Identity: &armcomputefleet.ManagedServiceIdentityUpdate{ + Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{}, + }, + Tags: map[string]*string{}, + Properties: &armcomputefleet.FleetProperties{ + SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + Capacity: to.Ptr[int32](20), + MinCapacity: to.Ptr[int32](10), + MaxPricePerVM: to.Ptr[float32](0.00865), + EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + Maintain: to.Ptr(true), + }, + RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + Capacity: to.Ptr[int32](20), + MinCapacity: to.Ptr[int32](10), + AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + }, + VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + { + Name: to.Ptr("Standard_d1_v2"), + Rank: to.Ptr[int32](19225), + }, + }, + ComputeProfile: &armcomputefleet.ComputeProfile{ + BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + ComputerNamePrefix: to.Ptr("o"), + AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + AdminPassword: to.Ptr("adfbrdxpv"), + CustomData: to.Ptr("xjjib"), + WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + ProvisionVMAgent: to.Ptr(true), + EnableAutomaticUpdates: to.Ptr(true), + TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + { + PassName: to.Ptr("OobeSystem"), + ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + Content: to.Ptr("bubmqbxjkj"), + }, + }, + PatchSettings: &armcomputefleet.PatchSettings{ + PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + EnableHotpatching: to.Ptr(true), + AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + }, + }, + WinRM: &armcomputefleet.WinRMConfiguration{ + Listeners: []*armcomputefleet.WinRMListener{ + { + Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + CertificateURL: to.Ptr("phwesineizrl"), + }, + }, + }, + EnableVMAgentPlatformUpdates: to.Ptr(true), + }, + LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + SSH: &armcomputefleet.SSHConfiguration{ + PublicKeys: []*armcomputefleet.SSHPublicKey{ + { + Path: to.Ptr("kmqz"), + KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + }, + }, + }, + ProvisionVMAgent: to.Ptr(true), + PatchSettings: &armcomputefleet.LinuxPatchSettings{ + PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + }, + }, + EnableVMAgentPlatformUpdates: to.Ptr(true), + }, + Secrets: []*armcomputefleet.VaultSecretGroup{ + { + SourceVault: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + }, + VaultCertificates: []*armcomputefleet.VaultCertificate{ + { + CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + }, + }, + }, + }, + AllowExtensionOperations: to.Ptr(true), + RequireGuestProvisionSignal: to.Ptr(true), + }, + StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + ImageReference: &armcomputefleet.ImageReference{ + Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + Offer: to.Ptr("isxgumkarlkomp"), + SKU: to.Ptr("eojmppqcrnpmxirtp"), + Version: to.Ptr("wvpcqefgtmqdgltiuz"), + SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + CommunityGalleryImageID: to.Ptr("vlqe"), + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + }, + OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + Name: to.Ptr("wfttw"), + Caching: to.Ptr(armcomputefleet.CachingTypesNone), + WriteAcceleratorEnabled: to.Ptr(true), + CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + }, + DiskSizeGB: to.Ptr[int32](14), + OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + Image: &armcomputefleet.VirtualHardDisk{ + URI: to.Ptr("thqceubivdrjs"), + }, + VhdContainers: []*string{ + to.Ptr("tkzcwddtinkfpnfklatw"), + }, + ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + }, + }, + DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + }, + DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + { + Name: to.Ptr("eogiykmdmeikswxmigjws"), + Lun: to.Ptr[int32](14), + Caching: to.Ptr(armcomputefleet.CachingTypesNone), + WriteAcceleratorEnabled: to.Ptr(true), + CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + DiskSizeGB: to.Ptr[int32](6), + ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + }, + }, + }, + DiskIOPSReadWrite: to.Ptr[int64](27), + DiskMBpsReadWrite: to.Ptr[int64](2), + DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + }, + }, + }, + NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + HealthProbe: &armcomputefleet.APIEntityReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + }, + NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + { + Name: to.Ptr("i"), + Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + Primary: to.Ptr(true), + EnableAcceleratedNetworking: to.Ptr(true), + DisableTCPStateTracking: to.Ptr(true), + EnableFpga: to.Ptr(true), + NetworkSecurityGroup: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + }, + DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + DNSServers: []*string{ + to.Ptr("nxmmfolhclsesu"), + }, + }, + IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + { + Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + Subnet: &armcomputefleet.APIEntityReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + }, + Primary: to.Ptr(true), + PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + Name: to.Ptr("fvpqf"), + Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + IdleTimeoutInMinutes: to.Ptr[int32](9), + DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + }, + IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + { + IPTagType: to.Ptr("sddgsoemnzgqizale"), + Tag: to.Ptr("wufmhrjsakbiaetyara"), + }, + }, + PublicIPPrefix: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + }, + PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + }, + SKU: &armcomputefleet.PublicIPAddressSKU{ + Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + }, + }, + PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + }, + }, + ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + }, + }, + LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + }, + }, + LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + { + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + }, + }, + }, + }, + }, + EnableIPForwarding: to.Ptr(true), + DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + }, + }, + }, + NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + }, + SecurityProfile: &armcomputefleet.SecurityProfile{ + UefiSettings: &armcomputefleet.UefiSettings{ + SecureBootEnabled: to.Ptr(true), + VTpmEnabled: to.Ptr(true), + }, + EncryptionAtHost: to.Ptr(true), + SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + }, + ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + Enabled: to.Ptr(true), + Mode: to.Ptr(armcomputefleet.ModeAudit), + KeyIncarnationID: to.Ptr[int32](20), + }, + }, + DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + BootDiagnostics: &armcomputefleet.BootDiagnostics{ + Enabled: to.Ptr(true), + StorageURI: to.Ptr("rzamfwghybpx"), + }, + }, + ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + { + Name: to.Ptr("bndxuxx"), + Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + ForceUpdateTag: to.Ptr("yhgxw"), + Publisher: to.Ptr("kpxtirxjfprhs"), + Type: to.Ptr("pgjilctjjwaa"), + TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + AutoUpgradeMinorVersion: to.Ptr(true), + EnableAutomaticUpgrade: to.Ptr(true), + Settings: map[string]any{}, + ProtectedSettings: map[string]any{}, + ProvisionAfterExtensions: []*string{ + to.Ptr("nftzosroolbcwmpupujzqwqe"), + }, + SuppressFailures: to.Ptr(true), + ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + SourceVault: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + }, + }, + }, + }, + }, + ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + }, + LicenseType: to.Ptr("v"), + ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + NotBeforeTimeout: to.Ptr("iljppmmw"), + Enable: to.Ptr(true), + }, + OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + Enable: to.Ptr(true), + }, + }, + UserData: to.Ptr("s"), + CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + CapacityReservationGroup: &armcomputefleet.SubResource{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + }, + }, + ApplicationProfile: &armcomputefleet.ApplicationProfile{ + GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + { + Tags: to.Ptr("eyrqjbib"), + Order: to.Ptr[int32](5), + PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + ConfigurationReference: to.Ptr("ulztmiavpojpbpbddgnuuiimxcpau"), + TreatFailureAsDeploymentFailure: to.Ptr(true), + EnableAutomaticUpgrade: to.Ptr(true), + }, + }, + }, + HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + VMSizeProperties: &armcomputefleet.VMSizeProperties{ + VCPUsAvailable: to.Ptr[int32](16), + VCPUsPerCore: to.Ptr[int32](23), + }, + }, + ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + }, + SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), + ExcludeExtensions: []*string{ + to.Ptr("{securityPostureVMExtensionName}"), + }, + IsOverridable: to.Ptr(true), + }, + }, + ComputeAPIVersion: to.Ptr("2023-07-01"), + PlatformFaultDomainCount: to.Ptr[int32](1), + }, + }, + Plan: &armcomputefleet.ResourcePlanUpdate{ + Name: to.Ptr("jwgrcrnrtfoxn"), + Publisher: to.Ptr("iozjbiqqckqm"), + Product: to.Ptr("cgopbyvdyqikahwyxfpzwaqk"), + PromotionCode: to.Ptr("naglezezplcaruqogtxnuizslqnnbr"), + Version: to.Ptr("wa"), + }, + }, 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 = armcomputefleet.FleetsClientUpdateResponse{ + // Fleet: &armcomputefleet.Fleet{ + // Properties: &armcomputefleet.FleetProperties{ + // SpotPriorityProfile: &armcomputefleet.SpotPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // MaxPricePerVM: to.Ptr[float32](0.00865), + // EvictionPolicy: to.Ptr(armcomputefleet.EvictionPolicyDelete), + // AllocationStrategy: to.Ptr(armcomputefleet.SpotAllocationStrategyPriceCapacityOptimized), + // Maintain: to.Ptr(true), + // }, + // RegularPriorityProfile: &armcomputefleet.RegularPriorityProfile{ + // Capacity: to.Ptr[int32](20), + // MinCapacity: to.Ptr[int32](10), + // AllocationStrategy: to.Ptr(armcomputefleet.RegularPriorityAllocationStrategyLowestPrice), + // }, + // VMSizesProfile: []*armcomputefleet.VMSizeProfile{ + // { + // Name: to.Ptr("Standard_d1_v2"), + // Rank: to.Ptr[int32](19225), + // }, + // }, + // ComputeProfile: &armcomputefleet.ComputeProfile{ + // BaseVirtualMachineProfile: &armcomputefleet.BaseVirtualMachineProfile{ + // OSProfile: &armcomputefleet.VirtualMachineScaleSetOSProfile{ + // ComputerNamePrefix: to.Ptr("o"), + // AdminUsername: to.Ptr("nrgzqciiaaxjrqldbmjbqkyhntp"), + // WindowsConfiguration: &armcomputefleet.WindowsConfiguration{ + // ProvisionVMAgent: to.Ptr(true), + // EnableAutomaticUpdates: to.Ptr(true), + // TimeZone: to.Ptr("hlyjiqcfksgrpjrct"), + // AdditionalUnattendContent: []*armcomputefleet.AdditionalUnattendContent{ + // { + // PassName: to.Ptr("OobeSystem"), + // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), + // SettingName: to.Ptr(armcomputefleet.SettingNamesAutoLogon), + // }, + // }, + // PatchSettings: &armcomputefleet.PatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.WindowsVMGuestPatchModeManual), + // EnableHotpatching: to.Ptr(true), + // AssessmentMode: to.Ptr(armcomputefleet.WindowsPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // WinRM: &armcomputefleet.WinRMConfiguration{ + // Listeners: []*armcomputefleet.WinRMListener{ + // { + // Protocol: to.Ptr(armcomputefleet.ProtocolTypesHTTP), + // CertificateURL: to.Ptr("phwesineizrl"), + // }, + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // LinuxConfiguration: &armcomputefleet.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // SSH: &armcomputefleet.SSHConfiguration{ + // PublicKeys: []*armcomputefleet.SSHPublicKey{ + // { + // Path: to.Ptr("kmqz"), + // KeyData: to.Ptr("kivgsubusvpprwqaqpjcmhsv"), + // }, + // }, + // }, + // ProvisionVMAgent: to.Ptr(true), + // PatchSettings: &armcomputefleet.LinuxPatchSettings{ + // PatchMode: to.Ptr(armcomputefleet.LinuxVMGuestPatchModeImageDefault), + // AssessmentMode: to.Ptr(armcomputefleet.LinuxPatchAssessmentModeImageDefault), + // AutomaticByPlatformSettings: &armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformSettings{ + // RebootSetting: to.Ptr(armcomputefleet.LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), + // }, + // }, + // EnableVMAgentPlatformUpdates: to.Ptr(true), + // }, + // Secrets: []*armcomputefleet.VaultSecretGroup{ + // { + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // VaultCertificates: []*armcomputefleet.VaultCertificate{ + // { + // CertificateURL: to.Ptr("tyldwkzafmnkvpo"), + // CertificateStore: to.Ptr("nlxrwavpzhueffxsshlun"), + // }, + // }, + // }, + // }, + // AllowExtensionOperations: to.Ptr(true), + // RequireGuestProvisionSignal: to.Ptr(true), + // }, + // StorageProfile: &armcomputefleet.VirtualMachineScaleSetStorageProfile{ + // ImageReference: &armcomputefleet.ImageReference{ + // Publisher: to.Ptr("mqxgwbiyjzmxavhbkd"), + // Offer: to.Ptr("isxgumkarlkomp"), + // SKU: to.Ptr("eojmppqcrnpmxirtp"), + // Version: to.Ptr("wvpcqefgtmqdgltiuz"), + // SharedGalleryImageID: to.Ptr("kmkgihoxwlawuuhcinfirktdwkmx"), + // CommunityGalleryImageID: to.Ptr("vlqe"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}"), + // ExactVersion: to.Ptr("zjbntmiskjexlr"), + // }, + // OSDisk: &armcomputefleet.VirtualMachineScaleSetOSDisk{ + // Name: to.Ptr("wfttw"), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiffDiskSettings: &armcomputefleet.DiffDiskSettings{ + // Option: to.Ptr(armcomputefleet.DiffDiskOptionsLocal), + // Placement: to.Ptr(armcomputefleet.DiffDiskPlacementCacheDisk), + // }, + // DiskSizeGB: to.Ptr[int32](14), + // OSType: to.Ptr(armcomputefleet.OperatingSystemTypesWindows), + // Image: &armcomputefleet.VirtualHardDisk{ + // URI: to.Ptr("thqceubivdrjs"), + // }, + // VhdContainers: []*string{ + // to.Ptr("tkzcwddtinkfpnfklatw"), + // }, + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // DataDisks: []*armcomputefleet.VirtualMachineScaleSetDataDisk{ + // { + // Name: to.Ptr("eogiykmdmeikswxmigjws"), + // Lun: to.Ptr[int32](14), + // Caching: to.Ptr(armcomputefleet.CachingTypesNone), + // WriteAcceleratorEnabled: to.Ptr(true), + // CreateOption: to.Ptr(armcomputefleet.DiskCreateOptionTypesFromImage), + // DiskSizeGB: to.Ptr[int32](6), + // ManagedDisk: &armcomputefleet.VirtualMachineScaleSetManagedDiskParameters{ + // StorageAccountType: to.Ptr(armcomputefleet.StorageAccountTypesStandardLRS), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // SecurityProfile: &armcomputefleet.VMDiskSecurityProfile{ + // SecurityEncryptionType: to.Ptr(armcomputefleet.SecurityEncryptionTypesVMGuestStateOnly), + // DiskEncryptionSet: &armcomputefleet.DiskEncryptionSetParameters{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), + // }, + // }, + // }, + // DiskIOPSReadWrite: to.Ptr[int64](27), + // DiskMBpsReadWrite: to.Ptr[int64](2), + // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), + // }, + // }, + // }, + // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ + // HealthProbe: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"), + // }, + // NetworkInterfaceConfigurations: []*armcomputefleet.VirtualMachineScaleSetNetworkConfiguration{ + // { + // Name: to.Ptr("i"), + // Properties: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationProperties{ + // Primary: to.Ptr(true), + // EnableAcceleratedNetworking: to.Ptr(true), + // DisableTCPStateTracking: to.Ptr(true), + // EnableFpga: to.Ptr(true), + // NetworkSecurityGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"), + // }, + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ + // DNSServers: []*string{ + // to.Ptr("nxmmfolhclsesu"), + // }, + // }, + // IPConfigurations: []*armcomputefleet.VirtualMachineScaleSetIPConfiguration{ + // { + // Name: to.Ptr("oezqhkidfhyywlfzwuotilrpbqnjg"), + // Properties: &armcomputefleet.VirtualMachineScaleSetIPConfigurationProperties{ + // Subnet: &armcomputefleet.APIEntityReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"), + // }, + // Primary: to.Ptr(true), + // PublicIPAddressConfiguration: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfiguration{ + // Name: to.Ptr("fvpqf"), + // Properties: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ + // IdleTimeoutInMinutes: to.Ptr[int32](9), + // DNSSettings: &armcomputefleet.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ + // DomainNameLabel: to.Ptr("ukrddzvmorpmfsczjwtbvp"), + // DomainNameLabelScope: to.Ptr(armcomputefleet.DomainNameLabelScopeTypesTenantReuse), + // }, + // IPTags: []*armcomputefleet.VirtualMachineScaleSetIPTag{ + // { + // IPTagType: to.Ptr("sddgsoemnzgqizale"), + // Tag: to.Ptr("wufmhrjsakbiaetyara"), + // }, + // }, + // PublicIPPrefix: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"), + // }, + // PublicIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // }, + // SKU: &armcomputefleet.PublicIPAddressSKU{ + // Name: to.Ptr(armcomputefleet.PublicIPAddressSKUNameBasic), + // Tier: to.Ptr(armcomputefleet.PublicIPAddressSKUTierRegional), + // }, + // }, + // PrivateIPAddressVersion: to.Ptr(armcomputefleet.IPVersionIPv4), + // ApplicationGatewayBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // ApplicationSecurityGroups: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"), + // }, + // }, + // LoadBalancerBackendAddressPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"), + // }, + // }, + // LoadBalancerInboundNatPools: []*armcomputefleet.SubResource{ + // { + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}"), + // }, + // }, + // }, + // }, + // }, + // EnableIPForwarding: to.Ptr(true), + // DeleteOption: to.Ptr(armcomputefleet.DeleteOptionsDelete), + // AuxiliaryMode: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliaryModeNone), + // AuxiliarySKU: to.Ptr(armcomputefleet.NetworkInterfaceAuxiliarySKUNone), + // }, + // }, + // }, + // NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion20201101), + // }, + // SecurityProfile: &armcomputefleet.SecurityProfile{ + // UefiSettings: &armcomputefleet.UefiSettings{ + // SecureBootEnabled: to.Ptr(true), + // VTpmEnabled: to.Ptr(true), + // }, + // EncryptionAtHost: to.Ptr(true), + // SecurityType: to.Ptr(armcomputefleet.SecurityTypesTrustedLaunch), + // EncryptionIdentity: &armcomputefleet.EncryptionIdentity{ + // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"), + // }, + // ProxyAgentSettings: &armcomputefleet.ProxyAgentSettings{ + // Enabled: to.Ptr(true), + // Mode: to.Ptr(armcomputefleet.ModeAudit), + // KeyIncarnationID: to.Ptr[int32](20), + // }, + // }, + // DiagnosticsProfile: &armcomputefleet.DiagnosticsProfile{ + // BootDiagnostics: &armcomputefleet.BootDiagnostics{ + // Enabled: to.Ptr(true), + // StorageURI: to.Ptr("rzamfwghybpx"), + // }, + // }, + // ExtensionProfile: &armcomputefleet.VirtualMachineScaleSetExtensionProfile{ + // Extensions: []*armcomputefleet.VirtualMachineScaleSetExtension{ + // { + // Name: to.Ptr("bndxuxx"), + // Properties: &armcomputefleet.VirtualMachineScaleSetExtensionProperties{ + // ForceUpdateTag: to.Ptr("yhgxw"), + // Publisher: to.Ptr("kpxtirxjfprhs"), + // Type: to.Ptr("pgjilctjjwaa"), + // TypeHandlerVersion: to.Ptr("zevivcoilxmbwlrihhhibq"), + // AutoUpgradeMinorVersion: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // ProvisionAfterExtensions: []*string{ + // to.Ptr("nftzosroolbcwmpupujzqwqe"), + // }, + // SuppressFailures: to.Ptr(true), + // ProtectedSettingsFromKeyVault: &armcomputefleet.KeyVaultSecretReference{ + // SecretURL: to.Ptr("vyhzfkqsqanacgzjthpjoe"), + // SourceVault: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"), + // }, + // }, + // Settings: map[string]any{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // }, + // Type: to.Ptr("cmeam"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{extensionName}"), + // }, + // }, + // ExtensionsTimeBudget: to.Ptr("mbhjahtdygwgyszdwjtvlvtgchdwil"), + // }, + // LicenseType: to.Ptr("v"), + // ScheduledEventsProfile: &armcomputefleet.ScheduledEventsProfile{ + // TerminateNotificationProfile: &armcomputefleet.TerminateNotificationProfile{ + // NotBeforeTimeout: to.Ptr("iljppmmw"), + // Enable: to.Ptr(true), + // }, + // OSImageNotificationProfile: &armcomputefleet.OSImageNotificationProfile{ + // NotBeforeTimeout: to.Ptr("olbpadmevekyczfokodtfprxti"), + // Enable: to.Ptr(true), + // }, + // }, + // UserData: to.Ptr("s"), + // CapacityReservation: &armcomputefleet.CapacityReservationProfile{ + // CapacityReservationGroup: &armcomputefleet.SubResource{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), + // }, + // }, + // ApplicationProfile: &armcomputefleet.ApplicationProfile{ + // GalleryApplications: []*armcomputefleet.VMGalleryApplication{ + // { + // Tags: to.Ptr("eyrqjbib"), + // Order: to.Ptr[int32](5), + // PackageReferenceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}"), + // TreatFailureAsDeploymentFailure: to.Ptr(true), + // EnableAutomaticUpgrade: to.Ptr(true), + // }, + // }, + // }, + // HardwareProfile: &armcomputefleet.VirtualMachineScaleSetHardwareProfile{ + // VMSizeProperties: &armcomputefleet.VMSizeProperties{ + // VCPUsAvailable: to.Ptr[int32](16), + // VCPUsPerCore: to.Ptr[int32](23), + // }, + // }, + // ServiceArtifactReference: &armcomputefleet.ServiceArtifactReference{ + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}"), + // }, + // SecurityPostureReference: &armcomputefleet.SecurityPostureReference{ + // ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), + // ExcludeExtensions: []*string{ + // to.Ptr("{securityPostureVMExtensionName}"), + // }, + // IsOverridable: to.Ptr(true), + // }, + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // ComputeAPIVersion: to.Ptr("2023-07-01"), + // PlatformFaultDomainCount: to.Ptr[int32](1), + // }, + // ProvisioningState: to.Ptr(armcomputefleet.ProvisioningStateCreating), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-10T00:16:34.8590555+00:00"); return t}()), + // UniqueID: to.Ptr("a2f7fabd-bbc2-4a20-afe1-49fdb3885a28"), + // }, + // Zones: []*string{ + // to.Ptr("zone1"), + // to.Ptr("zone2"), + // }, + // Identity: &armcomputefleet.ManagedServiceIdentity{ + // Type: to.Ptr(armcomputefleet.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armcomputefleet.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("4d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // TenantID: to.Ptr("5d508e5b-374b-4382-9a1c-01fb8b6cb37c"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("westus"), + // Plan: &armcomputefleet.Plan{ + // Name: to.Ptr("uapfngmdekvpgjhomthtpxjfdmmll"), + // Publisher: to.Ptr("aqhles"), + // Product: to.Ptr("bfzbkdnbexmedxdc"), + // PromotionCode: to.Ptr("gspehogwfjxirz"), + // Version: to.Ptr("yza"), + // }, + // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/testFleet"), + // Name: to.Ptr("testFleet"), + // Type: to.Ptr("Microsoft.AzureFleet/fleets"), + // SystemData: &armcomputefleet.SystemData{ + // CreatedBy: to.Ptr("rowegentrpoajsv"), + // CreatedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // LastModifiedBy: to.Ptr("edwuayhhaoepxzisfaqjhmrxjq"), + // LastModifiedByType: to.Ptr(armcomputefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-29T21:51:44.043Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod index 25682f2d2194..43724ff7ef95 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod @@ -2,10 +2,20 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcom go 1.18 -require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum index 917448a001b7..09d275cb9a37 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum @@ -1,12 +1,29 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go new file mode 100644 index 000000000000..419439f85dd3 --- /dev/null +++ b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcomputefleet_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/TempTypeSpecFiles/AzureFleet.Management/examples/2024-05-01-preview/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 := armcomputefleet.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 = armcomputefleet.OperationsClientListResponse{ + // OperationListResult: armcomputefleet.OperationListResult{ + // Value: []*armcomputefleet.Operation{ + // { + // Origin: to.Ptr(armcomputefleet.OriginUserSystem), + // Name: to.Ptr("Microsoft.AzureFleet/fleets/read"), + // IsDataAction: to.Ptr(false), + // Display: &armcomputefleet.OperationDisplay{ + // Provider: to.Ptr("Microsoft Azure Fleet"), + // Resource: to.Ptr("Fleets"), + // Operation: to.Ptr("Get Azure Fleet"), + // Description: to.Ptr("Get properties of Azure Fleet resource"), + // }, + // }, + // { + // Origin: to.Ptr(armcomputefleet.OriginUserSystem), + // Name: to.Ptr("Microsoft.AzureFleet/fleets/write"), + // IsDataAction: to.Ptr(false), + // Display: &armcomputefleet.OperationDisplay{ + // Provider: to.Ptr("Microsoft Azure Fleet"), + // Resource: to.Ptr("Fleets"), + // Operation: to.Ptr("Create or Update Azure Fleet"), + // Description: to.Ptr("Creates a new Azure Fleet resource or updates an existing one"), + // }, + // }, + // { + // Origin: to.Ptr(armcomputefleet.OriginUserSystem), + // Name: to.Ptr("Microsoft.AzureFleet/fleets/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armcomputefleet.OperationDisplay{ + // Provider: to.Ptr("Microsoft Azure Fleet"), + // Resource: to.Ptr("Fleets"), + // Operation: to.Ptr("Delete Virtual Machine and Virtual Machine scale sets in a Azure Fleet resource"), + // Description: to.Ptr("Deletes all compute resources of Azure Fleet resource"), + // }, + // }, + // { + // Origin: to.Ptr(armcomputefleet.OriginUserSystem), + // Name: to.Ptr("Microsoft.AzureFleet/register/action"), + // IsDataAction: to.Ptr(false), + // Display: &armcomputefleet.OperationDisplay{ + // Provider: to.Ptr("Microsoft Azure Fleet"), + // Resource: to.Ptr("Subscription"), + // Operation: to.Ptr("Register subscription for Microsoft.AzureFleet"), + // Description: to.Ptr("Registers Subscription with Microsoft.AzureFleet resource provider"), + // }, + // }, + // { + // Origin: to.Ptr(armcomputefleet.OriginUserSystem), + // Name: to.Ptr("Microsoft.AzureFleet/unregister/action"), + // IsDataAction: to.Ptr(false), + // Display: &armcomputefleet.OperationDisplay{ + // Provider: to.Ptr("Microsoft Azure Fleet"), + // Resource: to.Ptr("Subscription"), + // Operation: to.Ptr("Unregister Subscription for Microsoft.AzureFleet"), + // Description: to.Ptr("Unregisters Subscription with Microsoft.AzureFleet resource provider"), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml b/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml index f26478624109..d691f036ed18 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml +++ b/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/azurefleet/AzureFleet.Management -commit: aa23ddc02b2b1c5a34c56a49d83b77c0a1aaa614 -repo: Azure/azure-rest-api-specs -additionalDirectories: +commit: 52d5e415c9026af1a6b3b4932f4338df7f40b0b8 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md new file mode 100644 index 000000000000..44cc1596eb6a --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule` 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/computeschedule/armcomputeschedule/LICENSE.txt b/sdk/resourcemanager/computeschedule/armcomputeschedule/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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/computeschedule/armcomputeschedule/README.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/README.md new file mode 100644 index 000000000000..a8285d513fe7 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/README.md @@ -0,0 +1,92 @@ +# Azure Computeschedule Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule) + +The `armcomputeschedule` module provides operations for working with Azure Computeschedule. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/computeschedule/armcomputeschedule) + +# 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 Computeschedule module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Computeschedule. 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 Computeschedule 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 := armcomputeschedule.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 := armcomputeschedule.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.NewScheduledActionsClient() +``` + +## 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 `Computeschedule` 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/computeschedule/armcomputeschedule/autorest.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md new file mode 100644 index 000000000000..f69a513d0bc3 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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/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: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/build.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/build.go new file mode 100644 index 000000000000..62d8e2521509 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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/computeschedule/armcomputeschedule + +package armcomputeschedule diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/ci.yml b/sdk/resourcemanager/computeschedule/armcomputeschedule/ci.yml new file mode 100644 index 000000000000..92844a7fc49f --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/ci.yml @@ -0,0 +1,28 @@ +# 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/computeschedule/armcomputeschedule/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/computeschedule/armcomputeschedule/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/computeschedule/armcomputeschedule' diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go new file mode 100644 index 000000000000..f3b18164ab51 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go @@ -0,0 +1,52 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +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 +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewScheduledActionsClient creates a new instance of ScheduledActionsClient. +func (c *ClientFactory) NewScheduledActionsClient() *ScheduledActionsClient { + return &ScheduledActionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go new file mode 100644 index 000000000000..1fb518798fba --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go @@ -0,0 +1,152 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule" + 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, + } +} + +// DeadlineType - The types of deadlines supported by ScheduledActions +type DeadlineType string + +const ( + // DeadlineTypeCompleteBy - Complete the operation by the given deadline. + DeadlineTypeCompleteBy DeadlineType = "CompleteBy" + // DeadlineTypeInitiateAt - Initiate the operation at the given deadline. + DeadlineTypeInitiateAt DeadlineType = "InitiateAt" + // DeadlineTypeUnknown - Default value of Unknown. + DeadlineTypeUnknown DeadlineType = "Unknown" +) + +// PossibleDeadlineTypeValues returns the possible values for the DeadlineType const type. +func PossibleDeadlineTypeValues() []DeadlineType { + return []DeadlineType{ + DeadlineTypeCompleteBy, + DeadlineTypeInitiateAt, + DeadlineTypeUnknown, + } +} + +// OperationState - Values that define the states of operations in Scheduled Actions +type OperationState string + +const ( + // OperationStateBlocked - Operations that are blocked + OperationStateBlocked OperationState = "Blocked" + // OperationStateCancelled - Operations that have been cancelled by the user + OperationStateCancelled OperationState = "Cancelled" + // OperationStateExecuting - Operations that are in the process of being executed + OperationStateExecuting OperationState = "Executing" + // OperationStateFailed - Operations that have failed + OperationStateFailed OperationState = "Failed" + // OperationStatePendingExecution - Operations that are waiting to be executed + OperationStatePendingExecution OperationState = "PendingExecution" + // OperationStatePendingScheduling - Operations that are pending scheduling + OperationStatePendingScheduling OperationState = "PendingScheduling" + // OperationStateScheduled - Operations that have been scheduled + OperationStateScheduled OperationState = "Scheduled" + // OperationStateSucceeded - Operations that suceeded + OperationStateSucceeded OperationState = "Succeeded" + // OperationStateUnknown - The default value for the operation state enum + OperationStateUnknown OperationState = "Unknown" +) + +// PossibleOperationStateValues returns the possible values for the OperationState const type. +func PossibleOperationStateValues() []OperationState { + return []OperationState{ + OperationStateBlocked, + OperationStateCancelled, + OperationStateExecuting, + OperationStateFailed, + OperationStatePendingExecution, + OperationStatePendingScheduling, + OperationStateScheduled, + OperationStateSucceeded, + OperationStateUnknown, + } +} + +// OptimizationPreference - The preferences customers can select to optimize their requests to ScheduledActions +type OptimizationPreference string + +const ( + // OptimizationPreferenceAvailability - Optimize while considering availability of resources + OptimizationPreferenceAvailability OptimizationPreference = "Availability" + // OptimizationPreferenceCost - Optimize while considering cost savings + OptimizationPreferenceCost OptimizationPreference = "Cost" + // OptimizationPreferenceCostAvailabilityBalanced - Optimize while considering a balance of cost and availability + OptimizationPreferenceCostAvailabilityBalanced OptimizationPreference = "CostAvailabilityBalanced" +) + +// PossibleOptimizationPreferenceValues returns the possible values for the OptimizationPreference const type. +func PossibleOptimizationPreferenceValues() []OptimizationPreference { + return []OptimizationPreference{ + OptimizationPreferenceAvailability, + OptimizationPreferenceCost, + OptimizationPreferenceCostAvailabilityBalanced, + } +} + +// 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, + } +} + +// ResourceOperationType - Type of operation performed on the resources +type ResourceOperationType string + +const ( + // ResourceOperationTypeDeallocate - Deallocate operations on the resources + ResourceOperationTypeDeallocate ResourceOperationType = "Deallocate" + // ResourceOperationTypeHibernate - Hibernate operations on the resources + ResourceOperationTypeHibernate ResourceOperationType = "Hibernate" + // ResourceOperationTypeStart - Start operations on the resources + ResourceOperationTypeStart ResourceOperationType = "Start" + // ResourceOperationTypeUnknown - The default value for this enum type + ResourceOperationTypeUnknown ResourceOperationType = "Unknown" +) + +// PossibleResourceOperationTypeValues returns the possible values for the ResourceOperationType const type. +func PossibleResourceOperationTypeValues() []ResourceOperationType { + return []ResourceOperationType{ + ResourceOperationTypeDeallocate, + ResourceOperationTypeHibernate, + ResourceOperationTypeStart, + ResourceOperationTypeUnknown, + } +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/computeschedule/armcomputeschedule/fake/operations_server.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/operations_server.go new file mode 100644 index 000000000000..0e47f1aeeaef --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/computeschedule/armcomputeschedule" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcomputeschedule.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcomputeschedule.OperationsClientListOptions) (resp azfake.PagerResponder[armcomputeschedule.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcomputeschedule.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[armcomputeschedule.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcomputeschedule.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcomputeschedule.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armcomputeschedule.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 +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go new file mode 100644 index 000000000000..49686eeb5814 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go @@ -0,0 +1,373 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/computeschedule/armcomputeschedule" + "net/http" + "net/url" + "regexp" +) + +// ScheduledActionsServer is a fake server for instances of the armcomputeschedule.ScheduledActionsClient type. +type ScheduledActionsServer struct { + // VirtualMachinesCancelOperations is the fake for method ScheduledActionsClient.VirtualMachinesCancelOperations + // 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) + + // 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) + + // 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) + + // VirtualMachinesExecuteStart is the fake for method ScheduledActionsClient.VirtualMachinesExecuteStart + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesExecuteStart func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteStartRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteStartOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteStartResponse], errResp azfake.ErrorResponder) + + // VirtualMachinesGetOperationStatus is the fake for method ScheduledActionsClient.VirtualMachinesGetOperationStatus + // 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) + + // 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) + + // 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) + + // VirtualMachinesSubmitStart is the fake for method ScheduledActionsClient.VirtualMachinesSubmitStart + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesSubmitStart func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitStartRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitStartOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitStartResponse], errResp azfake.ErrorResponder) +} + +// NewScheduledActionsServerTransport creates a new instance of ScheduledActionsServerTransport with the provided implementation. +// The returned ScheduledActionsServerTransport instance is connected to an instance of armcomputeschedule.ScheduledActionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewScheduledActionsServerTransport(srv *ScheduledActionsServer) *ScheduledActionsServerTransport { + return &ScheduledActionsServerTransport{srv: srv} +} + +// ScheduledActionsServerTransport connects instances of armcomputeschedule.ScheduledActionsClient to instances of ScheduledActionsServer. +// Don't use this type directly, use NewScheduledActionsServerTransport instead. +type ScheduledActionsServerTransport struct { + srv *ScheduledActionsServer +} + +// Do implements the policy.Transporter interface for ScheduledActionsServerTransport. +func (s *ScheduledActionsServerTransport) 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 "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.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) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesCancelOperations(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesCancelOperations == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesCancelOperations not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesCancelOperations` + 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.CancelOperationsRequest](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.VirtualMachinesCancelOperations(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).CancelOperationsResponse, 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")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteDeallocate` + 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.ExecuteDeallocateRequest](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.VirtualMachinesExecuteDeallocate(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).DeallocateResourceOperationResponse, 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")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteHibernate` + 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.ExecuteHibernateRequest](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.VirtualMachinesExecuteHibernate(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).HibernateResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteStart(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesExecuteStart == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteStart not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteStart` + 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.ExecuteStartRequest](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.VirtualMachinesExecuteStart(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).StartResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesGetOperationStatus(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesGetOperationStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesGetOperationStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesGetOperationStatus` + 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.GetOperationStatusRequest](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.VirtualMachinesGetOperationStatus(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).GetOperationStatusResponse, 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")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitDeallocate` + 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.SubmitDeallocateRequest](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.VirtualMachinesSubmitDeallocate(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).DeallocateResourceOperationResponse, 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")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitHibernate` + 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.SubmitHibernateRequest](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.VirtualMachinesSubmitHibernate(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).HibernateResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitStart(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesSubmitStart == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitStart not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitStart` + 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.SubmitStartRequest](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.VirtualMachinesSubmitStart(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).StartResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go new file mode 100644 index 000000000000..98595b101731 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go @@ -0,0 +1,82 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule.ClientFactory type. +type ServerFactory struct { + OperationsServer OperationsServer + ScheduledActionsServer ScheduledActionsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcomputeschedule.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 armcomputeschedule.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trScheduledActionsServer *ScheduledActionsServerTransport +} + +// 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 "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "ScheduledActionsClient": + initServer(s, &s.trScheduledActionsServer, func() *ScheduledActionsServerTransport { + return NewScheduledActionsServerTransport(&s.srv.ScheduledActionsServer) + }) + resp, err = s.trScheduledActionsServer.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/computeschedule/armcomputeschedule/fake/time_rfc3339.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/go.mod b/sdk/resourcemanager/computeschedule/armcomputeschedule/go.mod new file mode 100644 index 000000000000..cf5a3e0b2eec --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/go.sum b/sdk/resourcemanager/computeschedule/armcomputeschedule/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go new file mode 100644 index 000000000000..e682f798ffa7 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go @@ -0,0 +1,312 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +import "time" + +// CancelOperationsRequest - This is the request to cancel running operations in scheduled actions using the operation ids +type CancelOperationsRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // REQUIRED; The list of operation ids to cancel operations on + OperationIDs []*string +} + +// CancelOperationsResponse - This is the response from a cancel operations request +type CancelOperationsResponse struct { + // REQUIRED; An array of resource operations that were successfully cancelled + Results []*ResourceOperation +} + +// DeallocateResourceOperationResponse - The response from a deallocate request +type DeallocateResourceOperationResponse struct { + // REQUIRED; The description of the operation response + Description *string + + // REQUIRED; The location of the deallocate request eg westus + Location *string + + // REQUIRED; The type of resources used in the deallocate request eg virtual machines + Type *string + + // The results from the deallocate request if no errors exist + Results []*ResourceOperation +} + +// ExecuteDeallocateRequest - The ExecuteDeallocateRequest request for executeDeallocate operations +type ExecuteDeallocateRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources +} + +// ExecuteHibernateRequest - The ExecuteHibernateRequest request for executeHibernate operations +type ExecuteHibernateRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources +} + +// ExecuteStartRequest - The ExecuteStartRequest request for executeStart operations +type ExecuteStartRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources +} + +// ExecutionParameters - Extra details needed to run the user's request +type ExecutionParameters struct { + // Details that could optimize the user's request + OptimizationPreference *OptimizationPreference + + // Retry policy the user can pass + RetryPolicy *RetryPolicy +} + +// GetOperationStatusRequest - This is the request to get operation status using operationids +type GetOperationStatusRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // REQUIRED; The list of operation ids to get the status of + OperationIDs []*string +} + +// GetOperationStatusResponse - This is the response from a get operations status request +type GetOperationStatusResponse struct { + // REQUIRED; An array of resource operations based on their operation ids + Results []*ResourceOperation +} + +// HibernateResourceOperationResponse - The response from a Hibernate request +type HibernateResourceOperationResponse struct { + // REQUIRED; The description of the operation response + Description *string + + // REQUIRED; The location of the Hibernate request eg westus + Location *string + + // REQUIRED; The type of resources used in the Hibernate request eg virtual machines + Type *string + + // The results from the Hibernate request if no errors exist + Results []*ResourceOperation +} + +// 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 +} + +// ResourceOperation - High level response from an operation on a resource +type ResourceOperation struct { + // Resource level error code if it exists + ErrorCode *string + + // Resource level error details if they exist + ErrorDetails *string + + // Details of the operation performed on a resource + Operation *ResourceOperationDetails + + // Unique identifier for the resource involved in the operation, eg ArmId + ResourceID *string +} + +// ResourceOperationDetails - The details of a response from an operation on a resource +type ResourceOperationDetails struct { + // REQUIRED; Deadline for the operation + Deadline *time.Time + + // REQUIRED; Type of deadline of the operation + DeadlineType *DeadlineType + + // REQUIRED; Type of operation performed on the resources + OpType *ResourceOperationType + + // REQUIRED; Operation identifier for the unique operation + OperationID *string + + // REQUIRED; Unique identifier for the resource involved in the operation, eg ArmId + ResourceID *string + + // REQUIRED; Current state of the operation + State *OperationState + + // REQUIRED; Subscription id attached to the request + SubscriptionID *string + + // Time the operation was complete if errors are null + CompletedAt *time.Time + + // Operation level errors if they exist + ResourceOperationError *ResourceOperationError + + // Retry policy the user can pass + RetryPolicy *RetryPolicy + + // Timezone for the operation + TimeZone *string +} + +// ResourceOperationError - These describe errors that occur at the resource level +type ResourceOperationError struct { + // REQUIRED; Code for the error eg 404, 500 + ErrorCode *string + + // REQUIRED; Detailed message about the error + ErrorDetails *string +} + +// Resources - The resources needed for the user request +type Resources struct { + // REQUIRED; The resource ids used for the request + IDs []*string +} + +// RetryPolicy - The retry policy for the user request +type RetryPolicy struct { + // Retry count for user request + RetryCount *int32 + + // Retry window in minutes for user request + RetryWindowInMinutes *int32 +} + +// Schedule - The schedule details for the user request +type Schedule struct { + // REQUIRED; The deadline for the operation + DeadLine *time.Time + + // REQUIRED; The deadlinetype of the operation, this can either be InitiateAt or CompleteBy + DeadlineType *DeadlineType + + // REQUIRED; The timezone for the operation + TimeZone *string +} + +// StartResourceOperationResponse - The response from a start request +type StartResourceOperationResponse 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 start request eg virtual machines + Type *string + + // The results from the start request if no errors exist + Results []*ResourceOperation +} + +// SubmitDeallocateRequest - The deallocate request for resources +type SubmitDeallocateRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // 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 +} + +// SubmitHibernateRequest - This is the request for hibernate +type SubmitHibernateRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // 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 +} + +// SubmitStartRequest - This is the request for start +type SubmitStartRequest struct { + // REQUIRED; Correlationid item + Correlationid *string + + // 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 +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go new file mode 100644 index 000000000000..a795929bdac4 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go @@ -0,0 +1,865 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CancelOperationsRequest. +func (c CancelOperationsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", c.Correlationid) + populate(objectMap, "operationIds", c.OperationIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CancelOperationsRequest. +func (c *CancelOperationsRequest) UnmarshalJSON(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 "correlationid": + err = unpopulate(val, "Correlationid", &c.Correlationid) + delete(rawMsg, key) + case "operationIds": + err = unpopulate(val, "OperationIDs", &c.OperationIDs) + 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 CancelOperationsResponse. +func (c CancelOperationsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "results", c.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CancelOperationsResponse. +func (c *CancelOperationsResponse) UnmarshalJSON(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 "results": + err = unpopulate(val, "Results", &c.Results) + 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) + 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 DeallocateResourceOperationResponse. +func (d *DeallocateResourceOperationResponse) UnmarshalJSON(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 ExecuteDeallocateRequest. +func (e ExecuteDeallocateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteDeallocateRequest. +func (e *ExecuteDeallocateRequest) UnmarshalJSON(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 "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) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteHibernateRequest. +func (e *ExecuteHibernateRequest) UnmarshalJSON(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 "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 ExecuteStartRequest. +func (e ExecuteStartRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteStartRequest. +func (e *ExecuteStartRequest) UnmarshalJSON(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 "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 ExecutionParameters. +func (e ExecutionParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "optimizationPreference", e.OptimizationPreference) + populate(objectMap, "retryPolicy", e.RetryPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecutionParameters. +func (e *ExecutionParameters) UnmarshalJSON(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 "optimizationPreference": + err = unpopulate(val, "OptimizationPreference", &e.OptimizationPreference) + delete(rawMsg, key) + case "retryPolicy": + err = unpopulate(val, "RetryPolicy", &e.RetryPolicy) + 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 GetOperationStatusRequest. +func (g GetOperationStatusRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", g.Correlationid) + populate(objectMap, "operationIds", g.OperationIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetOperationStatusRequest. +func (g *GetOperationStatusRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationid": + err = unpopulate(val, "Correlationid", &g.Correlationid) + delete(rawMsg, key) + case "operationIds": + err = unpopulate(val, "OperationIDs", &g.OperationIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetOperationStatusResponse. +func (g GetOperationStatusResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "results", g.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetOperationStatusResponse. +func (g *GetOperationStatusResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "results": + err = unpopulate(val, "Results", &g.Results) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HibernateResourceOperationResponse. +func (h HibernateResourceOperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", h.Description) + populate(objectMap, "location", h.Location) + populate(objectMap, "results", h.Results) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HibernateResourceOperationResponse. +func (h *HibernateResourceOperationResponse) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &h.Description) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &h.Location) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &h.Results) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + 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 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 ResourceOperation. +func (r ResourceOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", r.ErrorCode) + populate(objectMap, "errorDetails", r.ErrorDetails) + populate(objectMap, "operation", r.Operation) + populate(objectMap, "resourceId", r.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperation. +func (r *ResourceOperation) UnmarshalJSON(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 "errorCode": + err = unpopulate(val, "ErrorCode", &r.ErrorCode) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &r.ErrorDetails) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &r.Operation) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) + 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 ResourceOperationDetails. +func (r ResourceOperationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "completedAt", r.CompletedAt) + populateDateTimeRFC3339(objectMap, "deadline", r.Deadline) + populate(objectMap, "deadlineType", r.DeadlineType) + populate(objectMap, "opType", r.OpType) + populate(objectMap, "operationId", r.OperationID) + populate(objectMap, "resourceId", r.ResourceID) + populate(objectMap, "resourceOperationError", r.ResourceOperationError) + populate(objectMap, "retryPolicy", r.RetryPolicy) + populate(objectMap, "state", r.State) + populate(objectMap, "subscriptionId", r.SubscriptionID) + populate(objectMap, "timeZone", r.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperationDetails. +func (r *ResourceOperationDetails) UnmarshalJSON(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 "completedAt": + err = unpopulateDateTimeRFC3339(val, "CompletedAt", &r.CompletedAt) + delete(rawMsg, key) + case "deadline": + err = unpopulateDateTimeRFC3339(val, "Deadline", &r.Deadline) + delete(rawMsg, key) + case "deadlineType": + err = unpopulate(val, "DeadlineType", &r.DeadlineType) + delete(rawMsg, key) + case "opType": + err = unpopulate(val, "OpType", &r.OpType) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &r.OperationID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) + delete(rawMsg, key) + case "resourceOperationError": + err = unpopulate(val, "ResourceOperationError", &r.ResourceOperationError) + delete(rawMsg, key) + case "retryPolicy": + err = unpopulate(val, "RetryPolicy", &r.RetryPolicy) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + 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 ResourceOperationError. +func (r ResourceOperationError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", r.ErrorCode) + populate(objectMap, "errorDetails", r.ErrorDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperationError. +func (r *ResourceOperationError) UnmarshalJSON(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 "errorCode": + err = unpopulate(val, "ErrorCode", &r.ErrorCode) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &r.ErrorDetails) + 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) + populate(objectMap, "ids", r.IDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resources. +func (r *Resources) UnmarshalJSON(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 "ids": + err = unpopulate(val, "IDs", &r.IDs) + 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 RetryPolicy. +func (r RetryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "retryCount", r.RetryCount) + populate(objectMap, "retryWindowInMinutes", r.RetryWindowInMinutes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetryPolicy. +func (r *RetryPolicy) UnmarshalJSON(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 "retryCount": + err = unpopulate(val, "RetryCount", &r.RetryCount) + delete(rawMsg, key) + case "retryWindowInMinutes": + err = unpopulate(val, "RetryWindowInMinutes", &r.RetryWindowInMinutes) + 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 Schedule. +func (s Schedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "deadLine", s.DeadLine) + populate(objectMap, "deadlineType", s.DeadlineType) + populate(objectMap, "timeZone", s.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Schedule. +func (s *Schedule) UnmarshalJSON(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 "deadLine": + err = unpopulateDateTimeRFC3339(val, "DeadLine", &s.DeadLine) + delete(rawMsg, key) + case "deadlineType": + err = unpopulate(val, "DeadlineType", &s.DeadlineType) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &s.TimeZone) + 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 StartResourceOperationResponse. +func (s StartResourceOperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "location", s.Location) + populate(objectMap, "results", s.Results) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StartResourceOperationResponse. +func (s *StartResourceOperationResponse) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &s.Results) + 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 SubmitDeallocateRequest. +func (s SubmitDeallocateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "resources", s.Resources) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitDeallocateRequest. +func (s *SubmitDeallocateRequest) UnmarshalJSON(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 "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) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "resources", s.Resources) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitHibernateRequest. +func (s *SubmitHibernateRequest) UnmarshalJSON(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 "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 SubmitStartRequest. +func (s SubmitStartRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "resources", s.Resources) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitStartRequest. +func (s *SubmitStartRequest) UnmarshalJSON(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 "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 +} + +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/computeschedule/armcomputeschedule/operations_client.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go new file mode 100644 index 000000000000..826a29ed56bf --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +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-06-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.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-06-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/computeschedule/armcomputeschedule/options.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go new file mode 100644 index 000000000000..ab396654085f --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go @@ -0,0 +1,62 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesCancelOperationsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesCancelOperations +// method. +type ScheduledActionsClientVirtualMachinesCancelOperationsOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate +// method. +type ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate +// method. +type ScheduledActionsClientVirtualMachinesExecuteHibernateOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesExecuteStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteStart +// method. +type ScheduledActionsClientVirtualMachinesExecuteStartOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesGetOperationStatusOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationStatus +// method. +type ScheduledActionsClientVirtualMachinesGetOperationStatusOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate +// method. +type ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate +// method. +type ScheduledActionsClientVirtualMachinesSubmitHibernateOptions struct { + // placeholder for future optional parameters +} + +// ScheduledActionsClientVirtualMachinesSubmitStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitStart +// method. +type ScheduledActionsClientVirtualMachinesSubmitStartOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go new file mode 100644 index 000000000000..b28cd383315d --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go @@ -0,0 +1,63 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +// 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 +} + +// ScheduledActionsClientVirtualMachinesCancelOperationsResponse contains the response from method ScheduledActionsClient.VirtualMachinesCancelOperations. +type ScheduledActionsClientVirtualMachinesCancelOperationsResponse struct { + // This is the response from a cancel operations request + CancelOperationsResponse +} + +// ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteDeallocate. +type ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse struct { + // The response from a deallocate request + DeallocateResourceOperationResponse +} + +// ScheduledActionsClientVirtualMachinesExecuteHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteHibernate. +type ScheduledActionsClientVirtualMachinesExecuteHibernateResponse struct { + // The response from a Hibernate request + HibernateResourceOperationResponse +} + +// ScheduledActionsClientVirtualMachinesExecuteStartResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteStart. +type ScheduledActionsClientVirtualMachinesExecuteStartResponse struct { + // The response from a start request + StartResourceOperationResponse +} + +// ScheduledActionsClientVirtualMachinesGetOperationStatusResponse contains the response from method ScheduledActionsClient.VirtualMachinesGetOperationStatus. +type ScheduledActionsClientVirtualMachinesGetOperationStatusResponse struct { + // This is the response from a get operations status request + GetOperationStatusResponse +} + +// ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitDeallocate. +type ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse struct { + // The response from a deallocate request + DeallocateResourceOperationResponse +} + +// ScheduledActionsClientVirtualMachinesSubmitHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitHibernate. +type ScheduledActionsClientVirtualMachinesSubmitHibernateResponse struct { + // The response from a Hibernate request + HibernateResourceOperationResponse +} + +// ScheduledActionsClientVirtualMachinesSubmitStartResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitStart. +type ScheduledActionsClientVirtualMachinesSubmitStartResponse struct { + // The response from a start request + StartResourceOperationResponse +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go new file mode 100644 index 000000000000..957e63a208fb --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go @@ -0,0 +1,556 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +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" +) + +// ScheduledActionsClient contains the methods for the ScheduledActions group. +// Don't use this type directly, use NewScheduledActionsClient() instead. +type ScheduledActionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewScheduledActionsClient creates a new instance of ScheduledActionsClient 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 NewScheduledActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledActionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScheduledActionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// VirtualMachinesCancelOperations - virtualMachinesCancelOperations: cancelOperations for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesCancelOperationsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesCancelOperations +// method. +func (client *ScheduledActionsClient) VirtualMachinesCancelOperations(ctx context.Context, locationparameter string, requestBody CancelOperationsRequest, options *ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (ScheduledActionsClientVirtualMachinesCancelOperationsResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesCancelOperations" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesCancelOperationsCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesCancelOperationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesCancelOperationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesCancelOperationsResponse{}, err + } + resp, err := client.virtualMachinesCancelOperationsHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesCancelOperationsCreateRequest creates the VirtualMachinesCancelOperations request. +func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateRequest(ctx context.Context, locationparameter string, requestBody CancelOperationsRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesCancelOperationsHandleResponse handles the VirtualMachinesCancelOperations response. +func (client *ScheduledActionsClient) virtualMachinesCancelOperationsHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesCancelOperationsResponse, error) { + result := ScheduledActionsClientVirtualMachinesCancelOperationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CancelOperationsResponse); err != nil { + return ScheduledActionsClientVirtualMachinesCancelOperationsResponse{}, err + } + return result, nil +} + +// VirtualMachinesExecuteDeallocate - virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteDeallocate(ctx context.Context, locationparameter string, requestBody ExecuteDeallocateRequest, options *ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteDeallocate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteDeallocateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{}, err + } + resp, err := client.virtualMachinesExecuteDeallocateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteDeallocateCreateRequest creates the VirtualMachinesExecuteDeallocate request. +func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeallocateRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesExecuteDeallocateHandleResponse handles the VirtualMachinesExecuteDeallocate response. +func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeallocateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{}, err + } + return result, nil +} + +// VirtualMachinesExecuteHibernate - virtualMachinesExecuteHibernate: executeHibernate for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteHibernate(ctx context.Context, locationparameter string, requestBody ExecuteHibernateRequest, options *ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (ScheduledActionsClientVirtualMachinesExecuteHibernateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteHibernate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteHibernateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{}, err + } + resp, err := client.virtualMachinesExecuteHibernateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteHibernateCreateRequest creates the VirtualMachinesExecuteHibernate request. +func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteHibernateRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesExecuteHibernateHandleResponse handles the VirtualMachinesExecuteHibernate response. +func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteHibernateResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HibernateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{}, err + } + return result, nil +} + +// VirtualMachinesExecuteStart - virtualMachinesExecuteStart: executeStart for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteStart +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteStart(ctx context.Context, locationparameter string, requestBody ExecuteStartRequest, options *ScheduledActionsClientVirtualMachinesExecuteStartOptions) (ScheduledActionsClientVirtualMachinesExecuteStartResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteStartCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteStartResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteStartResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteStartResponse{}, err + } + resp, err := client.virtualMachinesExecuteStartHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteStartCreateRequest creates the VirtualMachinesExecuteStart request. +func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteStartRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesExecuteStartHandleResponse handles the VirtualMachinesExecuteStart response. +func (client *ScheduledActionsClient) virtualMachinesExecuteStartHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteStartResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteStartResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StartResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteStartResponse{}, err + } + return result, nil +} + +// VirtualMachinesGetOperationStatus - virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesGetOperationStatusOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationStatus +// method. +func (client *ScheduledActionsClient) VirtualMachinesGetOperationStatus(ctx context.Context, locationparameter string, requestBody GetOperationStatusRequest, options *ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (ScheduledActionsClientVirtualMachinesGetOperationStatusResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesGetOperationStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesGetOperationStatusCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{}, err + } + resp, err := client.virtualMachinesGetOperationStatusHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesGetOperationStatusCreateRequest creates the VirtualMachinesGetOperationStatus request. +func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationStatusRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesGetOperationStatusHandleResponse handles the VirtualMachinesGetOperationStatus response. +func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesGetOperationStatusResponse, error) { + result := ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GetOperationStatusResponse); err != nil { + return ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{}, err + } + return result, nil +} + +// VirtualMachinesSubmitDeallocate - virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitDeallocate(ctx context.Context, locationparameter string, requestBody SubmitDeallocateRequest, options *ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitDeallocate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitDeallocateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{}, err + } + resp, err := client.virtualMachinesSubmitDeallocateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitDeallocateCreateRequest creates the VirtualMachinesSubmitDeallocate request. +func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeallocateRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesSubmitDeallocateHandleResponse handles the VirtualMachinesSubmitDeallocate response. +func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeallocateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{}, err + } + return result, nil +} + +// VirtualMachinesSubmitHibernate - virtualMachinesSubmitHibernate: submitHibernate for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitHibernate(ctx context.Context, locationparameter string, requestBody SubmitHibernateRequest, options *ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (ScheduledActionsClientVirtualMachinesSubmitHibernateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitHibernate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitHibernateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{}, err + } + resp, err := client.virtualMachinesSubmitHibernateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitHibernateCreateRequest creates the VirtualMachinesSubmitHibernate request. +func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitHibernateRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesSubmitHibernateHandleResponse handles the VirtualMachinesSubmitHibernate response. +func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitHibernateResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HibernateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{}, err + } + return result, nil +} + +// VirtualMachinesSubmitStart - virtualMachinesSubmitStart: submitStart for a virtual machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitStart +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitStart(ctx context.Context, locationparameter string, requestBody SubmitStartRequest, options *ScheduledActionsClientVirtualMachinesSubmitStartOptions) (ScheduledActionsClientVirtualMachinesSubmitStartResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitStartCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitStartResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitStartResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitStartResponse{}, err + } + resp, err := client.virtualMachinesSubmitStartHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitStartCreateRequest creates the VirtualMachinesSubmitStart request. +func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitStartRequest, options *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") + } + 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", "2024-06-01-preview") + 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 +} + +// virtualMachinesSubmitStartHandleResponse handles the VirtualMachinesSubmitStart response. +func (client *ScheduledActionsClient) virtualMachinesSubmitStartHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitStartResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitStartResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StartResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitStartResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go new file mode 100644 index 000000000000..c69bdcbe0925 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcomputeschedule + +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/containerservicefleet/armcontainerservicefleet/CHANGELOG.md b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md index 168cbc4d21a9..c98479529c26 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.2.1 (2024-08-09) +### Other Changes + + ## 1.2.0 (2024-05-24) ### Features Added diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md index 8cdb3b25b312..40f161a871c0 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 -tag: package-2024-04 +module-version: 1.2.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go index 5d447b55d731..92d0a524e59f 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go @@ -10,7 +10,7 @@ package armcontainerservicefleet const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" - moduleVersion = "v1.2.0" + moduleVersion = "v1.2.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go deleted file mode 100644 index 90f3191a97fe..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_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 armcontainerservicefleet_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_ListByFleet.json -func ExampleFleetMembersClient_NewListByFleetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFleetMembersClient().NewListByFleetPager("rg1", "fleet1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FleetMemberListResult = armcontainerservicefleet.FleetMemberListResult{ - // Value: []*armcontainerservicefleet.FleetMember{ - // { - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("kd30rkdfo49="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Get.json -func ExampleFleetMembersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFleetMembersClient().Get(ctx, "rg1", "fleet1", "member-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FleetMember = armcontainerservicefleet.FleetMember{ - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("kd30rkdfo49="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Create.json -func ExampleFleetMembersClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetMembersClient().BeginCreate(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMember{ - Properties: &armcontainerservicefleet.FleetMemberProperties{ - ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - }, - }, &armcontainerservicefleet.FleetMembersClientBeginCreateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FleetMember = armcontainerservicefleet.FleetMember{ - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Update.json -func ExampleFleetMembersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetMembersClient().BeginUpdate(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMemberUpdate{ - Properties: &armcontainerservicefleet.FleetMemberUpdateProperties{ - Group: to.Ptr("staging"), - }, - }, &armcontainerservicefleet.FleetMembersClientBeginUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FleetMember = armcontainerservicefleet.FleetMember{ - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // Group: to.Ptr("staging"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Delete.json -func ExampleFleetMembersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetMembersClient().BeginDelete(ctx, "rg1", "fleet1", "member-1", &armcontainerservicefleet.FleetMembersClientBeginDeleteOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go deleted file mode 100644 index 8f62cc00bde2..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go +++ /dev/null @@ -1,367 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerservicefleet_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListBySub.json -func ExampleFleetsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFleetsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FleetListResult = armcontainerservicefleet.FleetListResult{ - // Value: []*armcontainerservicefleet.Fleet{ - // { - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), - // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListByResourceGroup.json -func ExampleFleetsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFleetsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FleetListResult = armcontainerservicefleet.FleetListResult{ - // Value: []*armcontainerservicefleet.Fleet{ - // { - // Name: to.Ptr("fleet1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), - // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_Get.json -func ExampleFleetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFleetsClient().Get(ctx, "rg1", "fleet1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Fleet = armcontainerservicefleet.Fleet{ - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), - // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_CreateOrUpdate.json -func ExampleFleetsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetsClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", armcontainerservicefleet.Fleet{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "archv2": to.Ptr(""), - "tier": to.Ptr("production"), - }, - Properties: &armcontainerservicefleet.FleetProperties{ - HubProfile: &armcontainerservicefleet.FleetHubProfile{ - AgentProfile: &armcontainerservicefleet.AgentProfile{ - VMSize: to.Ptr("Standard_DS1"), - }, - DNSPrefix: to.Ptr("dnsprefix1"), - }, - }, - }, &armcontainerservicefleet.FleetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Fleet = armcontainerservicefleet.Fleet{ - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), - // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_PatchTags.json -func ExampleFleetsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetsClient().BeginUpdate(ctx, "rg1", "fleet1", armcontainerservicefleet.FleetPatch{ - Tags: map[string]*string{ - "env": to.Ptr("prod"), - "tier": to.Ptr("secure"), - }, - }, &armcontainerservicefleet.FleetsClientBeginUpdateOptions{IfMatch: to.Ptr("dfjkwelr7384")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Fleet = armcontainerservicefleet.Fleet{ - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "env": to.Ptr("prod"), - // "tier": to.Ptr("secure"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), - // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_Delete.json -func ExampleFleetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rg1", "fleet1", &armcontainerservicefleet.FleetsClientBeginDeleteOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListCredentialsResult.json -func ExampleFleetsClient_ListCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFleetsClient().ListCredentials(ctx, "rg1", "fleet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FleetCredentialResults = armcontainerservicefleet.FleetCredentialResults{ - // Kubeconfigs: []*armcontainerservicefleet.FleetCredentialResult{ - // { - // Name: to.Ptr("credentialName1"), - // Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="), - // }}, - // } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go deleted file mode 100644 index e9b0baabd4dc..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go +++ /dev/null @@ -1,212 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerservicefleet_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_ListByFleet.json -func ExampleFleetUpdateStrategiesClient_NewListByFleetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFleetUpdateStrategiesClient().NewListByFleetPager("rg1", "fleet1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FleetUpdateStrategyListResult = armcontainerservicefleet.FleetUpdateStrategyListResult{ - // Value: []*armcontainerservicefleet.FleetUpdateStrategy{ - // { - // Name: to.Ptr("strategy1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_Get.json -func ExampleFleetUpdateStrategiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFleetUpdateStrategiesClient().Get(ctx, "rg1", "fleet1", "strategy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FleetUpdateStrategy = armcontainerservicefleet.FleetUpdateStrategy{ - // Name: to.Ptr("strategy1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_CreateOrUpdate.json -func ExampleFleetUpdateStrategiesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetUpdateStrategiesClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "strartegy1", armcontainerservicefleet.FleetUpdateStrategy{ - Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - Stages: []*armcontainerservicefleet.UpdateStage{ - { - Name: to.Ptr("stage1"), - AfterStageWaitInSeconds: to.Ptr[int32](3600), - Groups: []*armcontainerservicefleet.UpdateGroup{ - { - Name: to.Ptr("group-a"), - }}, - }}, - }, - }, - }, &armcontainerservicefleet.FleetUpdateStrategiesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FleetUpdateStrategy = armcontainerservicefleet.FleetUpdateStrategy{ - // Name: to.Ptr("strategy1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_Delete.json -func ExampleFleetUpdateStrategiesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFleetUpdateStrategiesClient().BeginDelete(ctx, "rg1", "fleet1", "strategy1", &armcontainerservicefleet.FleetUpdateStrategiesClientBeginDeleteOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod index 4fbee231ef93..a99d214e306e 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 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.7.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go index 2f5b42cf9063..aad23057ca37 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go @@ -179,7 +179,7 @@ type FleetMemberProperties struct { // FleetMemberUpdate - The type used for update operations of the FleetMember. type FleetMemberUpdate struct { - // The updatable properties of the FleetMember. + // The resource-specific properties for this resource. Properties *FleetMemberUpdateProperties } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go deleted file mode 100644 index 904cfa948935..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go +++ /dev/null @@ -1,56 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerservicefleet_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-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 := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcontainerservicefleet.OperationListResult{ - // Value: []*armcontainerservicefleet.Operation{ - // { - // Name: to.Ptr("Microsoft.ContainerService/locations/operations/read"), - // Display: &armcontainerservicefleet.OperationDisplay{ - // Description: to.Ptr("Gets the status of an asynchronous operation"), - // Operation: to.Ptr("Get Operation"), - // Provider: to.Ptr("Microsoft Container Service"), - // Resource: to.Ptr("Operation"), - // }, - // Origin: to.Ptr(armcontainerservicefleet.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go deleted file mode 100644 index a8a0a93fe0e5..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go +++ /dev/null @@ -1,668 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerservicefleet_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_ListByFleet.json -func ExampleUpdateRunsClient_NewListByFleetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUpdateRunsClient().NewListByFleetPager("rg1", "fleet1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UpdateRunListResult = armcontainerservicefleet.UpdateRunListResult{ - // Value: []*armcontainerservicefleet.UpdateRun{ - // { - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Get.json -func ExampleUpdateRunsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUpdateRunsClient().Get(ctx, "rg1", "fleet1", "run1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_CreateOrUpdate.json -func ExampleUpdateRunsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.UpdateRun{ - Properties: &armcontainerservicefleet.UpdateRunProperties{ - ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - }, - Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - KubernetesVersion: to.Ptr("1.26.1"), - }, - }, - Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - Stages: []*armcontainerservicefleet.UpdateStage{ - { - Name: to.Ptr("stage1"), - AfterStageWaitInSeconds: to.Ptr[int32](3600), - Groups: []*armcontainerservicefleet.UpdateGroup{ - { - Name: to.Ptr("group-a"), - }}, - }}, - }, - UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - }, - }, &armcontainerservicefleet.UpdateRunsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Delete.json -func ExampleUpdateRunsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginDelete(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginDeleteOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Skip.json -func ExampleUpdateRunsClient_BeginSkip() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginSkip(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.SkipProperties{ - Targets: []*armcontainerservicefleet.SkipTarget{ - { - Name: to.Ptr("member-one"), - Type: to.Ptr(armcontainerservicefleet.TargetTypeMember), - }, - { - Name: to.Ptr("stage1"), - Type: to.Ptr(armcontainerservicefleet.TargetTypeAfterStageWait), - }}, - }, &armcontainerservicefleet.UpdateRunsClientBeginSkipOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), - // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster-1"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), - // }, - // }, - // { - // Name: to.Ptr("group-b"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-two"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster-2"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }, - // { - // Name: to.Ptr("group-b"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Start.json -func ExampleUpdateRunsClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginStart(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginStartOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Stop.json -func ExampleUpdateRunsClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginStop(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginStopOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/CHANGELOG.md b/sdk/resourcemanager/containerstorage/armcontainerstorage/CHANGELOG.md new file mode 100644 index 000000000000..64bd55ac4124 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerstorage/armcontainerstorage` 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/containerstorage/armcontainerstorage/LICENSE.txt b/sdk/resourcemanager/containerstorage/armcontainerstorage/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/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/containerstorage/armcontainerstorage/README.md b/sdk/resourcemanager/containerstorage/armcontainerstorage/README.md new file mode 100644 index 000000000000..ff32d56e776b --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/README.md @@ -0,0 +1,92 @@ +# Azure Containerstorage Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerstorage/armcontainerstorage)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerstorage/armcontainerstorage) + +The `armcontainerstorage` module provides operations for working with Azure Containerstorage. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/containerstorage/armcontainerstorage) + +# 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 Containerstorage module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerstorage/armcontainerstorage +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Containerstorage. 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 Containerstorage 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 := armcontainerstorage.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 := armcontainerstorage.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.NewPoolsClient() +``` + +## 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 `Containerstorage` 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/containerstorage/armcontainerstorage/autorest.md b/sdk/resourcemanager/containerstorage/armcontainerstorage/autorest.md new file mode 100644 index 000000000000..fcb6c5904b9f --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/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/containerstorage/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerstorage/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/containerstorage/armcontainerstorage/build.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/build.go new file mode 100644 index 000000000000..910d3d406430 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/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/containerstorage/armcontainerstorage + +package armcontainerstorage diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/ci.yml b/sdk/resourcemanager/containerstorage/armcontainerstorage/ci.yml new file mode 100644 index 000000000000..8c36707591c1 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/ci.yml @@ -0,0 +1,28 @@ +# 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/containerstorage/armcontainerstorage/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/containerstorage/armcontainerstorage/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/containerstorage/armcontainerstorage' diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/client_factory.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/client_factory.go new file mode 100644 index 000000000000..5faf18cad3b5 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/client_factory.go @@ -0,0 +1,68 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +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. +// - 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 +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewPoolsClient creates a new instance of PoolsClient. +func (c *ClientFactory) NewPoolsClient() *PoolsClient { + return &PoolsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient. +func (c *ClientFactory) NewSnapshotsClient() *SnapshotsClient { + return &SnapshotsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewVolumesClient creates a new instance of VolumesClient. +func (c *ClientFactory) NewVolumesClient() *VolumesClient { + return &VolumesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/constants.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/constants.go new file mode 100644 index 000000000000..b819279ee00f --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/constants.go @@ -0,0 +1,255 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerstorage/armcontainerstorage" + 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, + } +} + +// AssignmentStatusState - Status of the assignment resource +type AssignmentStatusState string + +const ( + // AssignmentStatusStateAssigned - The assignment to the pool was successful. + AssignmentStatusStateAssigned AssignmentStatusState = "Assigned" + // AssignmentStatusStateAssigning - The assignment of the pool to the resource is in progress + AssignmentStatusStateAssigning AssignmentStatusState = "Assigning" + // AssignmentStatusStateFailed - The operation of assigning or unassigning the pool failed. + AssignmentStatusStateFailed AssignmentStatusState = "Failed" + // AssignmentStatusStateUnassigning - The pool is being unassigned. + AssignmentStatusStateUnassigning AssignmentStatusState = "Unassigning" +) + +// PossibleAssignmentStatusStateValues returns the possible values for the AssignmentStatusState const type. +func PossibleAssignmentStatusStateValues() []AssignmentStatusState { + return []AssignmentStatusState{ + AssignmentStatusStateAssigned, + AssignmentStatusStateAssigning, + AssignmentStatusStateFailed, + AssignmentStatusStateUnassigning, + } +} + +// AzureDiskSKUName - SKU of the underlying managed disk +type AzureDiskSKUName string + +const ( + // AzureDiskSKUNamePremiumLRS - Premium_LRS SKU + AzureDiskSKUNamePremiumLRS AzureDiskSKUName = "Premium_LRS" + // AzureDiskSKUNamePremiumV2LRS - PremiumV2_LRS SKU + AzureDiskSKUNamePremiumV2LRS AzureDiskSKUName = "PremiumV2_LRS" + // AzureDiskSKUNamePremiumZRS - Premium_ZRS SKU + AzureDiskSKUNamePremiumZRS AzureDiskSKUName = "Premium_ZRS" + // AzureDiskSKUNameStandardLRS - Standard_LRS SKU + AzureDiskSKUNameStandardLRS AzureDiskSKUName = "Standard_LRS" + // AzureDiskSKUNameStandardSSDLRS - StandardSSD_LRS SKU + AzureDiskSKUNameStandardSSDLRS AzureDiskSKUName = "StandardSSD_LRS" + // AzureDiskSKUNameStandardSSDZRS - StandardSSD_ZRS SKU + AzureDiskSKUNameStandardSSDZRS AzureDiskSKUName = "StandardSSD_ZRS" + // AzureDiskSKUNameUltraSSDLRS - UltraSSD_LRS SKU + AzureDiskSKUNameUltraSSDLRS AzureDiskSKUName = "UltraSSD_LRS" +) + +// PossibleAzureDiskSKUNameValues returns the possible values for the AzureDiskSKUName const type. +func PossibleAzureDiskSKUNameValues() []AzureDiskSKUName { + return []AzureDiskSKUName{ + AzureDiskSKUNamePremiumLRS, + AzureDiskSKUNamePremiumV2LRS, + AzureDiskSKUNamePremiumZRS, + AzureDiskSKUNameStandardLRS, + AzureDiskSKUNameStandardSSDLRS, + AzureDiskSKUNameStandardSSDZRS, + AzureDiskSKUNameUltraSSDLRS, + } +} + +// 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, + } +} + +// ElasticSanSKUName - ElasticSAN SKUs +type ElasticSanSKUName string + +const ( + // ElasticSanSKUNamePremiumLRS - Premium_LRS SKU + ElasticSanSKUNamePremiumLRS ElasticSanSKUName = "Premium_LRS" + // ElasticSanSKUNamePremiumZRS - Premium_ZRS SKU + ElasticSanSKUNamePremiumZRS ElasticSanSKUName = "Premium_ZRS" +) + +// PossibleElasticSanSKUNameValues returns the possible values for the ElasticSanSKUName const type. +func PossibleElasticSanSKUNameValues() []ElasticSanSKUName { + return []ElasticSanSKUName{ + ElasticSanSKUNamePremiumLRS, + ElasticSanSKUNamePremiumZRS, + } +} + +// 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, + } +} + +// ProvisioningState - Provisioning state of the resource. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + 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, + } +} + +// ReclaimPolicy - Reclaim policy +type ReclaimPolicy string + +const ( + // ReclaimPolicyDelete - Delete resource + ReclaimPolicyDelete ReclaimPolicy = "Delete" + // ReclaimPolicyRetain - Retain resource + ReclaimPolicyRetain ReclaimPolicy = "Retain" +) + +// PossibleReclaimPolicyValues returns the possible values for the ReclaimPolicy const type. +func PossibleReclaimPolicyValues() []ReclaimPolicy { + return []ReclaimPolicy{ + ReclaimPolicyDelete, + ReclaimPolicyRetain, + } +} + +// ResourceOperationStatusState - State of the resource. +type ResourceOperationStatusState string + +const ( + // ResourceOperationStatusStateAvailable - The resource is available. + ResourceOperationStatusStateAvailable ResourceOperationStatusState = "Available" + // ResourceOperationStatusStatePending - The resource is pending. + ResourceOperationStatusStatePending ResourceOperationStatusState = "Pending" + // ResourceOperationStatusStateUnavailable - The resource is unavailable. + ResourceOperationStatusStateUnavailable ResourceOperationStatusState = "Unavailable" +) + +// PossibleResourceOperationStatusStateValues returns the possible values for the ResourceOperationStatusState const type. +func PossibleResourceOperationStatusStateValues() []ResourceOperationStatusState { + return []ResourceOperationStatusState{ + ResourceOperationStatusStateAvailable, + ResourceOperationStatusStatePending, + ResourceOperationStatusStateUnavailable, + } +} + +// Zone - Availability Zones +type Zone string + +const ( + // ZoneZone1 - First availability zone. + ZoneZone1 Zone = "1" + // ZoneZone2 - Second availability zone. + ZoneZone2 Zone = "2" + // ZoneZone3 - Third availability zone. + ZoneZone3 Zone = "3" +) + +// PossibleZoneValues returns the possible values for the Zone const type. +func PossibleZoneValues() []Zone { + return []Zone{ + ZoneZone1, + ZoneZone2, + ZoneZone3, + } +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/internal.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/containerstorage/armcontainerstorage/fake/operations_server.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/operations_server.go new file mode 100644 index 000000000000..90e252df207c --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/containerstorage/armcontainerstorage" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcontainerstorage.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontainerstorage.OperationsClientListOptions) (resp azfake.PagerResponder[armcontainerstorage.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcontainerstorage.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[armcontainerstorage.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcontainerstorage.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcontainerstorage.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armcontainerstorage.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 +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/pools_server.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/pools_server.go new file mode 100644 index 000000000000..8ea332c44aa6 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/pools_server.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/containerstorage/armcontainerstorage" + "net/http" + "net/url" + "regexp" +) + +// PoolsServer is a fake server for instances of the armcontainerstorage.PoolsClient type. +type PoolsServer struct { + // BeginCreateOrUpdate is the fake for method PoolsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, resource armcontainerstorage.Pool, options *armcontainerstorage.PoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerstorage.PoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PoolsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, poolName string, options *armcontainerstorage.PoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerstorage.PoolsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PoolsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, poolName string, options *armcontainerstorage.PoolsClientGetOptions) (resp azfake.Responder[armcontainerstorage.PoolsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PoolsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontainerstorage.PoolsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontainerstorage.PoolsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PoolsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcontainerstorage.PoolsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcontainerstorage.PoolsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method PoolsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, poolName string, properties armcontainerstorage.PoolUpdate, options *armcontainerstorage.PoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerstorage.PoolsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPoolsServerTransport creates a new instance of PoolsServerTransport with the provided implementation. +// The returned PoolsServerTransport instance is connected to an instance of armcontainerstorage.PoolsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPoolsServerTransport(srv *PoolsServer) *PoolsServerTransport { + return &PoolsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerstorage.PoolsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerstorage.PoolsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerstorage.PoolsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcontainerstorage.PoolsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcontainerstorage.PoolsClientUpdateResponse]](), + } +} + +// PoolsServerTransport connects instances of armcontainerstorage.PoolsClient to instances of PoolsServer. +// Don't use this type directly, use NewPoolsServerTransport instead. +type PoolsServerTransport struct { + srv *PoolsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerstorage.PoolsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerstorage.PoolsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerstorage.PoolsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcontainerstorage.PoolsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcontainerstorage.PoolsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PoolsServerTransport. +func (p *PoolsServerTransport) 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 "PoolsClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PoolsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PoolsClient.Get": + resp, err = p.dispatchGet(req) + case "PoolsClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PoolsClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PoolsClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PoolsServerTransport) 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\.ContainerStorage/pools/(?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[armcontainerstorage.Pool](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, poolNameParam, 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}, resp.StatusCode) { + p.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) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PoolsServerTransport) 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\.ContainerStorage/pools/(?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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, poolNameParam, 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.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)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PoolsServerTransport) 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\.ContainerStorage/pools/(?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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, poolNameParam, 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).Pool, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PoolsServerTransport) 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\.ContainerStorage/pools` + 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 *armcontainerstorage.PoolsClientListByResourceGroupResponse, 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 *PoolsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools` + 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.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcontainerstorage.PoolsClientListBySubscriptionResponse, 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) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PoolsServerTransport) 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\.ContainerStorage/pools/(?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[armcontainerstorage.PoolUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, poolNameParam, 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 +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/server_factory.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/server_factory.go new file mode 100644 index 000000000000..c6b03ace148b --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/server_factory.go @@ -0,0 +1,90 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage.ClientFactory type. +type ServerFactory struct { + OperationsServer OperationsServer + PoolsServer PoolsServer + SnapshotsServer SnapshotsServer + VolumesServer VolumesServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcontainerstorage.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 armcontainerstorage.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trPoolsServer *PoolsServerTransport + trSnapshotsServer *SnapshotsServerTransport + trVolumesServer *VolumesServerTransport +} + +// 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 "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "PoolsClient": + initServer(s, &s.trPoolsServer, func() *PoolsServerTransport { return NewPoolsServerTransport(&s.srv.PoolsServer) }) + resp, err = s.trPoolsServer.Do(req) + case "SnapshotsClient": + initServer(s, &s.trSnapshotsServer, func() *SnapshotsServerTransport { return NewSnapshotsServerTransport(&s.srv.SnapshotsServer) }) + resp, err = s.trSnapshotsServer.Do(req) + case "VolumesClient": + initServer(s, &s.trVolumesServer, func() *VolumesServerTransport { return NewVolumesServerTransport(&s.srv.VolumesServer) }) + resp, err = s.trVolumesServer.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/containerstorage/armcontainerstorage/fake/snapshots_server.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/snapshots_server.go new file mode 100644 index 000000000000..c5c8e95e7f6c --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/snapshots_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/containerstorage/armcontainerstorage" + "net/http" + "net/url" + "regexp" +) + +// SnapshotsServer is a fake server for instances of the armcontainerstorage.SnapshotsClient type. +type SnapshotsServer struct { + // BeginCreateOrUpdate is the fake for method SnapshotsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, resource armcontainerstorage.Snapshot, options *armcontainerstorage.SnapshotsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerstorage.SnapshotsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SnapshotsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *armcontainerstorage.SnapshotsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerstorage.SnapshotsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SnapshotsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *armcontainerstorage.SnapshotsClientGetOptions) (resp azfake.Responder[armcontainerstorage.SnapshotsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByPoolPager is the fake for method SnapshotsClient.NewListByPoolPager + // HTTP status codes to indicate success: http.StatusOK + NewListByPoolPager func(resourceGroupName string, poolName string, options *armcontainerstorage.SnapshotsClientListByPoolOptions) (resp azfake.PagerResponder[armcontainerstorage.SnapshotsClientListByPoolResponse]) +} + +// NewSnapshotsServerTransport creates a new instance of SnapshotsServerTransport with the provided implementation. +// The returned SnapshotsServerTransport instance is connected to an instance of armcontainerstorage.SnapshotsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSnapshotsServerTransport(srv *SnapshotsServer) *SnapshotsServerTransport { + return &SnapshotsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerstorage.SnapshotsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerstorage.SnapshotsClientDeleteResponse]](), + newListByPoolPager: newTracker[azfake.PagerResponder[armcontainerstorage.SnapshotsClientListByPoolResponse]](), + } +} + +// SnapshotsServerTransport connects instances of armcontainerstorage.SnapshotsClient to instances of SnapshotsServer. +// Don't use this type directly, use NewSnapshotsServerTransport instead. +type SnapshotsServerTransport struct { + srv *SnapshotsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerstorage.SnapshotsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerstorage.SnapshotsClientDeleteResponse]] + newListByPoolPager *tracker[azfake.PagerResponder[armcontainerstorage.SnapshotsClientListByPoolResponse]] +} + +// Do implements the policy.Transporter interface for SnapshotsServerTransport. +func (s *SnapshotsServerTransport) 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 "SnapshotsClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SnapshotsClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SnapshotsClient.Get": + resp, err = s.dispatchGet(req) + case "SnapshotsClient.NewListByPoolPager": + resp, err = s.dispatchNewListByPoolPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/snapshots/(?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[armcontainerstorage.Snapshot](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + snapshotNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("snapshotName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, poolNameParam, snapshotNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.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) { + s.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) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/snapshots/(?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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + snapshotNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("snapshotName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, poolNameParam, snapshotNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SnapshotsServerTransport) 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\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/snapshots/(?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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + snapshotNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("snapshotName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, poolNameParam, snapshotNameParam, 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).Snapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchNewListByPoolPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByPoolPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPoolPager not implemented")} + } + newListByPoolPager := s.newListByPoolPager.get(req) + if newListByPoolPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/snapshots` + 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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByPoolPager(resourceGroupNameParam, poolNameParam, nil) + newListByPoolPager = &resp + s.newListByPoolPager.add(req, newListByPoolPager) + server.PagerResponderInjectNextLinks(newListByPoolPager, req, func(page *armcontainerstorage.SnapshotsClientListByPoolResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPoolPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByPoolPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPoolPager) { + s.newListByPoolPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/time_rfc3339.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/containerstorage/armcontainerstorage/fake/volumes_server.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/volumes_server.go new file mode 100644 index 000000000000..53d1ea8a6730 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/fake/volumes_server.go @@ -0,0 +1,332 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/containerstorage/armcontainerstorage" + "net/http" + "net/url" + "regexp" +) + +// VolumesServer is a fake server for instances of the armcontainerstorage.VolumesClient type. +type VolumesServer struct { + // BeginCreateOrUpdate is the fake for method VolumesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, volumeName string, resource armcontainerstorage.Volume, options *armcontainerstorage.VolumesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerstorage.VolumesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method VolumesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *armcontainerstorage.VolumesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerstorage.VolumesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method VolumesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *armcontainerstorage.VolumesClientGetOptions) (resp azfake.Responder[armcontainerstorage.VolumesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByPoolPager is the fake for method VolumesClient.NewListByPoolPager + // HTTP status codes to indicate success: http.StatusOK + NewListByPoolPager func(resourceGroupName string, poolName string, options *armcontainerstorage.VolumesClientListByPoolOptions) (resp azfake.PagerResponder[armcontainerstorage.VolumesClientListByPoolResponse]) + + // BeginUpdate is the fake for method VolumesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, poolName string, volumeName string, properties armcontainerstorage.VolumeUpdate, options *armcontainerstorage.VolumesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerstorage.VolumesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewVolumesServerTransport creates a new instance of VolumesServerTransport with the provided implementation. +// The returned VolumesServerTransport instance is connected to an instance of armcontainerstorage.VolumesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVolumesServerTransport(srv *VolumesServer) *VolumesServerTransport { + return &VolumesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerstorage.VolumesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerstorage.VolumesClientDeleteResponse]](), + newListByPoolPager: newTracker[azfake.PagerResponder[armcontainerstorage.VolumesClientListByPoolResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcontainerstorage.VolumesClientUpdateResponse]](), + } +} + +// VolumesServerTransport connects instances of armcontainerstorage.VolumesClient to instances of VolumesServer. +// Don't use this type directly, use NewVolumesServerTransport instead. +type VolumesServerTransport struct { + srv *VolumesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerstorage.VolumesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerstorage.VolumesClientDeleteResponse]] + newListByPoolPager *tracker[azfake.PagerResponder[armcontainerstorage.VolumesClientListByPoolResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcontainerstorage.VolumesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for VolumesServerTransport. +func (v *VolumesServerTransport) 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 "VolumesClient.BeginCreateOrUpdate": + resp, err = v.dispatchBeginCreateOrUpdate(req) + case "VolumesClient.BeginDelete": + resp, err = v.dispatchBeginDelete(req) + case "VolumesClient.Get": + resp, err = v.dispatchGet(req) + case "VolumesClient.NewListByPoolPager": + resp, err = v.dispatchNewListByPoolPager(req) + case "VolumesClient.BeginUpdate": + resp, err = v.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VolumesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := v.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?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[armcontainerstorage.Volume](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, poolNameParam, volumeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + v.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) { + v.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) { + v.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (v *VolumesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if v.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := v.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginDelete(req.Context(), resourceGroupNameParam, poolNameParam, volumeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + v.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + v.beginDelete.remove(req) + } + + return resp, nil +} + +func (v *VolumesServerTransport) 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\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, poolNameParam, volumeNameParam, 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).Volume, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VolumesServerTransport) dispatchNewListByPoolPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByPoolPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPoolPager not implemented")} + } + newListByPoolPager := v.newListByPoolPager.get(req) + if newListByPoolPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes` + 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 + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + resp := v.srv.NewListByPoolPager(resourceGroupNameParam, poolNameParam, nil) + newListByPoolPager = &resp + v.newListByPoolPager.add(req, newListByPoolPager) + server.PagerResponderInjectNextLinks(newListByPoolPager, req, func(page *armcontainerstorage.VolumesClientListByPoolResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPoolPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByPoolPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPoolPager) { + v.newListByPoolPager.remove(req) + } + return resp, nil +} + +func (v *VolumesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := v.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerStorage/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?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[armcontainerstorage.VolumeUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdate(req.Context(), resourceGroupNameParam, poolNameParam, volumeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + v.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) { + v.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) { + v.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/go.mod b/sdk/resourcemanager/containerstorage/armcontainerstorage/go.mod new file mode 100644 index 000000000000..8843d6fcb660 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerstorage/armcontainerstorage + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/go.sum b/sdk/resourcemanager/containerstorage/armcontainerstorage/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/models.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/models.go new file mode 100644 index 000000000000..af2d9390769e --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/models.go @@ -0,0 +1,439 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +import "time" + +// Assignment Properties +type Assignment struct { + // REQUIRED; Resource id for the assigned resource + ID *string + + // READ-ONLY; Indicates if the assignment is in a usable state + Status *AssignmentStatus +} + +// AssignmentStatus - Status of the assignment resource +type AssignmentStatus struct { + // REQUIRED; State of the assignment resource + State *AssignmentStatusState + + // Reason for the status + Message *string +} + +// AzureDisk - Azure Disk Pool Properties +type AzureDisk struct { + // Only required if individual disk selection is desired. Path to disk, e.g. :/dev/sda or WWN. Supports specifying multiple + // disks (same syntax as tags). + Disks []*Disk + + // Encryption specifies the encryption configuration for the Azure Disk pool + Encryption *Encryption + + // Sku name + SKUName *AzureDiskSKUName + + // READ-ONLY; Managed resource group for the pool. + ResourceGroup *string +} + +// AzureDiskUpdate - Azure Disk Pool Properties +type AzureDiskUpdate struct { + // Only required if individual disk selection is desired. Path to disk, e.g. :/dev/sda or WWN. Supports specifying multiple + // disks (same syntax as tags). + Disks []*Disk +} + +// Disk - Model for disk for that pool is using +type Disk struct { + // REQUIRED; ID is the disk identifier visible to the OS. It is typically the WWN or disk ID in formats such as eui.e8238fa6bf530001001b448b45263379 + // or 0x5002cf6cbc5dd460 + ID *string + + // REQUIRED; Reference is the location of the disk in an external system. + Reference *string +} + +// ElasticSan - Elastic San Pool Properties +type ElasticSan struct { + // Encryption specifies the encryption configuration for the Azure Disk pool + Encryption *Encryption + + // Sku name + SKUName *ElasticSanSKUName + + // READ-ONLY; Managed resource group for the pool. + ResourceGroup *string +} + +// ElasticSanVolumeProperties - Properties of the ElasticSAN iSCSI target +type ElasticSanVolumeProperties struct { + // REQUIRED; iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server" + TargetIqn *string + + // REQUIRED; iSCSI Target Portal Host Name + TargetPortalHostname *string + + // REQUIRED; iSCSI Target Portal Port + TargetPortalPort *int32 +} + +// Encryption key properties for the pool. +type Encryption struct { + // REQUIRED; The name of the key vault key. + KeyName *string + + // REQUIRED; The URI of the key vault. + KeyVaultURI *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity +} + +// EphemeralDisk - Ephemeral Disk Pool Properties +type EphemeralDisk struct { + // Only required if individual disk selection is desired. Path to disk, e.g. :/dev/sda or WWN. Supports specifying multiple + // disks (same syntax as tags). + Disks []*Disk + + // The number of data copies. Default 3. + Replicas *int64 +} + +// 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 + // 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 +} + +// Pool resource +type Pool struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *PoolProperties + + // 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 +} + +// PoolListResult - The response of a Pool list operation. +type PoolListResult struct { + // REQUIRED; The Pool items on this page + Value []*Pool + + // The link to the next page of items + NextLink *string +} + +// PoolProperties - Pool Properties +type PoolProperties struct { + // REQUIRED; Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + PoolType *PoolType + + // List of resources that should have access to the pool. Typically ARM references to AKS clusters or ACI Container Groups. + // For local and standard this must be a single reference. For ElasticSAN there + // can be many. + Assignments []*Assignment + + // ReclaimPolicy defines what happens to the backend storage when StoragePool is deleted + ReclaimPolicy *ReclaimPolicy + + // Resources represent the resources the pool should have. + Resources *Resources + + // List of availability zones that resources can be created in. + Zones []*Zone + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; The operational status of the resource + Status *ResourceOperationalStatus +} + +// PoolType - Type of the Pool: ephemeralDisk, azureDisk, or elasticsan +type PoolType struct { + // Disk Pool Properties + AzureDisk *AzureDisk + + // Elastic San Pool Properties + ElasticSan *ElasticSan + + // Ephemeral Pool Properties + EphemeralDisk *EphemeralDisk +} + +// PoolTypeUpdate - Type of the Pool: ephemeralDisk, azureDisk, or elasticsan +type PoolTypeUpdate struct { + // Disk Pool Properties + AzureDisk *AzureDiskUpdate + + // Elastic San Pool Properties + ElasticSan any + + // Ephemeral Pool Properties + EphemeralDisk *EphemeralDisk +} + +// PoolUpdate - The type used for update operations of the Pool. +type PoolUpdate struct { + // The resource-specific properties for this resource. + Properties *PoolUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// PoolUpdateProperties - The updatable properties of the Pool. +type PoolUpdateProperties struct { + // List of resources that should have access to the pool. Typically ARM references to AKS clusters or ACI Container Groups. + // For local and standard this must be a single reference. For ElasticSAN there + // can be many. + Assignments []*Assignment + + // Type of the Pool: ephemeralDisk, azureDisk, or elasticsan. + PoolType *PoolTypeUpdate + + // Resources represent the resources the pool should have. + Resources *Resources +} + +// Requests for capacity for the pool. +type Requests struct { + // Requested capacity of the pool in GiB. + Storage *int64 +} + +// ResourceOperationalStatus - Status of the resource +type ResourceOperationalStatus struct { + // REQUIRED; state of the resource + State *ResourceOperationStatusState + + // Reason for state. + Message *string +} + +// Resources - Resource Requests for the pool. +type Resources struct { + // Requests for capacity for the pool. + Requests *Requests +} + +// Snapshot - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type Snapshot struct { + // The resource-specific properties for this resource. + Properties *SnapshotProperties + + // 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 +} + +// SnapshotListResult - The response of a Snapshot list operation. +type SnapshotListResult struct { + // REQUIRED; The Snapshot items on this page + Value []*Snapshot + + // The link to the next page of items + NextLink *string +} + +// SnapshotProperties - Volume Snapshot Properties +type SnapshotProperties struct { + // REQUIRED; Reference to the source volume + Source *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; The status of the resource. + Status *ResourceOperationalStatus +} + +// 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 +} + +// 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 +} + +// Volume - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type Volume struct { + // The resource-specific properties for this resource. + Properties *VolumeProperties + + // 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 +} + +// VolumeListResult - The response of a Volume list operation. +type VolumeListResult struct { + // REQUIRED; The Volume items on this page + Value []*Volume + + // The link to the next page of items + NextLink *string +} + +// VolumeProperties - Volume Properties +type VolumeProperties struct { + // REQUIRED; Requested capacity in GiB + CapacityGiB *int64 + + // REQUIRED; String KV pairs indicating labels + Labels map[string]*string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; The status of the resource. + Status *ResourceOperationalStatus + + // READ-ONLY; Properties of the volume + VolumeType *VolumeType +} + +// VolumeType - Properties of the volume +type VolumeType struct { + // READ-ONLY; Properties of the ElasticSAN iSCSI target + ElasticSan *ElasticSanVolumeProperties +} + +// VolumeUpdate - The type used for update operations of the Volume. +type VolumeUpdate struct { + // The resource-specific properties for this resource. + Properties *VolumeUpdateProperties +} + +// VolumeUpdateProperties - The updatable properties of the Volume. +type VolumeUpdateProperties struct { + // Requested capacity in GiB + CapacityGiB *int64 + + // String KV pairs indicating labels + Labels map[string]*string +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/models_serde.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/models_serde.go new file mode 100644 index 000000000000..9ce82604017d --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/models_serde.go @@ -0,0 +1,1236 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Assignment. +func (a Assignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Assignment. +func (a *Assignment) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &a.Status) + 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 AssignmentStatus. +func (a AssignmentStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", a.Message) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentStatus. +func (a *AssignmentStatus) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + 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 AzureDisk. +func (a AzureDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disks", a.Disks) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "resourceGroup", a.ResourceGroup) + populate(objectMap, "skuName", a.SKUName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDisk. +func (a *AzureDisk) UnmarshalJSON(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 "disks": + err = unpopulate(val, "Disks", &a.Disks) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) + delete(rawMsg, key) + case "skuName": + err = unpopulate(val, "SKUName", &a.SKUName) + 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 AzureDiskUpdate. +func (a AzureDiskUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disks", a.Disks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDiskUpdate. +func (a *AzureDiskUpdate) UnmarshalJSON(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 "disks": + err = unpopulate(val, "Disks", &a.Disks) + 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 Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "reference", d.Reference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Disk. +func (d *Disk) UnmarshalJSON(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 "reference": + err = unpopulate(val, "Reference", &d.Reference) + 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 ElasticSan. +func (e ElasticSan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encryption", e.Encryption) + populate(objectMap, "resourceGroup", e.ResourceGroup) + populate(objectMap, "skuName", e.SKUName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticSan. +func (e *ElasticSan) UnmarshalJSON(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 "encryption": + err = unpopulate(val, "Encryption", &e.Encryption) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &e.ResourceGroup) + delete(rawMsg, key) + case "skuName": + err = unpopulate(val, "SKUName", &e.SKUName) + 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 ElasticSanVolumeProperties. +func (e ElasticSanVolumeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetIqn", e.TargetIqn) + populate(objectMap, "targetPortalHostname", e.TargetPortalHostname) + populate(objectMap, "targetPortalPort", e.TargetPortalPort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticSanVolumeProperties. +func (e *ElasticSanVolumeProperties) UnmarshalJSON(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 "targetIqn": + err = unpopulate(val, "TargetIqn", &e.TargetIqn) + delete(rawMsg, key) + case "targetPortalHostname": + err = unpopulate(val, "TargetPortalHostname", &e.TargetPortalHostname) + delete(rawMsg, key) + case "targetPortalPort": + err = unpopulate(val, "TargetPortalPort", &e.TargetPortalPort) + 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 Encryption. +func (e Encryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "keyName", e.KeyName) + populate(objectMap, "keyVaultUri", e.KeyVaultURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Encryption. +func (e *Encryption) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "keyName": + err = unpopulate(val, "KeyName", &e.KeyName) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &e.KeyVaultURI) + 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 EphemeralDisk. +func (e EphemeralDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disks", e.Disks) + populate(objectMap, "replicas", e.Replicas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EphemeralDisk. +func (e *EphemeralDisk) UnmarshalJSON(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 "disks": + err = unpopulate(val, "Disks", &e.Disks) + delete(rawMsg, key) + case "replicas": + err = unpopulate(val, "Replicas", &e.Replicas) + 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 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) + 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 Pool. +func (p Pool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Pool. +func (p *Pool) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &p.Location) + 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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 PoolListResult. +func (p PoolListResult) 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 PoolListResult. +func (p *PoolListResult) UnmarshalJSON(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 PoolProperties. +func (p PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignments", p.Assignments) + populate(objectMap, "poolType", p.PoolType) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "reclaimPolicy", p.ReclaimPolicy) + populate(objectMap, "resources", p.Resources) + populate(objectMap, "status", p.Status) + populate(objectMap, "zones", p.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolProperties. +func (p *PoolProperties) UnmarshalJSON(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 "assignments": + err = unpopulate(val, "Assignments", &p.Assignments) + delete(rawMsg, key) + case "poolType": + err = unpopulate(val, "PoolType", &p.PoolType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "reclaimPolicy": + err = unpopulate(val, "ReclaimPolicy", &p.ReclaimPolicy) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &p.Resources) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &p.Zones) + 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 PoolType. +func (p PoolType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureDisk", p.AzureDisk) + populate(objectMap, "elasticSan", p.ElasticSan) + populate(objectMap, "ephemeralDisk", p.EphemeralDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolType. +func (p *PoolType) UnmarshalJSON(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 "azureDisk": + err = unpopulate(val, "AzureDisk", &p.AzureDisk) + delete(rawMsg, key) + case "elasticSan": + err = unpopulate(val, "ElasticSan", &p.ElasticSan) + delete(rawMsg, key) + case "ephemeralDisk": + err = unpopulate(val, "EphemeralDisk", &p.EphemeralDisk) + 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 PoolTypeUpdate. +func (p PoolTypeUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureDisk", p.AzureDisk) + populateAny(objectMap, "elasticSan", p.ElasticSan) + populate(objectMap, "ephemeralDisk", p.EphemeralDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolTypeUpdate. +func (p *PoolTypeUpdate) UnmarshalJSON(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 "azureDisk": + err = unpopulate(val, "AzureDisk", &p.AzureDisk) + delete(rawMsg, key) + case "elasticSan": + err = unpopulate(val, "ElasticSan", &p.ElasticSan) + delete(rawMsg, key) + case "ephemeralDisk": + err = unpopulate(val, "EphemeralDisk", &p.EphemeralDisk) + 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 PoolUpdate. +func (p PoolUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolUpdate. +func (p *PoolUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 PoolUpdateProperties. +func (p PoolUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignments", p.Assignments) + populate(objectMap, "poolType", p.PoolType) + populate(objectMap, "resources", p.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolUpdateProperties. +func (p *PoolUpdateProperties) UnmarshalJSON(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 "assignments": + err = unpopulate(val, "Assignments", &p.Assignments) + delete(rawMsg, key) + case "poolType": + err = unpopulate(val, "PoolType", &p.PoolType) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &p.Resources) + 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 Requests. +func (r Requests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "storage", r.Storage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Requests. +func (r *Requests) UnmarshalJSON(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 "storage": + err = unpopulate(val, "Storage", &r.Storage) + 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 ResourceOperationalStatus. +func (r ResourceOperationalStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", r.Message) + populate(objectMap, "state", r.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperationalStatus. +func (r *ResourceOperationalStatus) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + 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) + populate(objectMap, "requests", r.Requests) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resources. +func (r *Resources) UnmarshalJSON(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 "requests": + err = unpopulate(val, "Requests", &r.Requests) + 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 Snapshot. +func (s Snapshot) 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 Snapshot. +func (s *Snapshot) UnmarshalJSON(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 SnapshotListResult. +func (s SnapshotListResult) 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 SnapshotListResult. +func (s *SnapshotListResult) UnmarshalJSON(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 SnapshotProperties. +func (s SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "source", s.Source) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotProperties. +func (s *SnapshotProperties) UnmarshalJSON(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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + 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 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 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 Volume. +func (v Volume) 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, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Volume. +func (v *Volume) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + 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 VolumeListResult. +func (v VolumeListResult) 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 VolumeListResult. +func (v *VolumeListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + 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 VolumeProperties. +func (v VolumeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacityGiB", v.CapacityGiB) + populate(objectMap, "labels", v.Labels) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "status", v.Status) + populate(objectMap, "volumeType", v.VolumeType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeProperties. +func (v *VolumeProperties) UnmarshalJSON(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 "capacityGiB": + err = unpopulate(val, "CapacityGiB", &v.CapacityGiB) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &v.Labels) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + case "volumeType": + err = unpopulate(val, "VolumeType", &v.VolumeType) + 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 VolumeType. +func (v VolumeType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "elasticSan", v.ElasticSan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeType. +func (v *VolumeType) UnmarshalJSON(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 "elasticSan": + err = unpopulate(val, "ElasticSan", &v.ElasticSan) + 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 VolumeUpdate. +func (v VolumeUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeUpdate. +func (v *VolumeUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &v.Properties) + 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 VolumeUpdateProperties. +func (v VolumeUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacityGiB", v.CapacityGiB) + populate(objectMap, "labels", v.Labels) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeUpdateProperties. +func (v *VolumeUpdateProperties) UnmarshalJSON(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 "capacityGiB": + err = unpopulate(val, "CapacityGiB", &v.CapacityGiB) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &v.Labels) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, 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/containerstorage/armcontainerstorage/operations_client.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/operations_client.go new file mode 100644 index 000000000000..5fccdf456bfd --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +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 2023-07-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.ContainerStorage/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-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 *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/containerstorage/armcontainerstorage/options.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/options.go new file mode 100644 index 000000000000..41772ee412e8 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/options.go @@ -0,0 +1,99 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerstorage + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. +type PoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. +type PoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. +type PoolsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. +type PoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager +// method. +type PoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager method. +type PoolsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientBeginCreateOrUpdateOptions contains the optional parameters for the SnapshotsClient.BeginCreateOrUpdate +// method. +type SnapshotsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientBeginDeleteOptions contains the optional parameters for the SnapshotsClient.BeginDelete method. +type SnapshotsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +type SnapshotsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientListByPoolOptions contains the optional parameters for the SnapshotsClient.NewListByPoolPager method. +type SnapshotsClientListByPoolOptions struct { + // placeholder for future optional parameters +} + +// VolumesClientBeginCreateOrUpdateOptions contains the optional parameters for the VolumesClient.BeginCreateOrUpdate method. +type VolumesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumesClientBeginDeleteOptions contains the optional parameters for the VolumesClient.BeginDelete method. +type VolumesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumesClientBeginUpdateOptions contains the optional parameters for the VolumesClient.BeginUpdate method. +type VolumesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VolumesClientGetOptions contains the optional parameters for the VolumesClient.Get method. +type VolumesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VolumesClientListByPoolOptions contains the optional parameters for the VolumesClient.NewListByPoolPager method. +type VolumesClientListByPoolOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/pools_client.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/pools_client.go new file mode 100644 index 000000000000..5413461476ae --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/pools_client.go @@ -0,0 +1,460 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +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" +) + +// PoolsClient contains the methods for the Pools group. +// Don't use this type directly, use NewPoolsClient() instead. +type PoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPoolsClient creates a new instance of PoolsClient 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 NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PoolsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - resource - Resource create parameters. +// - options - PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate +// method. +func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PoolsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, poolName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PoolsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PoolsClient.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, poolName, 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 *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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-07-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 - Delete a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. +func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*runtime.Poller[PoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, poolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PoolsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PoolsClient.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, poolName, 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 *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. +func (client *PoolsClient) Get(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientGetOptions) (PoolsClientGetResponse, error) { + var err error + const operationName = "PoolsClient.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, poolName, options) + if err != nil { + return PoolsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PoolsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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-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 *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGetResponse, error) { + result := PoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Pool); err != nil { + return PoolsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Pool resources by resource group +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager +// method. +func (client *PoolsClient) NewListByResourceGroupPager(resourceGroupName string, options *PoolsClientListByResourceGroupOptions) *runtime.Pager[PoolsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PoolsClientListByResourceGroupResponse]{ + More: func(page PoolsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PoolsClientListByResourceGroupResponse) (PoolsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PoolsClient.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 PoolsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PoolsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools" + 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", "2023-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 *PoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (PoolsClientListByResourceGroupResponse, error) { + result := PoolsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PoolListResult); err != nil { + return PoolsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Pool resources by subscription ID +// +// Generated from API version 2023-07-01-preview +// - options - PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager +// method. +func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBySubscriptionOptions) *runtime.Pager[PoolsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PoolsClientListBySubscriptionResponse]{ + More: func(page PoolsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PoolsClientListBySubscriptionResponse) (PoolsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PoolsClient.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 PoolsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PoolsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerStorage/pools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PoolsClient) listBySubscriptionHandleResponse(resp *http.Response) (PoolsClientListBySubscriptionResponse, error) { + result := PoolsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PoolListResult); err != nil { + return PoolsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - properties - The resource properties to be updated. +// - options - PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. +func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*runtime.Poller[PoolsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, poolName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PoolsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PoolsClient.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, poolName, 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 *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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-07-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/containerstorage/armcontainerstorage/responses.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/responses.go new file mode 100644 index 000000000000..bd88414d5bac --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/responses.go @@ -0,0 +1,102 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +// 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 +} + +// PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. +type PoolsClientCreateOrUpdateResponse struct { + // Pool resource + Pool +} + +// PoolsClientDeleteResponse contains the response from method PoolsClient.BeginDelete. +type PoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// PoolsClientGetResponse contains the response from method PoolsClient.Get. +type PoolsClientGetResponse struct { + // Pool resource + Pool +} + +// PoolsClientListByResourceGroupResponse contains the response from method PoolsClient.NewListByResourceGroupPager. +type PoolsClientListByResourceGroupResponse struct { + // The response of a Pool list operation. + PoolListResult +} + +// PoolsClientListBySubscriptionResponse contains the response from method PoolsClient.NewListBySubscriptionPager. +type PoolsClientListBySubscriptionResponse struct { + // The response of a Pool list operation. + PoolListResult +} + +// PoolsClientUpdateResponse contains the response from method PoolsClient.BeginUpdate. +type PoolsClientUpdateResponse struct { + // Pool resource + Pool +} + +// SnapshotsClientCreateOrUpdateResponse contains the response from method SnapshotsClient.BeginCreateOrUpdate. +type SnapshotsClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Snapshot +} + +// SnapshotsClientDeleteResponse contains the response from method SnapshotsClient.BeginDelete. +type SnapshotsClientDeleteResponse struct { + // placeholder for future response values +} + +// SnapshotsClientGetResponse contains the response from method SnapshotsClient.Get. +type SnapshotsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Snapshot +} + +// SnapshotsClientListByPoolResponse contains the response from method SnapshotsClient.NewListByPoolPager. +type SnapshotsClientListByPoolResponse struct { + // The response of a Snapshot list operation. + SnapshotListResult +} + +// VolumesClientCreateOrUpdateResponse contains the response from method VolumesClient.BeginCreateOrUpdate. +type VolumesClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Volume +} + +// VolumesClientDeleteResponse contains the response from method VolumesClient.BeginDelete. +type VolumesClientDeleteResponse struct { + // placeholder for future response values +} + +// VolumesClientGetResponse contains the response from method VolumesClient.Get. +type VolumesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Volume +} + +// VolumesClientListByPoolResponse contains the response from method VolumesClient.NewListByPoolPager. +type VolumesClientListByPoolResponse struct { + // The response of a Volume list operation. + VolumeListResult +} + +// VolumesClientUpdateResponse contains the response from method VolumesClient.BeginUpdate. +type VolumesClientUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Volume +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/snapshots_client.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/snapshots_client.go new file mode 100644 index 000000000000..06ff0b32b00a --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/snapshots_client.go @@ -0,0 +1,345 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +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" +) + +// SnapshotsClient contains the methods for the Snapshots group. +// Don't use this type directly, use NewSnapshotsClient() instead. +type SnapshotsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient 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 NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SnapshotsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SnapshotsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Snapshot +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - snapshotName - Volume Snapshot Resource +// - resource - Resource create parameters. +// - options - SnapshotsClientBeginCreateOrUpdateOptions contains the optional parameters for the SnapshotsClient.BeginCreateOrUpdate +// method. +func (client *SnapshotsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, resource Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SnapshotsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, poolName, snapshotName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Snapshot +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *SnapshotsClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, resource Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.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, poolName, snapshotName, 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 *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, resource Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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-07-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 - Delete a Snapshot +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - snapshotName - Volume Snapshot Resource +// - options - SnapshotsClientBeginDeleteOptions contains the optional parameters for the SnapshotsClient.BeginDelete method. +func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*runtime.Poller[SnapshotsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, poolName, snapshotName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SnapshotsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SnapshotsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Snapshot +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SnapshotsClient.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, poolName, snapshotName, 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 *SnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Snapshot +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - snapshotName - Volume Snapshot Resource +// - options - SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *SnapshotsClientGetOptions) (SnapshotsClientGetResponse, error) { + var err error + const operationName = "SnapshotsClient.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, poolName, snapshotName, options) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SnapshotsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, snapshotName string, options *SnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots/{snapshotName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + 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-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 *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsClientGetResponse, error) { + result := SnapshotsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsClientGetResponse{}, err + } + return result, nil +} + +// NewListByPoolPager - List Snapshot resources by Pool +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - options - SnapshotsClientListByPoolOptions contains the optional parameters for the SnapshotsClient.NewListByPoolPager +// method. +func (client *SnapshotsClient) NewListByPoolPager(resourceGroupName string, poolName string, options *SnapshotsClientListByPoolOptions) *runtime.Pager[SnapshotsClientListByPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[SnapshotsClientListByPoolResponse]{ + More: func(page SnapshotsClientListByPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SnapshotsClientListByPoolResponse) (SnapshotsClientListByPoolResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListByPoolPager") + 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.listByPoolCreateRequest(ctx, resourceGroupName, poolName, options) + }, nil) + if err != nil { + return SnapshotsClientListByPoolResponse{}, err + } + return client.listByPoolHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByPoolCreateRequest creates the ListByPool request. +func (client *SnapshotsClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *SnapshotsClientListByPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/snapshots" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByPoolHandleResponse handles the ListByPool response. +func (client *SnapshotsClient) listByPoolHandleResponse(resp *http.Response) (SnapshotsClientListByPoolResponse, error) { + result := SnapshotsClientListByPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotListResult); err != nil { + return SnapshotsClientListByPoolResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerstorage/armcontainerstorage/time_rfc3339.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/time_rfc3339.go new file mode 100644 index 000000000000..716bff1f04e6 --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +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/containerstorage/armcontainerstorage/volumes_client.go b/sdk/resourcemanager/containerstorage/armcontainerstorage/volumes_client.go new file mode 100644 index 000000000000..0f3733824a3e --- /dev/null +++ b/sdk/resourcemanager/containerstorage/armcontainerstorage/volumes_client.go @@ -0,0 +1,429 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armcontainerstorage + +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" +) + +// VolumesClient contains the methods for the Volumes group. +// Don't use this type directly, use NewVolumesClient() instead. +type VolumesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVolumesClient creates a new instance of VolumesClient 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 NewVolumesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VolumesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VolumesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - volumeName - Volume Resource +// - resource - Resource create parameters. +// - options - VolumesClientBeginCreateOrUpdateOptions contains the optional parameters for the VolumesClient.BeginCreateOrUpdate +// method. +func (client *VolumesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, poolName string, volumeName string, resource Volume, options *VolumesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VolumesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, poolName, volumeName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *VolumesClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, volumeName string, resource Volume, options *VolumesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VolumesClient.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, poolName, volumeName, 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 *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, volumeName string, resource Volume, options *VolumesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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-07-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 - Delete a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - volumeName - Volume Resource +// - options - VolumesClientBeginDeleteOptions contains the optional parameters for the VolumesClient.BeginDelete method. +func (client *VolumesClient) BeginDelete(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *VolumesClientBeginDeleteOptions) (*runtime.Poller[VolumesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, poolName, volumeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *VolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *VolumesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VolumesClient.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, poolName, volumeName, 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 *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *VolumesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - volumeName - Volume Resource +// - options - VolumesClientGetOptions contains the optional parameters for the VolumesClient.Get method. +func (client *VolumesClient) Get(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *VolumesClientGetOptions) (VolumesClientGetResponse, error) { + var err error + const operationName = "VolumesClient.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, poolName, volumeName, options) + if err != nil { + return VolumesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VolumesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VolumesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VolumesClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, volumeName string, options *VolumesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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-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 *VolumesClient) getHandleResponse(resp *http.Response) (VolumesClientGetResponse, error) { + result := VolumesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Volume); err != nil { + return VolumesClientGetResponse{}, err + } + return result, nil +} + +// NewListByPoolPager - List Volume resources by Pool +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - options - VolumesClientListByPoolOptions contains the optional parameters for the VolumesClient.NewListByPoolPager method. +func (client *VolumesClient) NewListByPoolPager(resourceGroupName string, poolName string, options *VolumesClientListByPoolOptions) *runtime.Pager[VolumesClientListByPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[VolumesClientListByPoolResponse]{ + More: func(page VolumesClientListByPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VolumesClientListByPoolResponse) (VolumesClientListByPoolResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VolumesClient.NewListByPoolPager") + 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.listByPoolCreateRequest(ctx, resourceGroupName, poolName, options) + }, nil) + if err != nil { + return VolumesClientListByPoolResponse{}, err + } + return client.listByPoolHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByPoolCreateRequest creates the ListByPool request. +func (client *VolumesClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *VolumesClientListByPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByPoolHandleResponse handles the ListByPool response. +func (client *VolumesClient) listByPoolHandleResponse(resp *http.Response) (VolumesClientListByPoolResponse, error) { + result := VolumesClientListByPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VolumeListResult); err != nil { + return VolumesClientListByPoolResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - poolName - Pool Object +// - volumeName - Volume Resource +// - properties - The resource properties to be updated. +// - options - VolumesClientBeginUpdateOptions contains the optional parameters for the VolumesClient.BeginUpdate method. +func (client *VolumesClient) BeginUpdate(ctx context.Context, resourceGroupName string, poolName string, volumeName string, properties VolumeUpdate, options *VolumesClientBeginUpdateOptions) (*runtime.Poller[VolumesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, poolName, volumeName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *VolumesClient) update(ctx context.Context, resourceGroupName string, poolName string, volumeName string, properties VolumeUpdate, options *VolumesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VolumesClient.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, poolName, volumeName, 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 *VolumesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, volumeName string, properties VolumeUpdate, options *VolumesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerStorage/pools/{poolName}/volumes/{volumeName}" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + 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-07-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/contoso/armcontoso/CHANGELOG.md b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md new file mode 100644 index 000000000000..f13cb383ff88 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso` 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/contoso/armcontoso/LICENSE.txt b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/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/contoso/armcontoso/README.md b/sdk/resourcemanager/contoso/armcontoso/README.md new file mode 100644 index 000000000000..aef1020792c7 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/README.md @@ -0,0 +1,92 @@ +# Azure Contoso Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso) + +The `armcontoso` module provides operations for working with Azure Contoso. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/contoso/armcontoso) + +# 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 Contoso module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Contoso. 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 Contoso 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 := armcontoso.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 := armcontoso.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.NewEmployeesClient() +``` + +## 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 `Contoso` 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/contoso/armcontoso/ci.yml b/sdk/resourcemanager/contoso/armcontoso/ci.yml new file mode 100644 index 000000000000..a068465b72a2 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/ci.yml @@ -0,0 +1,28 @@ +# 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/contoso/armcontoso/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/contoso/armcontoso' diff --git a/sdk/resourcemanager/contoso/armcontoso/client_factory.go b/sdk/resourcemanager/contoso/armcontoso/client_factory.go new file mode 100644 index 000000000000..0a0944ec82c6 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/client_factory.go @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +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 +} + +// NewEmployeesClient creates a new instance of EmployeesClient. +func (c *ClientFactory) NewEmployeesClient() *EmployeesClient { + return &EmployeesClient{ + 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/contoso/armcontoso/constants.go b/sdk/resourcemanager/contoso/armcontoso/constants.go new file mode 100644 index 000000000000..35ca72f6b867 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/constants.go @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + 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 - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The resource provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + 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/contoso/armcontoso/employees_client.go b/sdk/resourcemanager/contoso/armcontoso/employees_client.go new file mode 100644 index 000000000000..df4a365b75fd --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client.go @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +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" +) + +// EmployeesClient contains the methods for the Employees group. +// Don't use this type directly, use NewEmployeesClient() instead. +type EmployeesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEmployeesClient creates a new instance of EmployeesClient 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 NewEmployeesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EmployeesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EmployeesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - resource - Resource create parameters. +// - options - EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +func (client *EmployeesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EmployeesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, employeeName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +func (client *EmployeesClient) createOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, 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 *EmployeesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, _ *EmployeesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +func (client *EmployeesClient) BeginDelete(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*runtime.Poller[EmployeesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, employeeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +func (client *EmployeesClient) deleteOperation(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, 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 *EmployeesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +func (client *EmployeesClient) Get(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientGetOptions) (EmployeesClientGetResponse, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, options) + if err != nil { + return EmployeesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EmployeesClient) getCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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-10-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 *EmployeesClient) getHandleResponse(resp *http.Response) (EmployeesClientGetResponse, error) { + result := EmployeesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Employee resources by resource group +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +func (client *EmployeesClient) NewListByResourceGroupPager(resourceGroupName string, options *EmployeesClientListByResourceGroupOptions) *runtime.Pager[EmployeesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListByResourceGroupResponse]{ + More: func(page EmployeesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListByResourceGroupResponse) (EmployeesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.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 EmployeesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EmployeesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EmployeesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees" + 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-10-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 *EmployeesClient) listByResourceGroupHandleResponse(resp *http.Response) (EmployeesClientListByResourceGroupResponse, error) { + result := EmployeesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Employee resources by subscription ID +// +// Generated from API version 2021-10-01-preview +// - options - EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +func (client *EmployeesClient) NewListBySubscriptionPager(options *EmployeesClientListBySubscriptionOptions) *runtime.Pager[EmployeesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListBySubscriptionResponse]{ + More: func(page EmployeesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListBySubscriptionResponse) (EmployeesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.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 EmployeesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EmployeesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EmployeesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees" + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *EmployeesClient) listBySubscriptionHandleResponse(resp *http.Response) (EmployeesClientListBySubscriptionResponse, error) { + result := EmployeesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - properties - The resource properties to be updated. +// - options - EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +func (client *EmployeesClient) Update(ctx context.Context, resourceGroupName string, employeeName string, properties EmployeeUpdate, options *EmployeesClientUpdateOptions) (EmployeesClientUpdateResponse, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, properties, options) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EmployeesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, properties EmployeeUpdate, _ *EmployeesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EmployeesClient) updateHandleResponse(resp *http.Response) (EmployeesClientUpdateResponse, error) { + result := EmployeesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go new file mode 100644 index 000000000000..d51ca0c55dc7 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso_test + +import ( + "context" + "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/contoso/armcontoso" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/Employees_CreateOrUpdate.json +func ExampleEmployeesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginCreateOrUpdate(ctx, "rgopenapi", "9KF-f-8b", armcontoso.Employee{ + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](30), + City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + Profile: []byte("ms"), + }, + Tags: map[string]*string{ + "key2913": to.Ptr("urperxmkkhhkp"), + }, + Location: to.Ptr("itajgxyqozseoygnl"), + }, 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 = armcontoso.EmployeesClientCreateOrUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/Employees_Delete.json +func ExampleEmployeesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginDelete(ctx, "rgopenapi", "5vX--BxSu3ux48rI4O9OQ569", 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: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/Employees_Get.json +func ExampleEmployeesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Get(ctx, "rgopenapi", "le-8MU--J3W6q8D386p3-iT3", 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 = armcontoso.EmployeesClientGetResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/Employees_ListByResourceGroup.json +func ExampleEmployeesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().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 = armcontoso.EmployeesClientListByResourceGroupResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/Employees_ListBySubscription.json +func ExampleEmployeesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().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 = armcontoso.EmployeesClientListBySubscriptionResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/Employees_Update.json +func ExampleEmployeesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Update(ctx, "rgopenapi", "-XhyNJ--", armcontoso.EmployeeUpdate{ + Tags: map[string]*string{ + "key7952": to.Ptr("no"), + }, + Properties: &armcontoso.EmployeeUpdateProperties{ + Age: to.Ptr[int32](24), + City: to.Ptr("uyfg"), + Profile: []byte("oapgijcswfkruiuuzbwco"), + }, + }, 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 = armcontoso.EmployeesClientUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/contoso/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go new file mode 100644 index 000000000000..332c373af4ab --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "net/http" + "net/url" + "regexp" +) + +// EmployeesServer is a fake server for instances of the armcontoso.EmployeesClient type. +type EmployeesServer struct { + // BeginCreateOrUpdate is the fake for method EmployeesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, employeeName string, resource armcontoso.Employee, options *armcontoso.EmployeesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EmployeesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EmployeesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientGetOptions) (resp azfake.Responder[armcontoso.EmployeesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EmployeesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontoso.EmployeesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EmployeesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcontoso.EmployeesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]) + + // Update is the fake for method EmployeesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, employeeName string, properties armcontoso.EmployeeUpdate, options *armcontoso.EmployeesClientUpdateOptions) (resp azfake.Responder[armcontoso.EmployeesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEmployeesServerTransport creates a new instance of EmployeesServerTransport with the provided implementation. +// The returned EmployeesServerTransport instance is connected to an instance of armcontoso.EmployeesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEmployeesServerTransport(srv *EmployeesServer) *EmployeesServerTransport { + return &EmployeesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]](), + } +} + +// EmployeesServerTransport connects instances of armcontoso.EmployeesClient to instances of EmployeesServer. +// Don't use this type directly, use NewEmployeesServerTransport instead. +type EmployeesServerTransport struct { + srv *EmployeesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EmployeesServerTransport. +func (e *EmployeesServerTransport) 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 e.dispatchToMethodFake(req, method) +} + +func (e *EmployeesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + var resp *http.Response + var err error + + switch method { + case "EmployeesClient.BeginCreateOrUpdate": + resp, err = e.dispatchBeginCreateOrUpdate(req) + case "EmployeesClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "EmployeesClient.Get": + resp, err = e.dispatchGet(req) + case "EmployeesClient.NewListByResourceGroupPager": + resp, err = e.dispatchNewListByResourceGroupPager(req) + case "EmployeesClient.NewListBySubscriptionPager": + resp, err = e.dispatchNewListBySubscriptionPager(req) + case "EmployeesClient.Update": + resp, err = e.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + return resp, err +} + +func (e *EmployeesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?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[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, employeeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.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) { + e.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) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, employeeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.Contoso/employees/(?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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, employeeNameParam, 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).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + 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 := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontoso.EmployeesClientListByResourceGroupResponse, 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) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + 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 := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcontoso.EmployeesClientListBySubscriptionResponse, 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) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.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\.Contoso/employees/(?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[armcontoso.EmployeeUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, employeeNameParam, 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).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/internal.go b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go new file mode 100644 index 000000000000..56a8f624f5f3 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +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/contoso/armcontoso/fake/operations_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go new file mode 100644 index 000000000000..5cd31d949c8d --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "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/contoso/armcontoso" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcontoso.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontoso.OperationsClientListOptions) (resp azfake.PagerResponder[armcontoso.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcontoso.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[armcontoso.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcontoso.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcontoso.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) { + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + return resp, 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 *armcontoso.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 +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go new file mode 100644 index 000000000000..9ddfd8463c5a --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "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 armcontoso.ClientFactory type. +type ServerFactory struct { + // EmployeesServer contains the fakes for client EmployeesClient + EmployeesServer EmployeesServer + + // 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 armcontoso.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 armcontoso.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trEmployeesServer *EmployeesServerTransport + 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 "EmployeesClient": + initServer(s, &s.trEmployeesServer, func() *EmployeesServerTransport { return NewEmployeesServerTransport(&s.srv.EmployeesServer) }) + resp, err = s.trEmployeesServer.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/contoso/armcontoso/fake/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "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 { + 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)) +} + +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/contoso/armcontoso/go.mod b/sdk/resourcemanager/contoso/armcontoso/go.mod new file mode 100644 index 000000000000..043fb45f0611 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect +) diff --git a/sdk/resourcemanager/contoso/armcontoso/go.sum b/sdk/resourcemanager/contoso/armcontoso/go.sum new file mode 100644 index 000000000000..09d275cb9a37 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/contoso/armcontoso/models.go b/sdk/resourcemanager/contoso/armcontoso/models.go new file mode 100644 index 000000000000..1378e3ca5b78 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models.go @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import "time" + +// Employee resource +type Employee struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *EmployeeProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The name of the Employee + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *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 +} + +// EmployeeListResult - The response of a Employee list operation. +type EmployeeListResult struct { + // REQUIRED; The Employee items on this page + Value []*Employee + + // The link to the next page of items + NextLink *string +} + +// EmployeeProperties - Employee properties +type EmployeeProperties struct { + // Age of employee + Age *int32 + + // City of employee + City *string + + // Profile of employee + Profile []byte + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// EmployeeUpdate - The type used for update operations of the Employee. +type EmployeeUpdate struct { + // The resource-specific properties for this resource. + Properties *EmployeeUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// EmployeeUpdateProperties - The updatable properties of the Employee. +type EmployeeUpdateProperties struct { + // Age of employee + Age *int32 + + // City of employee + City *string + + // Profile of employee + Profile []byte +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "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 and 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *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 +} diff --git a/sdk/resourcemanager/contoso/armcontoso/models_serde.go b/sdk/resourcemanager/contoso/armcontoso/models_serde.go new file mode 100644 index 000000000000..a5948b12a9ef --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models_serde.go @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Employee. +func (e Employee) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Employee. +func (e *Employee) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + 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 EmployeeListResult. +func (e EmployeeListResult) 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 EmployeeListResult. +func (e *EmployeeListResult) UnmarshalJSON(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 EmployeeProperties. +func (e EmployeeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "age", e.Age) + populate(objectMap, "city", e.City) + populateByteArray(objectMap, "profile", e.Profile, func() any { + return runtime.EncodeByteArray(e.Profile, runtime.Base64URLFormat) + }) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeProperties. +func (e *EmployeeProperties) UnmarshalJSON(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 "age": + err = unpopulate(val, "Age", &e.Age) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "profile": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &e.Profile, runtime.Base64URLFormat) + } + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeUpdate. +func (e EmployeeUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeUpdate. +func (e *EmployeeUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + 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 EmployeeUpdateProperties. +func (e EmployeeUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "age", e.Age) + populate(objectMap, "city", e.City) + populateByteArray(objectMap, "profile", e.Profile, func() any { + return runtime.EncodeByteArray(e.Profile, runtime.Base64URLFormat) + }) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeUpdateProperties. +func (e *EmployeeUpdateProperties) UnmarshalJSON(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 "age": + err = unpopulate(val, "Age", &e.Age) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "profile": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &e.Profile, runtime.Base64URLFormat) + } + 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 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 populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = convert() + } +} + +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/contoso/armcontoso/operations_client.go b/sdk/resourcemanager/contoso/armcontoso/operations_client.go new file mode 100644 index 000000000000..2a060162ef11 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client.go @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +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 2021-10-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.Contoso/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-10-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/contoso/armcontoso/operations_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go new file mode 100644 index 000000000000..cd5db6a2e104 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso/TempTypeSpecFiles/Contoso.Management/examples/2021-10-01-preview/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 := armcontoso.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 = armcontoso.OperationsClientListResponse{ + // OperationListResult: armcontoso.OperationListResult{ + // Value: []*armcontoso.Operation{ + // { + // Name: to.Ptr("ymeow"), + // IsDataAction: to.Ptr(true), + // Display: &armcontoso.OperationDisplay{ + // Provider: to.Ptr("qxyznq"), + // Resource: to.Ptr("bqfwkox"), + // Operation: to.Ptr("td"), + // Description: to.Ptr("yvgkhsuwartgxb"), + // }, + // Origin: to.Ptr(armcontoso.OriginUser), + // ActionType: to.Ptr(armcontoso.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://sample.com/nextLink"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/options.go b/sdk/resourcemanager/contoso/armcontoso/options.go new file mode 100644 index 000000000000..11fee1c76771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/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) Go Code Generator. DO NOT EDIT. + +package armcontoso + +// EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +type EmployeesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +type EmployeesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +type EmployeesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +type EmployeesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +type EmployeesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +type EmployeesClientUpdateOptions 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/contoso/armcontoso/responses.go b/sdk/resourcemanager/contoso/armcontoso/responses.go new file mode 100644 index 000000000000..9b28221cf0cb --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/responses.go @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +// EmployeesClientCreateOrUpdateResponse contains the response from method EmployeesClient.BeginCreateOrUpdate. +type EmployeesClientCreateOrUpdateResponse struct { + // Employee resource + Employee +} + +// EmployeesClientDeleteResponse contains the response from method EmployeesClient.BeginDelete. +type EmployeesClientDeleteResponse struct { + // placeholder for future response values +} + +// EmployeesClientGetResponse contains the response from method EmployeesClient.Get. +type EmployeesClientGetResponse struct { + // Employee resource + Employee +} + +// EmployeesClientListByResourceGroupResponse contains the response from method EmployeesClient.NewListByResourceGroupPager. +type EmployeesClientListByResourceGroupResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientListBySubscriptionResponse contains the response from method EmployeesClient.NewListBySubscriptionPager. +type EmployeesClientListBySubscriptionResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientUpdateResponse contains the response from method EmployeesClient.Update. +type EmployeesClientUpdateResponse struct { + // Employee resource + Employee +} + +// 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/contoso/armcontoso/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go new file mode 100644 index 000000000000..fd129d84c771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +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 { + 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)) +} + +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/contoso/armcontoso/tsp-location.yaml b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml new file mode 100644 index 000000000000..6d05646dad81 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/contosowidgetmanager/Contoso.Management +commit: 52d5e415c9026af1a6b3b4932f4338df7f40b0b8 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md index f66976289d9e..799c95192ea8 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-08-09) +### Other Changes + + ## 0.1.0 (2024-04-26) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go deleted file mode 100644 index 7db98ffb753b..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go +++ /dev/null @@ -1,486 +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 armdeviceregistry_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/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json -func ExampleAssetEndpointProfilesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetEndpointProfilesClient().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.AssetEndpointProfileListResult = armdeviceregistry.AssetEndpointProfileListResult{ - // Value: []*armdeviceregistry.AssetEndpointProfile{ - // { - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress1"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeCertificate), - // X509Credentials: &armdeviceregistry.X509Credentials{ - // CertificateReference: to.Ptr("certificatRef"), - // }, - // }, - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile2"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile2"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress2"), - // TransportAuthentication: &armdeviceregistry.TransportAuthentication{ - // OwnCertificates: []*armdeviceregistry.OwnCertificate{ - // { - // CertPasswordReference: to.Ptr("passwordRef"), - // CertSecretReference: to.Ptr("secretRef"), - // CertThumbprint: to.Ptr("myThumbprint"), - // }}, - // }, - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeUsernamePassword), - // UsernamePasswordCredentials: &armdeviceregistry.UsernamePasswordCredentials{ - // PasswordReference: to.Ptr("passwordRef"), - // UsernameReference: to.Ptr("usernameRef"), - // }, - // }, - // UUID: to.Ptr("1824a74f-21e1-4458-ae07-604d3a241d2e"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json -func ExampleAssetEndpointProfilesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetEndpointProfilesClient().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.AssetEndpointProfileListResult = armdeviceregistry.AssetEndpointProfileListResult{ - // Value: []*armdeviceregistry.AssetEndpointProfile{ - // { - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress1"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeCertificate), - // X509Credentials: &armdeviceregistry.X509Credentials{ - // CertificateReference: to.Ptr("certificatRef"), - // }, - // }, - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile2"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile2"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress2"), - // TransportAuthentication: &armdeviceregistry.TransportAuthentication{ - // OwnCertificates: []*armdeviceregistry.OwnCertificate{ - // { - // CertPasswordReference: to.Ptr("passwordRef"), - // CertSecretReference: to.Ptr("secretRef"), - // CertThumbprint: to.Ptr("myThumbprint"), - // }}, - // }, - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeUsernamePassword), - // UsernamePasswordCredentials: &armdeviceregistry.UsernamePasswordCredentials{ - // PasswordReference: to.Ptr("passwordRef"), - // UsernameReference: to.Ptr("usernameRef"), - // }, - // }, - // UUID: to.Ptr("1824a74f-21e1-4458-ae07-604d3a241d2e"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssetEndpointProfilesClient().Get(ctx, "myResourceGroup", "my-assetendpointprofile", 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.AssetEndpointProfile = armdeviceregistry.AssetEndpointProfile{ - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // TransportAuthentication: &armdeviceregistry.TransportAuthentication{ - // OwnCertificates: []*armdeviceregistry.OwnCertificate{ - // { - // CertPasswordReference: to.Ptr("passwordRef"), - // CertSecretReference: to.Ptr("secretRef"), - // CertThumbprint: to.Ptr("myThumbprint"), - // }}, - // }, - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeUsernamePassword), - // UsernamePasswordCredentials: &armdeviceregistry.UsernamePasswordCredentials{ - // PasswordReference: to.Ptr("passwordRef"), - // UsernameReference: to.Ptr("usernameRef"), - // }, - // }, - // UUID: to.Ptr("1824a74f-21e1-4458-ae07-604d3a241d2e"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_BeginCreateOrReplace() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetEndpointProfilesClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-assetendpointprofile", armdeviceregistry.AssetEndpointProfile{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - UserAuthentication: &armdeviceregistry.UserAuthentication{ - Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - }, - }, - }, 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.AssetEndpointProfile = armdeviceregistry.AssetEndpointProfile{ - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetEndpointProfilesClient().BeginUpdate(ctx, "myResourceGroup", "my-assetendpointprofile", armdeviceregistry.AssetEndpointProfileUpdate{ - Properties: &armdeviceregistry.AssetEndpointProfileUpdateProperties{ - TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - }, - }, 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.AssetEndpointProfile = armdeviceregistry.AssetEndpointProfile{ - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetEndpointProfilesClient().BeginDelete(ctx, "myResourceGroup", "my-assetendpointprofile", 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/deviceregistry/armdeviceregistry/assets_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client_example_test.go deleted file mode 100644 index ee34e7c59908..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client_example_test.go +++ /dev/null @@ -1,1082 +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 armdeviceregistry_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/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json -func ExampleAssetsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetsClient().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.AssetListResult = armdeviceregistry.AssetListResult{ - // Value: []*armdeviceregistry.Asset{ - // { - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // }, - // { - // Name: to.Ptr("my-asset1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset 1"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile1"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt10"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt20"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName 1"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt30"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt40"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("9AVD7KLPU03377981"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("12-984302-792341-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // Version: to.Ptr[int32](73766), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json -func ExampleAssetsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetsClient().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.AssetListResult = armdeviceregistry.AssetListResult{ - // Value: []*armdeviceregistry.Asset{ - // { - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // }, - // { - // Name: to.Ptr("my-asset1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset 1"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile1"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt10"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt20"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName 1"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt30"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt40"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("9AVD7KLPU03377981"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("12-984302-792341-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // Version: to.Ptr[int32](73766), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json -func ExampleAssetsClient_Get_getAnAsset() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssetsClient().Get(ctx, "myResourceGroup", "my-asset", 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.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json -func ExampleAssetsClient_Get_getAnAssetWithSyncStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssetsClient().Get(ctx, "myResourceGroup", "my-asset", 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.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // Status: &armdeviceregistry.AssetStatus{ - // Errors: []*armdeviceregistry.AssetStatusError{ - // { - // Code: to.Ptr[int32](500), - // Message: to.Ptr("Internal Server Error"), - // }}, - // Version: to.Ptr[int32](1), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json -func ExampleAssetsClient_BeginCreateOrReplace_createAnAssetWithExternalAssetId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-asset", armdeviceregistry.Asset{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetProperties{ - Description: to.Ptr("This is a sample Asset"), - AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - AssetType: to.Ptr("MyAssetType"), - DataPoints: []*armdeviceregistry.DataPoint{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - }}, - DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DisplayName: to.Ptr("AssetDisplayName"), - DocumentationURI: to.Ptr("https://www.example.com/manual"), - Enabled: to.Ptr(true), - Events: []*armdeviceregistry.Event{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - }}, - ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - HardwareRevision: to.Ptr("1.0"), - Manufacturer: to.Ptr("Contoso"), - ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - Model: to.Ptr("ContosoModel"), - ProductCode: to.Ptr("SA34VDG"), - SerialNumber: to.Ptr("64-103816-519918-8"), - SoftwareRevision: to.Ptr("2.0"), - }, - }, 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.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json -func ExampleAssetsClient_BeginCreateOrReplace_createAnAssetWithoutDisplayName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-asset", armdeviceregistry.Asset{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetProperties{ - Description: to.Ptr("This is a sample Asset"), - AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - AssetType: to.Ptr("MyAssetType"), - DataPoints: []*armdeviceregistry.DataPoint{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - }}, - DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DocumentationURI: to.Ptr("https://www.example.com/manual"), - Enabled: to.Ptr(true), - Events: []*armdeviceregistry.Event{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - }}, - ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - HardwareRevision: to.Ptr("1.0"), - Manufacturer: to.Ptr("Contoso"), - ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - Model: to.Ptr("ContosoModel"), - ProductCode: to.Ptr("SA34VDG"), - SerialNumber: to.Ptr("64-103816-519918-8"), - SoftwareRevision: to.Ptr("2.0"), - }, - }, 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.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("myAsset"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json -func ExampleAssetsClient_BeginCreateOrReplace_createAnAssetWithoutExternalAssetId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-asset", armdeviceregistry.Asset{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetProperties{ - Description: to.Ptr("This is a sample Asset"), - AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - AssetType: to.Ptr("MyAssetType"), - DataPoints: []*armdeviceregistry.DataPoint{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - }}, - DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DisplayName: to.Ptr("AssetDisplayName"), - DocumentationURI: to.Ptr("https://www.example.com/manual"), - Enabled: to.Ptr(true), - Events: []*armdeviceregistry.Event{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - }}, - HardwareRevision: to.Ptr("1.0"), - Manufacturer: to.Ptr("Contoso"), - ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - Model: to.Ptr("ContosoModel"), - ProductCode: to.Ptr("SA34VDG"), - SerialNumber: to.Ptr("64-103816-519918-8"), - SoftwareRevision: to.Ptr("2.0"), - }, - }, 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.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json -func ExampleAssetsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginUpdate(ctx, "myResourceGroup", "my-asset", armdeviceregistry.AssetUpdate{ - Properties: &armdeviceregistry.AssetUpdateProperties{ - DisplayName: to.Ptr("NewAssetDisplayName"), - Enabled: to.Ptr(false), - }, - }, 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.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("NewAssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json -func ExampleAssetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginDelete(ctx, "myResourceGroup", "my-asset", 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/deviceregistry/armdeviceregistry/autorest.md b/sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md index fdcc3a7d6863..baadfefb5e8d 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/deviceregistry/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/deviceregistry/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2023-11 +module-version: 0.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go index f5a5edb7d532..655841e52d9c 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go @@ -10,7 +10,7 @@ package armdeviceregistry const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod index 8e44d0d358eb..2f3f270f0bca 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armd go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go index dec2bc3186c7..594df2afaa68 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go @@ -98,7 +98,7 @@ type AssetEndpointProfileProperties struct { // AssetEndpointProfileUpdate - The type used for update operations of the AssetEndpointProfile. type AssetEndpointProfileUpdate struct { - // The updatable properties of the AssetEndpointProfile. + // The resource-specific properties for this resource. Properties *AssetEndpointProfileUpdateProperties // Resource tags. @@ -233,7 +233,7 @@ type AssetStatusError struct { // AssetUpdate - The type used for update operations of the Asset. type AssetUpdate struct { - // The updatable properties of the Asset. + // The resource-specific properties for this resource. Properties *AssetUpdateProperties // Resource tags. diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client_example_test.go deleted file mode 100644 index e044d2e1c17b..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_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 armdeviceregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.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 := armdeviceregistry.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 = armdeviceregistry.OperationListResult{ - // Value: []*armdeviceregistry.Operation{ - // { - // Name: to.Ptr("Microsoft.DeviceRegistry/assets/write"), - // Display: &armdeviceregistry.OperationDisplay{ - // Operation: to.Ptr("write"), - // Provider: to.Ptr("Microsoft Azure Device Registry"), - // Resource: to.Ptr("Asset"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go deleted file mode 100644 index baccd5220666..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go +++ /dev/null @@ -1,46 +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 armdeviceregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json -func ExampleOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusClient().Get(ctx, "testLocation", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 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.OperationStatusResult = armdeviceregistry.OperationStatusResult{ - // Name: to.Ptr("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-21T13:28:03.898Z"); return t}()), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DeviceRegistry/locations/testLocation/operationStatuses/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), - // PercentComplete: to.Ptr[float32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-21T13:27:03.898Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index 96e36af4f892..52552efda310 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 0.2.0 (2024-08-09) +### Breaking Changes + +- Type of `Quota.Name` has been changed from `*string` to `*QuotaName` +- Function `*SubscriptionUsagesClient.NewListByLocationPager` has been removed +- Struct `QuotaListResult` has been removed +- Struct `QuotaProperties` has been removed +- Field `Properties`, `SystemData`, `Type` of struct `Quota` has been removed + +### Features Added + +- New function `*SubscriptionUsagesClient.NewUsagesPager(string, *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse]` +- New struct `PagedQuota` +- New field `CurrentValue`, `Limit`, `Unit` in struct `Quota` + + ## 0.1.0 (2024-05-24) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md index 2ea4855f1b0b..8d594db1213e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devopsinfrastructure/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devopsinfrastructure/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2024-04 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go index cbed5af7fe2f..f72c86d86781 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -10,7 +10,7 @@ package armdevopsinfrastructure const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -245,11 +245,14 @@ func PossibleResourcePredictionsProfileTypeValues() []ResourcePredictionsProfile } } +// ResourceSKURestrictionsReasonCode - Describes the reason for SKU restriction. type ResourceSKURestrictionsReasonCode string const ( + // ResourceSKURestrictionsReasonCodeNotAvailableForSubscription - The restriction is not available for this subscription. ResourceSKURestrictionsReasonCodeNotAvailableForSubscription ResourceSKURestrictionsReasonCode = "NotAvailableForSubscription" - ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" + // ResourceSKURestrictionsReasonCodeQuotaID - The restriction is due to exceeding a quota limitation. + ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" ) // PossibleResourceSKURestrictionsReasonCodeValues returns the possible values for the ResourceSKURestrictionsReasonCode const type. @@ -260,11 +263,14 @@ func PossibleResourceSKURestrictionsReasonCodeValues() []ResourceSKURestrictions } } +// ResourceSKURestrictionsType - Describes the kind of SKU restrictions that can exist type ResourceSKURestrictionsType string const ( + // ResourceSKURestrictionsTypeLocation - SKU restricted by location. ResourceSKURestrictionsTypeLocation ResourceSKURestrictionsType = "Location" - ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" + // ResourceSKURestrictionsTypeZone - SKU restricted by availability zone. + ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" ) // PossibleResourceSKURestrictionsTypeValues returns the possible values for the ResourceSKURestrictionsType const type. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go index 814de64be755..9b4253943743 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -23,9 +23,9 @@ import ( // SubscriptionUsagesServer is a fake server for instances of the armdevopsinfrastructure.SubscriptionUsagesClient type. type SubscriptionUsagesServer struct { - // NewListByLocationPager is the fake for method SubscriptionUsagesClient.NewListByLocationPager + // NewUsagesPager is the fake for method SubscriptionUsagesClient.NewUsagesPager // HTTP status codes to indicate success: http.StatusOK - NewListByLocationPager func(locationName string, options *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]) + NewUsagesPager func(location string, options *armdevopsinfrastructure.SubscriptionUsagesClientUsagesOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]) } // NewSubscriptionUsagesServerTransport creates a new instance of SubscriptionUsagesServerTransport with the provided implementation. @@ -33,16 +33,16 @@ type SubscriptionUsagesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSubscriptionUsagesServerTransport(srv *SubscriptionUsagesServer) *SubscriptionUsagesServerTransport { return &SubscriptionUsagesServerTransport{ - srv: srv, - newListByLocationPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]](), + srv: srv, + newUsagesPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]](), } } // SubscriptionUsagesServerTransport connects instances of armdevopsinfrastructure.SubscriptionUsagesClient to instances of SubscriptionUsagesServer. // Don't use this type directly, use NewSubscriptionUsagesServerTransport instead. type SubscriptionUsagesServerTransport struct { - srv *SubscriptionUsagesServer - newListByLocationPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]] + srv *SubscriptionUsagesServer + newUsagesPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]] } // Do implements the policy.Transporter interface for SubscriptionUsagesServerTransport. @@ -57,8 +57,8 @@ func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Respons var err error switch method { - case "SubscriptionUsagesClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) + case "SubscriptionUsagesClient.NewUsagesPager": + resp, err = s.dispatchNewUsagesPager(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -70,39 +70,39 @@ func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Respons return resp, nil } -func (s *SubscriptionUsagesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByLocationPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} +func (s *SubscriptionUsagesServerTransport) dispatchNewUsagesPager(req *http.Request) (*http.Response, error) { + if s.srv.NewUsagesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewUsagesPager not implemented")} } - newListByLocationPager := s.newListByLocationPager.get(req) - if newListByLocationPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` + newUsagesPager := s.newUsagesPager.get(req) + if newUsagesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` 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) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - resp := s.srv.NewListByLocationPager(locationNameParam, nil) - newListByLocationPager = &resp - s.newListByLocationPager.add(req, newListByLocationPager) - server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse, createLink func() string) { + resp := s.srv.NewUsagesPager(locationParam, nil) + newUsagesPager = &resp + s.newUsagesPager.add(req, newUsagesPager) + server.PagerResponderInjectNextLinks(newUsagesPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByLocationPager, req) + resp, err := server.PagerResponderNext(newUsagesPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByLocationPager.remove(req) + s.newUsagesPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByLocationPager) { - s.newListByLocationPager.remove(req) + if !server.PagerResponderMore(newUsagesPager) { + s.newUsagesPager.remove(req) } return resp, nil } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod index 12db711df587..ff7f3e32c722 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructur go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go deleted file mode 100644 index 9949dcb23719..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_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 armdevopsinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ImageVersions_ListByImage.json -func ExampleImageVersionsClient_NewListByImagePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImageVersionsClient().NewListByImagePager("my-resource-group", "windows-2022", 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.ImageVersionListResult = armdevopsinfrastructure.ImageVersionListResult{ - // Value: []*armdevopsinfrastructure.ImageVersion{ - // { - // Name: to.Ptr("2024.0417.0"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.0"), - // }, - // { - // Name: to.Ptr("2024.0417.1"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.1"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go index 90f682a878c5..98dd53754f09 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -324,6 +324,15 @@ type OsProfile struct { SecretsManagementSettings *SecretsManagementSettings } +// PagedQuota - Paged collection of Quota items +type PagedQuota struct { + // REQUIRED; The Quota items on this page + Value []*Quota + + // The link to the next page of items + NextLink *string +} + // Pool - Concrete tracked resource types can be created by aliasing this type using a specific property type. type Pool struct { // REQUIRED; The geo-location where the resource lives @@ -401,7 +410,7 @@ type PoolUpdate struct { // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // The updatable properties of the Pool. + // The resource-specific properties for this resource. Properties *PoolUpdateProperties // Resource tags. @@ -431,29 +440,20 @@ type PoolUpdateProperties struct { // Quota - Describes Resource Quota type Quota struct { - // The resource-specific properties for this resource. - Properties *QuotaProperties + // REQUIRED; The current usage of the resource. + CurrentValue *int64 - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // REQUIRED; Fully qualified ARM resource id 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 -} + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 -// QuotaListResult - The response of a Quota list operation. -type QuotaListResult struct { - // REQUIRED; The Quota items on this page - Value []*Quota + // REQUIRED; The unit of usage measurement. + Unit *string - // The link to the next page of items - NextLink *string + // READ-ONLY; The name of the quota. + Name *QuotaName } // QuotaName - The Quota Names @@ -465,21 +465,6 @@ type QuotaName struct { Value *string } -// QuotaProperties - Describes Resource Quota properties -type QuotaProperties struct { - // REQUIRED; The current usage of the resource. - CurrentValue *int64 - - // REQUIRED; The maximum permitted usage of the resource. - Limit *int64 - - // REQUIRED; The details of the quota. - Name *QuotaName - - // REQUIRED; The unit of usage measurement. - Unit *string -} - // ResourceDetailsObject - A ResourceDetailsObject type ResourceDetailsObject struct { // The resource-specific properties for this resource. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go index 30ddb194628f..fc8e89a5f2fa 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -799,6 +799,37 @@ func (o *OsProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PagedQuota. +func (p PagedQuota) 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 PagedQuota. +func (p *PagedQuota) UnmarshalJSON(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 Pool. func (p Pool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1056,11 +1087,11 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Quota. func (q Quota) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) populate(objectMap, "id", q.ID) + populate(objectMap, "limit", q.Limit) populate(objectMap, "name", q.Name) - populate(objectMap, "properties", q.Properties) - populate(objectMap, "systemData", q.SystemData) - populate(objectMap, "type", q.Type) + populate(objectMap, "unit", q.Unit) return json.Marshal(objectMap) } @@ -1073,51 +1104,20 @@ func (q *Quota) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &q.ID) delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + 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) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QuotaListResult. -func (q QuotaListResult) 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 QuotaListResult. -func (q *QuotaListResult) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &q.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &q.Value) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) delete(rawMsg, key) } if err != nil { @@ -1158,45 +1158,6 @@ func (q *QuotaName) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaProperties. -func (q QuotaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "currentValue", q.CurrentValue) - populate(objectMap, "limit", q.Limit) - populate(objectMap, "name", q.Name) - populate(objectMap, "unit", q.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaProperties. -func (q *QuotaProperties) UnmarshalJSON(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) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &q.CurrentValue) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &q.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &q.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ResourceDetailsObject. func (r ResourceDetailsObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go index f44bb303f492..4229efc22a16 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -64,8 +64,8 @@ type SKUClientListByLocationOptions struct { // placeholder for future optional parameters } -// SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. -type SubscriptionUsagesClientListByLocationOptions struct { +type SubscriptionUsagesClientUsagesOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go deleted file mode 100644 index 3f84839167f5..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go +++ /dev/null @@ -1,260 +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 armdevopsinfrastructure_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/devopsinfrastructure/armdevopsinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListPoolsBySubscription.json -func ExamplePoolsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPoolsClient().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.PoolListResult = armdevopsinfrastructure.PoolListResult{ - // Value: []*armdevopsinfrastructure.Pool{ - // { - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/aoiresourceGroupName/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListPoolsBySubscriptionAndResourceGroup.json -func ExamplePoolsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPoolsClient().NewListByResourceGroupPager("rg", 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.PoolListResult = armdevopsinfrastructure.PoolListResult{ - // Value: []*armdevopsinfrastructure.Pool{ - // { - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/GetPool.json -func ExamplePoolsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoolsClient().Get(ctx, "rg", "pool", 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.Pool = armdevopsinfrastructure.Pool{ - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // Properties: &armdevopsinfrastructure.PoolProperties{ - // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - // Kind: to.Ptr("Stateless"), - // }, - // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - // Kind: to.Ptr("Vmss"), - // Images: []*armdevopsinfrastructure.PoolImage{ - // { - // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - // }}, - // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - // Name: to.Ptr("Standard_D4ads_v5"), - // }, - // }, - // MaximumConcurrency: to.Ptr[int32](10), - // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - // Kind: to.Ptr("AzureDevOps"), - // Organizations: []*armdevopsinfrastructure.Organization{ - // { - // URL: to.Ptr("https://mseng.visualstudio.com"), - // }}, - // }, - // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/CreateOrUpdatePool.json -func ExamplePoolsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg", "pool", armdevopsinfrastructure.Pool{ - Location: to.Ptr("eastus"), - Properties: &armdevopsinfrastructure.PoolProperties{ - AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - Kind: to.Ptr("Stateless"), - }, - DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - Kind: to.Ptr("Vmss"), - Images: []*armdevopsinfrastructure.PoolImage{ - { - ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - }}, - SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - Name: to.Ptr("Standard_D4ads_v5"), - }, - }, - MaximumConcurrency: to.Ptr[int32](10), - OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - Kind: to.Ptr("AzureDevOps"), - Organizations: []*armdevopsinfrastructure.Organization{ - { - URL: to.Ptr("https://mseng.visualstudio.com"), - }}, - }, - ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - }, - }, 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.Pool = armdevopsinfrastructure.Pool{ - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // Properties: &armdevopsinfrastructure.PoolProperties{ - // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - // Kind: to.Ptr("Stateless"), - // }, - // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - // Kind: to.Ptr("Vmss"), - // Images: []*armdevopsinfrastructure.PoolImage{ - // { - // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - // }}, - // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - // Name: to.Ptr("Standard_D4ads_v5"), - // }, - // }, - // MaximumConcurrency: to.Ptr[int32](10), - // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - // Kind: to.Ptr("AzureDevOps"), - // Organizations: []*armdevopsinfrastructure.Organization{ - // { - // URL: to.Ptr("https://mseng.visualstudio.com"), - // }}, - // }, - // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/UpdatePool.json -func ExamplePoolsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginUpdate(ctx, "rg", "pool", armdevopsinfrastructure.PoolUpdate{}, 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.Pool = armdevopsinfrastructure.Pool{ - // Location: to.Ptr("eastus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/DeletePool.json -func ExamplePoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginDelete(ctx, "rg", "pool", 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/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go deleted file mode 100644 index 2c320ed1d805..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_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 armdevopsinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ResourceDetails_ListByPool.json -func ExampleResourceDetailsClient_NewListByPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceDetailsClient().NewListByPoolPager("my-resource-group", "my-dev-ops-pool", 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.ResourceDetailsObjectListResult = armdevopsinfrastructure.ResourceDetailsObjectListResult{ - // Value: []*armdevopsinfrastructure.ResourceDetailsObject{ - // { - // Name: to.Ptr("dd8cc705c000000"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_0"), - // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ - // Image: to.Ptr("my-image"), - // ImageVersion: to.Ptr("4.0.0"), - // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusReady), - // }, - // }, - // { - // Name: to.Ptr("dd8cc705c000001"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_1"), - // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ - // Image: to.Ptr("my-image"), - // ImageVersion: to.Ptr("4.0.0"), - // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusAllocated), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go index a536b94a7c60..6acca5cf2e33 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -67,8 +67,8 @@ type SKUClientListByLocationResponse struct { ResourceSKUListResult } -// SubscriptionUsagesClientListByLocationResponse contains the response from method SubscriptionUsagesClient.NewListByLocationPager. -type SubscriptionUsagesClientListByLocationResponse struct { - // The response of a Quota list operation. - QuotaListResult +// SubscriptionUsagesClientUsagesResponse contains the response from method SubscriptionUsagesClient.NewUsagesPager. +type SubscriptionUsagesClientUsagesResponse struct { + // Paged collection of Quota items + PagedQuota } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go deleted file mode 100644 index 3ccfd416f8b2..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go +++ /dev/null @@ -1,297 +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 armdevopsinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/Sku_ListByLocation.json -func ExampleSKUClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUClient().NewListByLocationPager("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.ResourceSKUListResult = armdevopsinfrastructure.ResourceSKUListResult{ - // Value: []*armdevopsinfrastructure.ResourceSKU{ - // { - // Name: to.Ptr("Basic_A0"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Basic_A0"), - // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ - // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("CpuArchitectureType"), - // Value: to.Ptr("x64"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("VMDeploymentTypes"), - // Value: to.Ptr("IaaS"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("EncryptionAtHostSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("CapacityReservationSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("basicAFamily"), - // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("eastus"), - // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("eastus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ - // { - // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeLocation), - // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), - // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ - // Locations: []*string{ - // to.Ptr("eastus")}, - // }, - // Values: []*string{ - // to.Ptr("eastus")}, - // }, - // { - // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeZone), - // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), - // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ - // Locations: []*string{ - // to.Ptr("eastus")}, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // Values: []*string{ - // to.Ptr("eastus")}, - // }}, - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Basic"), - // }, - // }, - // { - // Name: to.Ptr("Standard_A2_v2"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Standard_A2_v2"), - // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ - // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("CpuArchitectureType"), - // Value: to.Ptr("x64"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("VMDeploymentTypes"), - // Value: to.Ptr("PaaS,IaaS"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedIOPS"), - // Value: to.Ptr("2000"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedReadBytesPerSecond"), - // Value: to.Ptr("41943040"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedWriteBytesPerSecond"), - // Value: to.Ptr("20971520"), - // }, - // { - // Name: to.Ptr("UncachedDiskIOPS"), - // Value: to.Ptr("3200"), - // }, - // { - // Name: to.Ptr("UncachedDiskBytesPerSecond"), - // Value: to.Ptr("48000000"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("EncryptionAtHostSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("CapacityReservationSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardAv2Family"), - // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("eastus"), - // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("eastus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ - // }, - // Size: to.Ptr("A2_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go index 52c4e21bf58b..803d220a0080 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go @@ -43,46 +43,46 @@ func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenC return client, nil } -// NewListByLocationPager - List Quota resources by subscription ID +// NewUsagesPager - List Quota resources by subscription ID // // Generated from API version 2024-04-04-preview -// - locationName - Name of the location. -// - options - SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// - location - The name of the Azure region. +// - options - SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. -func (client *SubscriptionUsagesClient) NewListByLocationPager(locationName string, options *SubscriptionUsagesClientListByLocationOptions) *runtime.Pager[SubscriptionUsagesClientListByLocationResponse] { - return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientListByLocationResponse]{ - More: func(page SubscriptionUsagesClientListByLocationResponse) bool { +func (client *SubscriptionUsagesClient) NewUsagesPager(location string, options *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse] { + return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientUsagesResponse]{ + More: func(page SubscriptionUsagesClientUsagesResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientListByLocationResponse) (SubscriptionUsagesClientListByLocationResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewListByLocationPager") + Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientUsagesResponse) (SubscriptionUsagesClientUsagesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewUsagesPager") 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.listByLocationCreateRequest(ctx, locationName, options) + return client.usagesCreateRequest(ctx, location, options) }, nil) if err != nil { - return SubscriptionUsagesClientListByLocationResponse{}, err + return SubscriptionUsagesClientUsagesResponse{}, err } - return client.listByLocationHandleResponse(resp) + return client.usagesHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByLocationCreateRequest creates the ListByLocation request. -func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SubscriptionUsagesClientListByLocationOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/usages" +// usagesCreateRequest creates the Usages request. +func (client *SubscriptionUsagesClient) usagesCreateRequest(ctx context.Context, location string, options *SubscriptionUsagesClientUsagesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{location}/usages" 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 @@ -94,11 +94,11 @@ func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context. return req, nil } -// listByLocationHandleResponse handles the ListByLocation response. -func (client *SubscriptionUsagesClient) listByLocationHandleResponse(resp *http.Response) (SubscriptionUsagesClientListByLocationResponse, error) { - result := SubscriptionUsagesClientListByLocationResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QuotaListResult); err != nil { - return SubscriptionUsagesClientListByLocationResponse{}, err +// usagesHandleResponse handles the Usages response. +func (client *SubscriptionUsagesClient) usagesHandleResponse(resp *http.Response) (SubscriptionUsagesClientUsagesResponse, error) { + result := SubscriptionUsagesClientUsagesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedQuota); err != nil { + return SubscriptionUsagesClientUsagesResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go deleted file mode 100644 index 46b092141c1a..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go +++ /dev/null @@ -1,72 +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 armdevopsinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/SubscriptionUsages_ListByLocation.json -func ExampleSubscriptionUsagesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionUsagesClient().NewListByLocationPager("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 = armdevopsinfrastructure.QuotaListResult{ - // Value: []*armdevopsinfrastructure.Quota{ - // { - // Name: to.Ptr("standardDADSv5Family"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDADSv5Family"), - // Properties: &armdevopsinfrastructure.QuotaProperties{ - // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DADSv5 Family vCPUs (PME VMSS)"), - // Value: to.Ptr("standardDADSv5Family"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](212), - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardDPLDSv5Family"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDPLDSv5Family"), - // Properties: &armdevopsinfrastructure.QuotaProperties{ - // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DPLDSv5 Family vCPUs (PME VMSS)"), - // Value: to.Ptr("standardDPLDSv5Family"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("Count"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md index ca1869b2b5e7..85ac8204560d 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md +++ b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-08-09) +### Other Changes + + ## 0.1.0 (2024-07-08) ### Other Changes diff --git a/sdk/resourcemanager/edgezones/armedgezones/constants.go b/sdk/resourcemanager/edgezones/armedgezones/constants.go index 63895bc68229..252cf1ee0675 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/constants.go +++ b/sdk/resourcemanager/edgezones/armedgezones/constants.go @@ -6,7 +6,7 @@ package armedgezones const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go new file mode 100644 index 000000000000..e390c3e58347 --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones/TempTypeSpecFiles/EdgeZones.Management/examples/2024-04-01-preview/ExtendedZones_Get.json +func ExampleExtendedZonesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Get(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientGetResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones/TempTypeSpecFiles/EdgeZones.Management/examples/2024-04-01-preview/ExtendedZones_ListBySubscription.json +func ExampleExtendedZonesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExtendedZonesClient().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 = armedgezones.ExtendedZonesClientListBySubscriptionResponse{ + // ExtendedZoneListResult: armedgezones.ExtendedZoneListResult{ + // Value: []*armedgezones.ExtendedZone{ + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/redmond"), + // Name: to.Ptr("redmond"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Redmond"), + // RegionalDisplayName: to.Ptr("(US) Redmond"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-122.03197"), + // Latitude: to.Ptr("47.69106"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones/TempTypeSpecFiles/EdgeZones.Management/examples/2024-04-01-preview/ExtendedZones_Register.json +func ExampleExtendedZonesClient_Register() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Register(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientRegisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingRegister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones/TempTypeSpecFiles/EdgeZones.Management/examples/2024-04-01-preview/ExtendedZones_Unregister.json +func ExampleExtendedZonesClient_Unregister() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Unregister(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientUnregisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingUnregister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/go.mod b/sdk/resourcemanager/edgezones/armedgezones/go.mod index c84ad365f8a1..e7af0b95ddb6 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.mod +++ b/sdk/resourcemanager/edgezones/armedgezones/go.mod @@ -2,10 +2,20 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezo go 1.18 -require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/edgezones/armedgezones/go.sum b/sdk/resourcemanager/edgezones/armedgezones/go.sum index 917448a001b7..09d275cb9a37 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.sum +++ b/sdk/resourcemanager/edgezones/armedgezones/go.sum @@ -1,12 +1,29 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/edgezones/armedgezones/models.go b/sdk/resourcemanager/edgezones/armedgezones/models.go index 8545bdd4066e..90dfe1bb9687 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/models.go +++ b/sdk/resourcemanager/edgezones/armedgezones/models.go @@ -74,7 +74,7 @@ type Operation struct { // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // Localized display information for this particular operation. + // READ-ONLY; Localized display information for this particular operation. Display *OperationDisplay // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure @@ -92,17 +92,19 @@ type Operation struct { // OperationDisplay - Localized display information for and operation. type OperationDisplay struct { - // The short, localized friendly description of the operation; suitable for tool tips and detailed views. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", - // "Restart Virtual Machine". + // 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 - // The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go similarity index 52% rename from sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go rename to sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go index 6cae58002b52..3976245c7509 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go +++ b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. -package armdevopsinfrastructure_test +package armedgezones_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListOperations.json +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones/TempTypeSpecFiles/EdgeZones.Management/examples/2024-04-01-preview/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 := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armedgezones.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,7 +33,19 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armdevopsinfrastructure.OperationListResult{ + // page = armedgezones.OperationsClientListResponse{ + // OperationListResult: armedgezones.OperationListResult{ + // Value: []*armedgezones.Operation{ + // { + // Name: to.Ptr("Microsoft.EdgeZones/extendedZones/read"), + // Display: &armedgezones.OperationDisplay{ + // Provider: to.Ptr("Microsoft.EdgeZones"), + // Resource: to.Ptr("extendedZones"), + // Operation: to.Ptr("read"), + // }, + // }, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml index 5f0bfa9f57a2..3bfa741236fc 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml +++ b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/edgezones/EdgeZones.Management -commit: ab064e0047ec560a700d6b501097d99471ad817b -repo: https://github.com/Azure/azure-rest-api-specs -additionalDirectories: +commit: 52d5e415c9026af1a6b3b4932f4338df7f40b0b8 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md new file mode 100644 index 000000000000..fa454d0e8468 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric` 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/fabric/armfabric/LICENSE.txt b/sdk/resourcemanager/fabric/armfabric/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/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/fabric/armfabric/README.md b/sdk/resourcemanager/fabric/armfabric/README.md new file mode 100644 index 000000000000..53dab0b0b2db --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/README.md @@ -0,0 +1,92 @@ +# Azure Fabric Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric) + +The `armfabric` module provides operations for working with Azure Fabric. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/fabric/armfabric) + +# 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 Fabric module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Fabric. 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 Fabric 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 := armfabric.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 := armfabric.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.NewCapacitiesClient() +``` + +## 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 `Fabric` 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/fabric/armfabric/autorest.md b/sdk/resourcemanager/fabric/armfabric/autorest.md new file mode 100644 index 000000000000..ddc94ad091df --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/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/fabric/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/fabric/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.0.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/fabric/armfabric/build.go b/sdk/resourcemanager/fabric/armfabric/build.go new file mode 100644 index 000000000000..8ae88f1f8781 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/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/fabric/armfabric + +package armfabric diff --git a/sdk/resourcemanager/fabric/armfabric/capacities_client.go b/sdk/resourcemanager/fabric/armfabric/capacities_client.go new file mode 100644 index 000000000000..2269bbad580e --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/capacities_client.go @@ -0,0 +1,795 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +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" +) + +// CapacitiesClient contains the methods for the FabricCapacities group. +// Don't use this type directly, use NewCapacitiesClient() instead. +type CapacitiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCapacitiesClient creates a new instance of CapacitiesClient 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 NewCapacitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapacitiesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CapacitiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Implements local CheckNameAvailability operations +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - location - The name of the Azure region. +// - body - The CheckAvailability request +// - options - CapacitiesClientCheckNameAvailabilityOptions contains the optional parameters for the CapacitiesClient.CheckNameAvailability +// method. +func (client *CapacitiesClient) CheckNameAvailability(ctx context.Context, location string, body CheckNameAvailabilityRequest, options *CapacitiesClientCheckNameAvailabilityOptions) (CapacitiesClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "CapacitiesClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, location, body, options) + if err != nil { + return CapacitiesClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacitiesClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CapacitiesClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *CapacitiesClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, body CheckNameAvailabilityRequest, options *CapacitiesClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/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", "2023-11-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 +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *CapacitiesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (CapacitiesClientCheckNameAvailabilityResponse, error) { + result := CapacitiesClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return CapacitiesClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Create a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. +// - resource - Resource create parameters. +// - options - CapacitiesClientBeginCreateOrUpdateOptions contains the optional parameters for the CapacitiesClient.BeginCreateOrUpdate +// method. +func (client *CapacitiesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, capacityName string, resource Capacity, options *CapacitiesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CapacitiesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, capacityName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacitiesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacitiesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CapacitiesClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityName string, resource Capacity, options *CapacitiesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CapacitiesClient.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, capacityName, 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 *CapacitiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, resource Capacity, options *CapacitiesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + 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-11-01") + 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 - Delete a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. +// - options - CapacitiesClientBeginDeleteOptions contains the optional parameters for the CapacitiesClient.BeginDelete method. +func (client *CapacitiesClient) BeginDelete(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginDeleteOptions) (*runtime.Poller[CapacitiesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, capacityName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacitiesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacitiesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CapacitiesClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CapacitiesClient.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, capacityName, 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 *CapacitiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + 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-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. +// - options - CapacitiesClientGetOptions contains the optional parameters for the CapacitiesClient.Get method. +func (client *CapacitiesClient) Get(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientGetOptions) (CapacitiesClientGetResponse, error) { + var err error + const operationName = "CapacitiesClient.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, capacityName, options) + if err != nil { + return CapacitiesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CapacitiesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CapacitiesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CapacitiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CapacitiesClient) getHandleResponse(resp *http.Response) (CapacitiesClientGetResponse, error) { + result := CapacitiesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Capacity); err != nil { + return CapacitiesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List FabricCapacity resources by resource group +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CapacitiesClientListByResourceGroupOptions contains the optional parameters for the CapacitiesClient.NewListByResourceGroupPager +// method. +func (client *CapacitiesClient) NewListByResourceGroupPager(resourceGroupName string, options *CapacitiesClientListByResourceGroupOptions) *runtime.Pager[CapacitiesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacitiesClientListByResourceGroupResponse]{ + More: func(page CapacitiesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacitiesClientListByResourceGroupResponse) (CapacitiesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacitiesClient.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 CapacitiesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CapacitiesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CapacitiesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities" + 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", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CapacitiesClient) listByResourceGroupHandleResponse(resp *http.Response) (CapacitiesClientListByResourceGroupResponse, error) { + result := CapacitiesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityListResult); err != nil { + return CapacitiesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List FabricCapacity resources by subscription ID +// +// Generated from API version 2023-11-01 +// - options - CapacitiesClientListBySubscriptionOptions contains the optional parameters for the CapacitiesClient.NewListBySubscriptionPager +// method. +func (client *CapacitiesClient) NewListBySubscriptionPager(options *CapacitiesClientListBySubscriptionOptions) *runtime.Pager[CapacitiesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacitiesClientListBySubscriptionResponse]{ + More: func(page CapacitiesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacitiesClientListBySubscriptionResponse) (CapacitiesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacitiesClient.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 CapacitiesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CapacitiesClient) listBySubscriptionCreateRequest(ctx context.Context, options *CapacitiesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/capacities" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CapacitiesClient) listBySubscriptionHandleResponse(resp *http.Response) (CapacitiesClientListBySubscriptionResponse, error) { + result := CapacitiesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityListResult); err != nil { + return CapacitiesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// NewListSKUsPager - List eligible SKUs for Microsoft Fabric resource provider +// +// Generated from API version 2023-11-01 +// - options - CapacitiesClientListSKUsOptions contains the optional parameters for the CapacitiesClient.NewListSKUsPager method. +func (client *CapacitiesClient) NewListSKUsPager(options *CapacitiesClientListSKUsOptions) *runtime.Pager[CapacitiesClientListSKUsResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacitiesClientListSKUsResponse]{ + More: func(page CapacitiesClientListSKUsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacitiesClientListSKUsResponse) (CapacitiesClientListSKUsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacitiesClient.NewListSKUsPager") + 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.listSKUsCreateRequest(ctx, options) + }, nil) + if err != nil { + return CapacitiesClientListSKUsResponse{}, err + } + return client.listSKUsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *CapacitiesClient) listSKUsCreateRequest(ctx context.Context, options *CapacitiesClientListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSKUsHandleResponse handles the ListSKUs response. +func (client *CapacitiesClient) listSKUsHandleResponse(resp *http.Response) (CapacitiesClientListSKUsResponse, error) { + result := CapacitiesClientListSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RpSKUEnumerationForNewResourceResult); err != nil { + return CapacitiesClientListSKUsResponse{}, err + } + return result, nil +} + +// NewListSKUsForCapacityPager - List eligible SKUs for a Microsoft Fabric resource +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the capacity. +// - options - CapacitiesClientListSKUsForCapacityOptions contains the optional parameters for the CapacitiesClient.NewListSKUsForCapacityPager +// method. +func (client *CapacitiesClient) NewListSKUsForCapacityPager(resourceGroupName string, capacityName string, options *CapacitiesClientListSKUsForCapacityOptions) *runtime.Pager[CapacitiesClientListSKUsForCapacityResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacitiesClientListSKUsForCapacityResponse]{ + More: func(page CapacitiesClientListSKUsForCapacityResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacitiesClientListSKUsForCapacityResponse) (CapacitiesClientListSKUsForCapacityResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacitiesClient.NewListSKUsForCapacityPager") + 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.listSKUsForCapacityCreateRequest(ctx, resourceGroupName, capacityName, options) + }, nil) + if err != nil { + return CapacitiesClientListSKUsForCapacityResponse{}, err + } + return client.listSKUsForCapacityHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listSKUsForCapacityCreateRequest creates the ListSKUsForCapacity request. +func (client *CapacitiesClient) listSKUsForCapacityCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientListSKUsForCapacityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/skus" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSKUsForCapacityHandleResponse handles the ListSKUsForCapacity response. +func (client *CapacitiesClient) listSKUsForCapacityHandleResponse(resp *http.Response) (CapacitiesClientListSKUsForCapacityResponse, error) { + result := CapacitiesClientListSKUsForCapacityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RpSKUEnumerationForExistingResourceResult); err != nil { + return CapacitiesClientListSKUsForCapacityResponse{}, err + } + return result, nil +} + +// BeginResume - Resume operation of the specified Fabric capacity instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. +// - options - CapacitiesClientBeginResumeOptions contains the optional parameters for the CapacitiesClient.BeginResume method. +func (client *CapacitiesClient) BeginResume(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginResumeOptions) (*runtime.Poller[CapacitiesClientResumeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resume(ctx, resourceGroupName, capacityName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacitiesClientResumeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacitiesClientResumeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Resume - Resume operation of the specified Fabric capacity instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CapacitiesClient) resume(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginResumeOptions) (*http.Response, error) { + var err error + const operationName = "CapacitiesClient.BeginResume" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resumeCreateRequest(ctx, resourceGroupName, capacityName, 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 +} + +// resumeCreateRequest creates the Resume request. +func (client *CapacitiesClient) resumeCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginResumeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/resume" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginSuspend - Suspend operation of the specified Fabric capacity instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. +// - options - CapacitiesClientBeginSuspendOptions contains the optional parameters for the CapacitiesClient.BeginSuspend method. +func (client *CapacitiesClient) BeginSuspend(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginSuspendOptions) (*runtime.Poller[CapacitiesClientSuspendResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.suspend(ctx, resourceGroupName, capacityName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacitiesClientSuspendResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacitiesClientSuspendResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Suspend - Suspend operation of the specified Fabric capacity instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CapacitiesClient) suspend(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginSuspendOptions) (*http.Response, error) { + var err error + const operationName = "CapacitiesClient.BeginSuspend" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.suspendCreateRequest(ctx, resourceGroupName, capacityName, 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 +} + +// suspendCreateRequest creates the Suspend request. +func (client *CapacitiesClient) suspendCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginSuspendOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/suspend" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. +// - properties - The resource properties to be updated. +// - options - CapacitiesClientBeginUpdateOptions contains the optional parameters for the CapacitiesClient.BeginUpdate method. +func (client *CapacitiesClient) BeginUpdate(ctx context.Context, resourceGroupName string, capacityName string, properties CapacityUpdate, options *CapacitiesClientBeginUpdateOptions) (*runtime.Poller[CapacitiesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, capacityName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CapacitiesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CapacitiesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a FabricCapacity +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *CapacitiesClient) update(ctx context.Context, resourceGroupName string, capacityName string, properties CapacityUpdate, options *CapacitiesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CapacitiesClient.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, capacityName, 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 *CapacitiesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, capacityName string, properties CapacityUpdate, options *CapacitiesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" + 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 capacityName == "" { + return nil, errors.New("parameter capacityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityName}", url.PathEscape(capacityName)) + 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-11-01") + 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/fabric/armfabric/ci.yml b/sdk/resourcemanager/fabric/armfabric/ci.yml new file mode 100644 index 000000000000..39fa6b58c77d --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/ci.yml @@ -0,0 +1,28 @@ +# 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/fabric/armfabric/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/fabric/armfabric/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/fabric/armfabric' diff --git a/sdk/resourcemanager/fabric/armfabric/client_factory.go b/sdk/resourcemanager/fabric/armfabric/client_factory.go new file mode 100644 index 000000000000..a9b08b8935f9 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/client_factory.go @@ -0,0 +1,52 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +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 +} + +// NewCapacitiesClient creates a new instance of CapacitiesClient. +func (c *ClientFactory) NewCapacitiesClient() *CapacitiesClient { + return &CapacitiesClient{ + 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/fabric/armfabric/constants.go b/sdk/resourcemanager/fabric/armfabric/constants.go new file mode 100644 index 000000000000..e7aa72b35c83 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/constants.go @@ -0,0 +1,176 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric" + moduleVersion = "v1.0.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, + } +} + +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + +// 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 provisioning state of the Fabric capacity resource. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource is deleting + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Resource is provisioning + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// ResourceState - The state of the Fabric capacity resource. +type ResourceState string + +const ( + // ResourceStateActive - Resource is active + ResourceStateActive ResourceState = "Active" + // ResourceStateDeleting - Resource is deleting + ResourceStateDeleting ResourceState = "Deleting" + // ResourceStateFailed - Resource is failed + ResourceStateFailed ResourceState = "Failed" + // ResourceStatePaused - Resource is paused + ResourceStatePaused ResourceState = "Paused" + // ResourceStatePausing - Resource is pausing + ResourceStatePausing ResourceState = "Pausing" + // ResourceStatePreparing - Resource is preparing + ResourceStatePreparing ResourceState = "Preparing" + // ResourceStateProvisioning - Resource is provisioning + ResourceStateProvisioning ResourceState = "Provisioning" + // ResourceStateResuming - Resource is resuming + ResourceStateResuming ResourceState = "Resuming" + // ResourceStateScaling - Resource is scaling + ResourceStateScaling ResourceState = "Scaling" + // ResourceStateSuspended - Resource is suspended + ResourceStateSuspended ResourceState = "Suspended" + // ResourceStateSuspending - Resource is suspending + ResourceStateSuspending ResourceState = "Suspending" + // ResourceStateUpdating - Resource is updating + ResourceStateUpdating ResourceState = "Updating" +) + +// PossibleResourceStateValues returns the possible values for the ResourceState const type. +func PossibleResourceStateValues() []ResourceState { + return []ResourceState{ + ResourceStateActive, + ResourceStateDeleting, + ResourceStateFailed, + ResourceStatePaused, + ResourceStatePausing, + ResourceStatePreparing, + ResourceStateProvisioning, + ResourceStateResuming, + ResourceStateScaling, + ResourceStateSuspended, + ResourceStateSuspending, + ResourceStateUpdating, + } +} + +// RpSKUTier - The name of the Azure pricing tier to which the SKU applies. +type RpSKUTier string + +const ( + // RpSKUTierFabric - Fabric tier + RpSKUTierFabric RpSKUTier = "Fabric" +) + +// PossibleRpSKUTierValues returns the possible values for the RpSKUTier const type. +func PossibleRpSKUTierValues() []RpSKUTier { + return []RpSKUTier{ + RpSKUTierFabric, + } +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go new file mode 100644 index 000000000000..5c33f777aa6c --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go @@ -0,0 +1,586 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/fabric/armfabric" + "net/http" + "net/url" + "regexp" +) + +// CapacitiesServer is a fake server for instances of the armfabric.CapacitiesClient type. +type CapacitiesServer struct { + // CheckNameAvailability is the fake for method CapacitiesClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, location string, body armfabric.CheckNameAvailabilityRequest, options *armfabric.CapacitiesClientCheckNameAvailabilityOptions) (resp azfake.Responder[armfabric.CapacitiesClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method CapacitiesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, capacityName string, resource armfabric.Capacity, options *armfabric.CapacitiesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CapacitiesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CapacitiesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientGetOptions) (resp azfake.Responder[armfabric.CapacitiesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CapacitiesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armfabric.CapacitiesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CapacitiesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armfabric.CapacitiesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListBySubscriptionResponse]) + + // NewListSKUsPager is the fake for method CapacitiesClient.NewListSKUsPager + // HTTP status codes to indicate success: http.StatusOK + NewListSKUsPager func(options *armfabric.CapacitiesClientListSKUsOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListSKUsResponse]) + + // NewListSKUsForCapacityPager is the fake for method CapacitiesClient.NewListSKUsForCapacityPager + // HTTP status codes to indicate success: http.StatusOK + NewListSKUsForCapacityPager func(resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientListSKUsForCapacityOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]) + + // BeginResume is the fake for method CapacitiesClient.BeginResume + // HTTP status codes to indicate success: http.StatusAccepted + BeginResume func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginResumeOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse], errResp azfake.ErrorResponder) + + // BeginSuspend is the fake for method CapacitiesClient.BeginSuspend + // HTTP status codes to indicate success: http.StatusAccepted + BeginSuspend func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginSuspendOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method CapacitiesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, capacityName string, properties armfabric.CapacityUpdate, options *armfabric.CapacitiesClientBeginUpdateOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCapacitiesServerTransport creates a new instance of CapacitiesServerTransport with the provided implementation. +// The returned CapacitiesServerTransport instance is connected to an instance of armfabric.CapacitiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCapacitiesServerTransport(srv *CapacitiesServer) *CapacitiesServerTransport { + return &CapacitiesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListBySubscriptionResponse]](), + newListSKUsPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsResponse]](), + newListSKUsForCapacityPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]](), + beginResume: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse]](), + beginSuspend: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientUpdateResponse]](), + } +} + +// CapacitiesServerTransport connects instances of armfabric.CapacitiesClient to instances of CapacitiesServer. +// Don't use this type directly, use NewCapacitiesServerTransport instead. +type CapacitiesServerTransport struct { + srv *CapacitiesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armfabric.CapacitiesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armfabric.CapacitiesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListBySubscriptionResponse]] + newListSKUsPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsResponse]] + newListSKUsForCapacityPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]] + beginResume *tracker[azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse]] + beginSuspend *tracker[azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse]] + beginUpdate *tracker[azfake.PollerResponder[armfabric.CapacitiesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CapacitiesServerTransport. +func (c *CapacitiesServerTransport) 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 "CapacitiesClient.CheckNameAvailability": + resp, err = c.dispatchCheckNameAvailability(req) + case "CapacitiesClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "CapacitiesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CapacitiesClient.Get": + resp, err = c.dispatchGet(req) + case "CapacitiesClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CapacitiesClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CapacitiesClient.NewListSKUsPager": + resp, err = c.dispatchNewListSKUsPager(req) + case "CapacitiesClient.NewListSKUsForCapacityPager": + resp, err = c.dispatchNewListSKUsForCapacityPager(req) + case "CapacitiesClient.BeginResume": + resp, err = c.dispatchBeginResume(req) + case "CapacitiesClient.BeginSuspend": + resp, err = c.dispatchBeginSuspend(req) + case "CapacitiesClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if c.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/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[armfabric.CheckNameAvailabilityRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CheckNameAvailability(req.Context(), locationParam, 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).CheckNameAvailabilityResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?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[armfabric.Capacity](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, capacityNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.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) { + c.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) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?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 + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, capacityNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CapacitiesServerTransport) 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~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?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 + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, capacityNameParam, 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).Capacity, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities` + 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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armfabric.CapacitiesClientListByResourceGroupResponse, 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) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities` + 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 := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armfabric.CapacitiesClientListBySubscriptionResponse, 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) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchNewListSKUsPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListSKUsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListSKUsPager not implemented")} + } + newListSKUsPager := c.newListSKUsPager.get(req) + if newListSKUsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/skus` + 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 := c.srv.NewListSKUsPager(nil) + newListSKUsPager = &resp + c.newListSKUsPager.add(req, newListSKUsPager) + server.PagerResponderInjectNextLinks(newListSKUsPager, req, func(page *armfabric.CapacitiesClientListSKUsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListSKUsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListSKUsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListSKUsPager) { + c.newListSKUsPager.remove(req) + } + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchNewListSKUsForCapacityPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListSKUsForCapacityPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListSKUsForCapacityPager not implemented")} + } + newListSKUsForCapacityPager := c.newListSKUsForCapacityPager.get(req) + if newListSKUsForCapacityPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` + 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 + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListSKUsForCapacityPager(resourceGroupNameParam, capacityNameParam, nil) + newListSKUsForCapacityPager = &resp + c.newListSKUsForCapacityPager.add(req, newListSKUsForCapacityPager) + server.PagerResponderInjectNextLinks(newListSKUsForCapacityPager, req, func(page *armfabric.CapacitiesClientListSKUsForCapacityResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListSKUsForCapacityPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListSKUsForCapacityPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListSKUsForCapacityPager) { + c.newListSKUsForCapacityPager.remove(req) + } + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchBeginResume(req *http.Request) (*http.Response, error) { + if c.srv.BeginResume == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginResume not implemented")} + } + beginResume := c.beginResume.get(req) + if beginResume == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resume` + 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 + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginResume(req.Context(), resourceGroupNameParam, capacityNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginResume = &respr + c.beginResume.add(req, beginResume) + } + + resp, err := server.PollerResponderNext(beginResume, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + c.beginResume.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginResume) { + c.beginResume.remove(req) + } + + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchBeginSuspend(req *http.Request) (*http.Response, error) { + if c.srv.BeginSuspend == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSuspend not implemented")} + } + beginSuspend := c.beginSuspend.get(req) + if beginSuspend == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/suspend` + 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 + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginSuspend(req.Context(), resourceGroupNameParam, capacityNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSuspend = &respr + c.beginSuspend.add(req, beginSuspend) + } + + resp, err := server.PollerResponderNext(beginSuspend, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + c.beginSuspend.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSuspend) { + c.beginSuspend.remove(req) + } + + return resp, nil +} + +func (c *CapacitiesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?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[armfabric.CapacityUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + capacityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capacityName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, capacityNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.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) { + c.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) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/internal.go b/sdk/resourcemanager/fabric/armfabric/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/fabric/armfabric/fake/operations_server.go b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go new file mode 100644 index 000000000000..cfd4a853bdbf --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/fabric/armfabric" + "net/http" +) + +// OperationsServer is a fake server for instances of the armfabric.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armfabric.OperationsClientListOptions) (resp azfake.PagerResponder[armfabric.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armfabric.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[armfabric.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armfabric.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armfabric.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armfabric.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 +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/server_factory.go b/sdk/resourcemanager/fabric/armfabric/fake/server_factory.go new file mode 100644 index 000000000000..2257cedf6538 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/fake/server_factory.go @@ -0,0 +1,80 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric.ClientFactory type. +type ServerFactory struct { + CapacitiesServer CapacitiesServer + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armfabric.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 armfabric.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trCapacitiesServer *CapacitiesServerTransport + 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 "CapacitiesClient": + initServer(s, &s.trCapacitiesServer, func() *CapacitiesServerTransport { return NewCapacitiesServerTransport(&s.srv.CapacitiesServer) }) + resp, err = s.trCapacitiesServer.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/fabric/armfabric/fake/time_rfc3339.go b/sdk/resourcemanager/fabric/armfabric/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/fabric/armfabric/go.mod b/sdk/resourcemanager/fabric/armfabric/go.mod new file mode 100644 index 000000000000..66392ca328f2 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/fabric/armfabric/go.sum b/sdk/resourcemanager/fabric/armfabric/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/fabric/armfabric/models.go b/sdk/resourcemanager/fabric/armfabric/models.go new file mode 100644 index 000000000000..55e75bf1bc70 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/models.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +import "time" + +// Capacity - Fabric Capacity resource +type Capacity struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; The SKU details + SKU *RpSKU + + // The resource-specific properties for this resource. + Properties *CapacityProperties + + // 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 +} + +// CapacityAdministration - The administration properties of the Fabric capacity resource +type CapacityAdministration struct { + // REQUIRED; An array of administrator user identities. + Members []*string +} + +// CapacityListResult - The response of a FabricCapacity list operation. +type CapacityListResult struct { + // REQUIRED; The FabricCapacity items on this page + Value []*Capacity + + // The link to the next page of items + NextLink *string +} + +// CapacityProperties - The Microsoft Fabric capacity properties. +type CapacityProperties struct { + // REQUIRED; The capacity administration + Administration *CapacityAdministration + + // READ-ONLY; The current deployment state of Microsoft Fabric resource. The provisioningState is to indicate states for resource + // provisioning. + ProvisioningState *ProvisioningState + + // READ-ONLY; The current state of Microsoft Fabric resource. The state is to indicate more states outside of resource provisioning. + State *ResourceState +} + +// CapacityUpdate - The type used for update operations of the FabricCapacity. +type CapacityUpdate struct { + // The resource-specific properties for this resource. + Properties *CapacityUpdateProperties + + // The SKU details + SKU *RpSKU + + // Resource tags. + Tags map[string]*string +} + +// CapacityUpdateProperties - The updatable properties of the FabricCapacity. +type CapacityUpdateProperties struct { + // The capacity administration + Administration *CapacityAdministration +} + +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string + + // The resource type. + Type *string +} + +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string + + // Indicates if the resource name is available. + NameAvailable *bool + + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason +} + +// 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 +} + +// RpSKU - Represents the SKU name and Azure pricing tier for Microsoft Fabric capacity resource. +type RpSKU struct { + // REQUIRED; The name of the SKU level. + Name *string + + // REQUIRED; The name of the Azure pricing tier to which the SKU applies. + Tier *RpSKUTier +} + +// RpSKUDetailsForExistingResource - An object that represents SKU details for existing resources +type RpSKUDetailsForExistingResource struct { + // REQUIRED; The resource type + ResourceType *string + + // REQUIRED; The SKU details + SKU *RpSKU +} + +// RpSKUDetailsForNewResource - The SKU details +type RpSKUDetailsForNewResource struct { + // REQUIRED; The list of available locations for the SKU + Locations []*string + + // REQUIRED; The SKU's name + Name *string + + // REQUIRED; The resource type + ResourceType *string +} + +// RpSKUEnumerationForExistingResourceResult - An object that represents enumerating SKUs for existing resources +type RpSKUEnumerationForExistingResourceResult struct { + // REQUIRED; The SKU details + Value []*RpSKUDetailsForExistingResource + + // Url for the next page. Null if no more pages available + NextLink *string +} + +// RpSKUEnumerationForNewResourceResult - An object that represents enumerating SKUs for new resources. +type RpSKUEnumerationForNewResourceResult struct { + // REQUIRED; The collection of available SKUs for new resources + Value []*RpSKUDetailsForNewResource + + // Url for the next page. Null if no more pages available + NextLink *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 +} diff --git a/sdk/resourcemanager/fabric/armfabric/models_serde.go b/sdk/resourcemanager/fabric/armfabric/models_serde.go new file mode 100644 index 000000000000..2a6290399474 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/models_serde.go @@ -0,0 +1,631 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Capacity. +func (c Capacity) 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, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Capacity. +func (c *Capacity) UnmarshalJSON(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 "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) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CapacityAdministration. +func (c CapacityAdministration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "members", c.Members) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityAdministration. +func (c *CapacityAdministration) UnmarshalJSON(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 "members": + err = unpopulate(val, "Members", &c.Members) + 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 CapacityListResult. +func (c CapacityListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityListResult. +func (c *CapacityListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 CapacityProperties. +func (c CapacityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "administration", c.Administration) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityProperties. +func (c *CapacityProperties) UnmarshalJSON(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 "administration": + err = unpopulate(val, "Administration", &c.Administration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + 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 CapacityUpdate. +func (c CapacityUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityUpdate. +func (c *CapacityUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CapacityUpdateProperties. +func (c CapacityUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "administration", c.Administration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityUpdateProperties. +func (c *CapacityUpdateProperties) UnmarshalJSON(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 "administration": + err = unpopulate(val, "Administration", &c.Administration) + 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 CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) 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 CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) UnmarshalJSON(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 CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse. +func (c *CheckNameAvailabilityResponse) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 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 RpSKU. +func (r RpSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "tier", r.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RpSKU. +func (r *RpSKU) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &r.Tier) + 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 RpSKUDetailsForExistingResource. +func (r RpSKUDetailsForExistingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "sku", r.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RpSKUDetailsForExistingResource. +func (r *RpSKUDetailsForExistingResource) UnmarshalJSON(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 "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + 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 RpSKUDetailsForNewResource. +func (r RpSKUDetailsForNewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "locations", r.Locations) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceType", r.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RpSKUDetailsForNewResource. +func (r *RpSKUDetailsForNewResource) UnmarshalJSON(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 "locations": + err = unpopulate(val, "Locations", &r.Locations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + 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 RpSKUEnumerationForExistingResourceResult. +func (r RpSKUEnumerationForExistingResourceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RpSKUEnumerationForExistingResourceResult. +func (r *RpSKUEnumerationForExistingResourceResult) UnmarshalJSON(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) + 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 RpSKUEnumerationForNewResourceResult. +func (r RpSKUEnumerationForNewResourceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RpSKUEnumerationForNewResourceResult. +func (r *RpSKUEnumerationForNewResourceResult) UnmarshalJSON(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) + 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 +} + +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/fabric/armfabric/operations_client.go b/sdk/resourcemanager/fabric/armfabric/operations_client.go new file mode 100644 index 000000000000..66171abe74ac --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +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 2023-11-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]{ + 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.Fabric/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-11-01") + 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/fabric/armfabric/options.go b/sdk/resourcemanager/fabric/armfabric/options.go new file mode 100644 index 000000000000..5102720d1959 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/options.go @@ -0,0 +1,79 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +// CapacitiesClientBeginCreateOrUpdateOptions contains the optional parameters for the CapacitiesClient.BeginCreateOrUpdate +// method. +type CapacitiesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacitiesClientBeginDeleteOptions contains the optional parameters for the CapacitiesClient.BeginDelete method. +type CapacitiesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacitiesClientBeginResumeOptions contains the optional parameters for the CapacitiesClient.BeginResume method. +type CapacitiesClientBeginResumeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacitiesClientBeginSuspendOptions contains the optional parameters for the CapacitiesClient.BeginSuspend method. +type CapacitiesClientBeginSuspendOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacitiesClientBeginUpdateOptions contains the optional parameters for the CapacitiesClient.BeginUpdate method. +type CapacitiesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacitiesClientCheckNameAvailabilityOptions contains the optional parameters for the CapacitiesClient.CheckNameAvailability +// method. +type CapacitiesClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// CapacitiesClientGetOptions contains the optional parameters for the CapacitiesClient.Get method. +type CapacitiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CapacitiesClientListByResourceGroupOptions contains the optional parameters for the CapacitiesClient.NewListByResourceGroupPager +// method. +type CapacitiesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CapacitiesClientListBySubscriptionOptions contains the optional parameters for the CapacitiesClient.NewListBySubscriptionPager +// method. +type CapacitiesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CapacitiesClientListSKUsForCapacityOptions contains the optional parameters for the CapacitiesClient.NewListSKUsForCapacityPager +// method. +type CapacitiesClientListSKUsForCapacityOptions struct { + // placeholder for future optional parameters +} + +// CapacitiesClientListSKUsOptions contains the optional parameters for the CapacitiesClient.NewListSKUsPager method. +type CapacitiesClientListSKUsOptions 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/fabric/armfabric/responses.go b/sdk/resourcemanager/fabric/armfabric/responses.go new file mode 100644 index 000000000000..5443ae08c589 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/responses.go @@ -0,0 +1,78 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +// CapacitiesClientCheckNameAvailabilityResponse contains the response from method CapacitiesClient.CheckNameAvailability. +type CapacitiesClientCheckNameAvailabilityResponse struct { + // The check availability result. + CheckNameAvailabilityResponse +} + +// CapacitiesClientCreateOrUpdateResponse contains the response from method CapacitiesClient.BeginCreateOrUpdate. +type CapacitiesClientCreateOrUpdateResponse struct { + // Fabric Capacity resource + Capacity +} + +// CapacitiesClientDeleteResponse contains the response from method CapacitiesClient.BeginDelete. +type CapacitiesClientDeleteResponse struct { + // placeholder for future response values +} + +// CapacitiesClientGetResponse contains the response from method CapacitiesClient.Get. +type CapacitiesClientGetResponse struct { + // Fabric Capacity resource + Capacity +} + +// CapacitiesClientListByResourceGroupResponse contains the response from method CapacitiesClient.NewListByResourceGroupPager. +type CapacitiesClientListByResourceGroupResponse struct { + // The response of a FabricCapacity list operation. + CapacityListResult +} + +// CapacitiesClientListBySubscriptionResponse contains the response from method CapacitiesClient.NewListBySubscriptionPager. +type CapacitiesClientListBySubscriptionResponse struct { + // The response of a FabricCapacity list operation. + CapacityListResult +} + +// CapacitiesClientListSKUsForCapacityResponse contains the response from method CapacitiesClient.NewListSKUsForCapacityPager. +type CapacitiesClientListSKUsForCapacityResponse struct { + // An object that represents enumerating SKUs for existing resources + RpSKUEnumerationForExistingResourceResult +} + +// CapacitiesClientListSKUsResponse contains the response from method CapacitiesClient.NewListSKUsPager. +type CapacitiesClientListSKUsResponse struct { + // An object that represents enumerating SKUs for new resources. + RpSKUEnumerationForNewResourceResult +} + +// CapacitiesClientResumeResponse contains the response from method CapacitiesClient.BeginResume. +type CapacitiesClientResumeResponse struct { + // placeholder for future response values +} + +// CapacitiesClientSuspendResponse contains the response from method CapacitiesClient.BeginSuspend. +type CapacitiesClientSuspendResponse struct { + // placeholder for future response values +} + +// CapacitiesClientUpdateResponse contains the response from method CapacitiesClient.BeginUpdate. +type CapacitiesClientUpdateResponse struct { + // Fabric Capacity resource + Capacity +} + +// 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/fabric/armfabric/time_rfc3339.go b/sdk/resourcemanager/fabric/armfabric/time_rfc3339.go new file mode 100644 index 000000000000..eedc342e8934 --- /dev/null +++ b/sdk/resourcemanager/fabric/armfabric/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armfabric + +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/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md new file mode 100644 index 000000000000..c26f3e7bf102 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices` 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/healthdataaiservices/armhealthdataaiservices/LICENSE.txt b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/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/healthdataaiservices/armhealthdataaiservices/README.md b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/README.md new file mode 100644 index 000000000000..b0a2caa7c166 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/README.md @@ -0,0 +1,92 @@ +# Azure Healthdataaiservices Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices) + +The `armhealthdataaiservices` module provides operations for working with Azure Healthdataaiservices. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices) + +# 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 Healthdataaiservices module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Healthdataaiservices. 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 Healthdataaiservices 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 := armhealthdataaiservices.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 := armhealthdataaiservices.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.NewDeidServicesClient() +``` + +## 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 `Healthdataaiservices` 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/healthdataaiservices/armhealthdataaiservices/autorest.md b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/autorest.md new file mode 100644 index 000000000000..c903270a1be8 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/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/healthdataaiservices/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/healthdataaiservices/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/healthdataaiservices/armhealthdataaiservices/build.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/build.go new file mode 100644 index 000000000000..680126bdbdf1 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/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/healthdataaiservices/armhealthdataaiservices + +package armhealthdataaiservices diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/ci.yml b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/ci.yml new file mode 100644 index 000000000000..5585acfc0d68 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/ci.yml @@ -0,0 +1,28 @@ +# 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/healthdataaiservices/armhealthdataaiservices/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/healthdataaiservices/armhealthdataaiservices' diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/client_factory.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/client_factory.go new file mode 100644 index 000000000000..4b26e67f9aa5 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/client_factory.go @@ -0,0 +1,68 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +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 +} + +// NewDeidServicesClient creates a new instance of DeidServicesClient. +func (c *ClientFactory) NewDeidServicesClient() *DeidServicesClient { + return &DeidServicesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewPrivateLinksClient creates a new instance of PrivateLinksClient. +func (c *ClientFactory) NewPrivateLinksClient() *PrivateLinksClient { + return &PrivateLinksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go new file mode 100644 index 000000000000..76e47cf6fb5d --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go @@ -0,0 +1,176 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices" + 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, + } +} + +// 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, + } +} + +// 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 status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource provisioning request has been accepted. + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned. + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is being updated. + 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, + } +} + +// PublicNetworkAccess - State of the public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled - The public network access is disabled + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled - The public network access is enabled + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go new file mode 100644 index 000000000000..c83797d73d63 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/deidservices_client.go @@ -0,0 +1,462 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +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" +) + +// DeidServicesClient contains the methods for the DeidServices group. +// Don't use this type directly, use NewDeidServicesClient() instead. +type DeidServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeidServicesClient creates a new instance of DeidServicesClient 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 NewDeidServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeidServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeidServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - resource - Resource create parameters. +// - options - DeidServicesClientBeginCreateOptions contains the optional parameters for the DeidServicesClient.BeginCreate +// method. +func (client *DeidServicesClient) BeginCreate(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, options *DeidServicesClientBeginCreateOptions) (*runtime.Poller[DeidServicesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, deidServiceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeidServicesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeidServicesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +func (client *DeidServicesClient) create(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, options *DeidServicesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "DeidServicesClient.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, deidServiceName, 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 *DeidServicesClient) createCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, options *DeidServicesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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-28-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 - Delete a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - options - DeidServicesClientBeginDeleteOptions contains the optional parameters for the DeidServicesClient.BeginDelete +// method. +func (client *DeidServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientBeginDeleteOptions) (*runtime.Poller[DeidServicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, deidServiceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeidServicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeidServicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +func (client *DeidServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DeidServicesClient.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, deidServiceName, 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 *DeidServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - options - DeidServicesClientGetOptions contains the optional parameters for the DeidServicesClient.Get method. +func (client *DeidServicesClient) Get(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientGetOptions) (DeidServicesClientGetResponse, error) { + var err error + const operationName = "DeidServicesClient.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, deidServiceName, options) + if err != nil { + return DeidServicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeidServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeidServicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DeidServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeidServicesClient) getHandleResponse(resp *http.Response) (DeidServicesClientGetResponse, error) { + result := DeidServicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeidService); err != nil { + return DeidServicesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List DeidService resources by resource group +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - DeidServicesClientListByResourceGroupOptions contains the optional parameters for the DeidServicesClient.NewListByResourceGroupPager +// method. +func (client *DeidServicesClient) NewListByResourceGroupPager(resourceGroupName string, options *DeidServicesClientListByResourceGroupOptions) *runtime.Pager[DeidServicesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DeidServicesClientListByResourceGroupResponse]{ + More: func(page DeidServicesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeidServicesClientListByResourceGroupResponse) (DeidServicesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeidServicesClient.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 DeidServicesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DeidServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DeidServicesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices" + 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-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DeidServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (DeidServicesClientListByResourceGroupResponse, error) { + result := DeidServicesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeidServiceListResult); err != nil { + return DeidServicesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List DeidService resources by subscription ID +// +// Generated from API version 2024-02-28-preview +// - options - DeidServicesClientListBySubscriptionOptions contains the optional parameters for the DeidServicesClient.NewListBySubscriptionPager +// method. +func (client *DeidServicesClient) NewListBySubscriptionPager(options *DeidServicesClientListBySubscriptionOptions) *runtime.Pager[DeidServicesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[DeidServicesClientListBySubscriptionResponse]{ + More: func(page DeidServicesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeidServicesClientListBySubscriptionResponse) (DeidServicesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeidServicesClient.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 DeidServicesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DeidServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DeidServicesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthDataAIServices/deidServices" + 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-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DeidServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DeidServicesClientListBySubscriptionResponse, error) { + result := DeidServicesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeidServiceListResult); err != nil { + return DeidServicesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - properties - The resource properties to be updated. +// - options - DeidServicesClientBeginUpdateOptions contains the optional parameters for the DeidServicesClient.BeginUpdate +// method. +func (client *DeidServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, options *DeidServicesClientBeginUpdateOptions) (*runtime.Poller[DeidServicesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, deidServiceName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeidServicesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeidServicesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a DeidService +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +func (client *DeidServicesClient) update(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, options *DeidServicesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DeidServicesClient.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, deidServiceName, 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 *DeidServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, options *DeidServicesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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-28-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/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go new file mode 100644 index 000000000000..9bc66a7e38f1 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/healthdataaiservices/armhealthdataaiservices" + "net/http" + "net/url" + "regexp" +) + +// DeidServicesServer is a fake server for instances of the armhealthdataaiservices.DeidServicesClient type. +type DeidServicesServer struct { + // BeginCreate is the fake for method DeidServicesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, deidServiceName string, resource armhealthdataaiservices.DeidService, options *armhealthdataaiservices.DeidServicesClientBeginCreateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DeidServicesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.DeidServicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DeidServicesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.DeidServicesClientGetOptions) (resp azfake.Responder[armhealthdataaiservices.DeidServicesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method DeidServicesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhealthdataaiservices.DeidServicesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method DeidServicesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhealthdataaiservices.DeidServicesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method DeidServicesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, deidServiceName string, properties armhealthdataaiservices.DeidUpdate, options *armhealthdataaiservices.DeidServicesClientBeginUpdateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewDeidServicesServerTransport creates a new instance of DeidServicesServerTransport with the provided implementation. +// The returned DeidServicesServerTransport instance is connected to an instance of armhealthdataaiservices.DeidServicesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeidServicesServerTransport(srv *DeidServicesServer) *DeidServicesServerTransport { + return &DeidServicesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientUpdateResponse]](), + } +} + +// DeidServicesServerTransport connects instances of armhealthdataaiservices.DeidServicesClient to instances of DeidServicesServer. +// Don't use this type directly, use NewDeidServicesServerTransport instead. +type DeidServicesServerTransport struct { + srv *DeidServicesServer + beginCreate *tracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for DeidServicesServerTransport. +func (d *DeidServicesServerTransport) 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 "DeidServicesClient.BeginCreate": + resp, err = d.dispatchBeginCreate(req) + case "DeidServicesClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DeidServicesClient.Get": + resp, err = d.dispatchGet(req) + case "DeidServicesClient.NewListByResourceGroupPager": + resp, err = d.dispatchNewListByResourceGroupPager(req) + case "DeidServicesClient.NewListBySubscriptionPager": + resp, err = d.dispatchNewListBySubscriptionPager(req) + case "DeidServicesClient.BeginUpdate": + resp, err = d.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DeidServicesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := d.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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[armhealthdataaiservices.DeidService](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreate(req.Context(), resourceGroupNameParam, deidServiceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + d.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) { + d.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) + } + + return resp, nil +} + +func (d *DeidServicesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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 + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, deidServiceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + 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 !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DeidServicesServerTransport) 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\.HealthDataAIServices/deidServices/(?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 + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, deidServiceNameParam, 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).DeidService, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DeidServicesServerTransport) 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\.HealthDataAIServices/deidServices` + 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 *armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse, 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 *DeidServicesServerTransport) 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\.HealthDataAIServices/deidServices` + 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 *armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse, 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 *DeidServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := d.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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[armhealthdataaiservices.DeidUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, deidServiceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + d.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) { + d.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) { + d.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go new file mode 100644 index 000000000000..b8b0cad794de --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/healthdataaiservices/armhealthdataaiservices" + "net/http" +) + +// OperationsServer is a fake server for instances of the armhealthdataaiservices.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armhealthdataaiservices.OperationsClientListOptions) (resp azfake.PagerResponder[armhealthdataaiservices.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armhealthdataaiservices.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[armhealthdataaiservices.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armhealthdataaiservices.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armhealthdataaiservices.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armhealthdataaiservices.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 +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..0c3ea4802333 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/healthdataaiservices/armhealthdataaiservices" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armhealthdataaiservices.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginCreate is the fake for method PrivateEndpointConnectionsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource armhealthdataaiservices.PrivateEndpointConnectionResource, options *armhealthdataaiservices.PrivateEndpointConnectionsClientBeginCreateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armhealthdataaiservices.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, deidServiceName string, privateEndpointConnectionName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armhealthdataaiservices.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByDeidServicePager is the fake for method PrivateEndpointConnectionsClient.NewListByDeidServicePager + // HTTP status codes to indicate success: http.StatusOK + NewListByDeidServicePager func(resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceOptions) (resp azfake.PagerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse]) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armhealthdataaiservices.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientDeleteResponse]](), + newListByDeidServicePager: newTracker[azfake.PagerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armhealthdataaiservices.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginCreate *tracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientDeleteResponse]] + newListByDeidServicePager *tracker[azfake.PagerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse]] +} + +// 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.BeginCreate": + resp, err = p.dispatchBeginCreate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByDeidServicePager": + resp, err = p.dispatchNewListByDeidServicePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) 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\.HealthDataAIServices/deidServices/(?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[armhealthdataaiservices.PrivateEndpointConnectionResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameParam, deidServiceNameParam, privateEndpointConnectionNameParam, 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 *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\.HealthDataAIServices/deidServices/(?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 + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + 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, deidServiceNameParam, 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.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)} + } + 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\.HealthDataAIServices/deidServices/(?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 + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + 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, deidServiceNameParam, 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).PrivateEndpointConnectionResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByDeidServicePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByDeidServicePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDeidServicePager not implemented")} + } + newListByDeidServicePager := p.newListByDeidServicePager.get(req) + if newListByDeidServicePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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 + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByDeidServicePager(resourceGroupNameParam, deidServiceNameParam, nil) + newListByDeidServicePager = &resp + p.newListByDeidServicePager.add(req, newListByDeidServicePager) + server.PagerResponderInjectNextLinks(newListByDeidServicePager, req, func(page *armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDeidServicePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByDeidServicePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDeidServicePager) { + p.newListByDeidServicePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go new file mode 100644 index 000000000000..4a5d8a9ff250 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/healthdataaiservices/armhealthdataaiservices" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinksServer is a fake server for instances of the armhealthdataaiservices.PrivateLinksClient type. +type PrivateLinksServer struct { + // NewListByDeidServicePager is the fake for method PrivateLinksClient.NewListByDeidServicePager + // HTTP status codes to indicate success: http.StatusOK + NewListByDeidServicePager func(resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.PrivateLinksClientListByDeidServiceOptions) (resp azfake.PagerResponder[armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse]) +} + +// NewPrivateLinksServerTransport creates a new instance of PrivateLinksServerTransport with the provided implementation. +// The returned PrivateLinksServerTransport instance is connected to an instance of armhealthdataaiservices.PrivateLinksClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinksServerTransport(srv *PrivateLinksServer) *PrivateLinksServerTransport { + return &PrivateLinksServerTransport{ + srv: srv, + newListByDeidServicePager: newTracker[azfake.PagerResponder[armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse]](), + } +} + +// PrivateLinksServerTransport connects instances of armhealthdataaiservices.PrivateLinksClient to instances of PrivateLinksServer. +// Don't use this type directly, use NewPrivateLinksServerTransport instead. +type PrivateLinksServerTransport struct { + srv *PrivateLinksServer + newListByDeidServicePager *tracker[azfake.PagerResponder[armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinksServerTransport. +func (p *PrivateLinksServerTransport) 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 "PrivateLinksClient.NewListByDeidServicePager": + resp, err = p.dispatchNewListByDeidServicePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchNewListByDeidServicePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByDeidServicePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDeidServicePager not implemented")} + } + newListByDeidServicePager := p.newListByDeidServicePager.get(req) + if newListByDeidServicePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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 + } + deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByDeidServicePager(resourceGroupNameParam, deidServiceNameParam, nil) + newListByDeidServicePager = &resp + p.newListByDeidServicePager.add(req, newListByDeidServicePager) + server.PagerResponderInjectNextLinks(newListByDeidServicePager, req, func(page *armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDeidServicePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByDeidServicePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDeidServicePager) { + p.newListByDeidServicePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/server_factory.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/server_factory.go new file mode 100644 index 000000000000..acee69c67eb3 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/server_factory.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices.ClientFactory type. +type ServerFactory struct { + DeidServicesServer DeidServicesServer + OperationsServer OperationsServer + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + PrivateLinksServer PrivateLinksServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armhealthdataaiservices.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 armhealthdataaiservices.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trDeidServicesServer *DeidServicesServerTransport + trOperationsServer *OperationsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinksServer *PrivateLinksServerTransport +} + +// 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 "DeidServicesClient": + initServer(s, &s.trDeidServicesServer, func() *DeidServicesServerTransport { return NewDeidServicesServerTransport(&s.srv.DeidServicesServer) }) + resp, err = s.trDeidServicesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinksClient": + initServer(s, &s.trPrivateLinksServer, func() *PrivateLinksServerTransport { return NewPrivateLinksServerTransport(&s.srv.PrivateLinksServer) }) + resp, err = s.trPrivateLinksServer.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/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/healthdataaiservices/armhealthdataaiservices/go.mod b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.mod new file mode 100644 index 000000000000..0a8b6a460991 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models.go new file mode 100644 index 000000000000..9707edf8ab05 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models.go @@ -0,0 +1,314 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +import "time" + +type ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassignedidentitiesAdditionalproperties struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// DeidPropertiesUpdate - The template for adding optional properties. +type DeidPropertiesUpdate struct { + // Gets or sets allow or disallow public network access to resource + PublicNetworkAccess *PublicNetworkAccess +} + +// DeidService - A HealthDataAIServicesProviderHub resource +type DeidService 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 *DeidServiceProperties + + // 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 +} + +// DeidServiceListResult - The response of a DeidService list operation. +type DeidServiceListResult struct { + // REQUIRED; The DeidService items on this page + Value []*DeidService + + // The link to the next page of items + NextLink *string +} + +// DeidServiceProperties - Details of the HealthDataAIServices DeidService. +type DeidServiceProperties struct { + // Gets or sets allow or disallow public network access to resource + PublicNetworkAccess *PublicNetworkAccess + + // READ-ONLY; List of private endpoint connections. + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Deid service url. + ServiceURL *string +} + +// DeidUpdate - Patch request body for DeidService +type DeidUpdate struct { + // Updatable managed service identity + Identity *ManagedServiceIdentityUpdate + + // RP-specific properties + Properties *DeidPropertiesUpdate + + // Resource tags. + Tags map[string]*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 +} + +// ManagedServiceIdentityUpdate - The template for adding optional properties. +type ManagedServiceIdentityUpdate struct { + // The type of managed identity assigned to this resource. + Type *ManagedServiceIdentityType + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassignedidentitiesAdditionalproperties +} + +// 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 +} + +// 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. 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 +} + +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The private endpoint resource. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateEndpointConnectionResource - Holder for private endpoint connections +type PrivateEndpointConnectionResource struct { + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionProperties + + // 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 +} + +// PrivateEndpointConnectionResourceListResult - The response of a PrivateEndpointConnectionResource list operation. +type PrivateEndpointConnectionResourceListResult struct { + // REQUIRED; The PrivateEndpointConnectionResource items on this page + Value []*PrivateEndpointConnectionResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResource - Private Links for DeidService 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 - 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 +} + +// 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 +} + +// 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 +} + +// 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/healthdataaiservices/armhealthdataaiservices/models_serde.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models_serde.go new file mode 100644 index 000000000000..2456639e9ca7 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models_serde.go @@ -0,0 +1,842 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassignedidentitiesAdditionalproperties. +func (c ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassignedidentitiesAdditionalproperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "principalId", c.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassignedidentitiesAdditionalproperties. +func (c *ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassignedidentitiesAdditionalproperties) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &c.PrincipalID) + 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 DeidPropertiesUpdate. +func (d DeidPropertiesUpdate) 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 DeidPropertiesUpdate. +func (d *DeidPropertiesUpdate) UnmarshalJSON(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 DeidService. +func (d DeidService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + 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 DeidService. +func (d *DeidService) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &d.Identity) + 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 DeidServiceListResult. +func (d DeidServiceListResult) 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 DeidServiceListResult. +func (d *DeidServiceListResult) UnmarshalJSON(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 DeidServiceProperties. +func (d DeidServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "serviceUrl", d.ServiceURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeidServiceProperties. +func (d *DeidServiceProperties) UnmarshalJSON(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 "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "serviceUrl": + err = unpopulate(val, "ServiceURL", &d.ServiceURL) + 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 DeidUpdate. +func (d DeidUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeidUpdate. +func (d *DeidUpdate) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + 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 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 ManagedServiceIdentityUpdate. +func (m ManagedServiceIdentityUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentityUpdate. +func (m *ManagedServiceIdentityUpdate) UnmarshalJSON(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 "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) + 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 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, "systemData", p.SystemData) + 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 "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 PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + 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 "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, 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 PrivateEndpointConnectionResource. +func (p PrivateEndpointConnectionResource) 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 PrivateEndpointConnectionResource. +func (p *PrivateEndpointConnectionResource) UnmarshalJSON(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 PrivateEndpointConnectionResourceListResult. +func (p PrivateEndpointConnectionResourceListResult) 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 PrivateEndpointConnectionResourceListResult. +func (p *PrivateEndpointConnectionResourceListResult) UnmarshalJSON(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 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, "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 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 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 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 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/healthdataaiservices/armhealthdataaiservices/operations_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client.go new file mode 100644 index 000000000000..95c1f328ebce --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +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-02-28-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.HealthDataAIServices/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-02-28-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/healthdataaiservices/armhealthdataaiservices/options.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/options.go new file mode 100644 index 000000000000..935433bd838d --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/options.go @@ -0,0 +1,81 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +// DeidServicesClientBeginCreateOptions contains the optional parameters for the DeidServicesClient.BeginCreate method. +type DeidServicesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeidServicesClientBeginDeleteOptions contains the optional parameters for the DeidServicesClient.BeginDelete method. +type DeidServicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeidServicesClientBeginUpdateOptions contains the optional parameters for the DeidServicesClient.BeginUpdate method. +type DeidServicesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeidServicesClientGetOptions contains the optional parameters for the DeidServicesClient.Get method. +type DeidServicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeidServicesClientListByResourceGroupOptions contains the optional parameters for the DeidServicesClient.NewListByResourceGroupPager +// method. +type DeidServicesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DeidServicesClientListBySubscriptionOptions contains the optional parameters for the DeidServicesClient.NewListBySubscriptionPager +// method. +type DeidServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate +// method. +type PrivateEndpointConnectionsClientBeginCreateOptions 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 +} + +// PrivateEndpointConnectionsClientListByDeidServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDeidServicePager +// method. +type PrivateEndpointConnectionsClientListByDeidServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientListByDeidServiceOptions contains the optional parameters for the PrivateLinksClient.NewListByDeidServicePager +// method. +type PrivateLinksClientListByDeidServiceOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go new file mode 100644 index 000000000000..2a29062a7bc6 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privateendpointconnections_client.go @@ -0,0 +1,347 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +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" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a Private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resource - Resource create parameters. +// - options - PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate +// method. +func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a Private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.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, deidServiceName, privateEndpointConnectionName, 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 *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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", "2024-02-28-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 - Delete the private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + 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[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete the private endpoint connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + 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.deleteCreateRequest(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, 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 *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a specific private connection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, deidServiceName 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, deidServiceName, 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 +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-28-preview") + 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.PrivateEndpointConnectionResource); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDeidServicePager - List private endpoint connections on the given resource +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - options - PrivateEndpointConnectionsClientListByDeidServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDeidServicePager +// method. +func (client *PrivateEndpointConnectionsClient) NewListByDeidServicePager(resourceGroupName string, deidServiceName string, options *PrivateEndpointConnectionsClientListByDeidServiceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByDeidServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByDeidServiceResponse]{ + More: func(page PrivateEndpointConnectionsClientListByDeidServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByDeidServiceResponse) (PrivateEndpointConnectionsClientListByDeidServiceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByDeidServicePager") + 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.listByDeidServiceCreateRequest(ctx, resourceGroupName, deidServiceName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListByDeidServiceResponse{}, err + } + return client.listByDeidServiceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByDeidServiceCreateRequest creates the ListByDeidService request. +func (client *PrivateEndpointConnectionsClient) listByDeidServiceCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, options *PrivateEndpointConnectionsClientListByDeidServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeidServiceHandleResponse handles the ListByDeidService response. +func (client *PrivateEndpointConnectionsClient) listByDeidServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByDeidServiceResponse, error) { + result := PrivateEndpointConnectionsClientListByDeidServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionResourceListResult); err != nil { + return PrivateEndpointConnectionsClientListByDeidServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go new file mode 100644 index 000000000000..72d32d9f162e --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/privatelinks_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +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" +) + +// PrivateLinksClient contains the methods for the PrivateLinks group. +// Don't use this type directly, use NewPrivateLinksClient() instead. +type PrivateLinksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinksClient creates a new instance of PrivateLinksClient 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 NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByDeidServicePager - List private links on the given resource +// +// Generated from API version 2024-02-28-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deidServiceName - The name of the deid service +// - options - PrivateLinksClientListByDeidServiceOptions contains the optional parameters for the PrivateLinksClient.NewListByDeidServicePager +// method. +func (client *PrivateLinksClient) NewListByDeidServicePager(resourceGroupName string, deidServiceName string, options *PrivateLinksClientListByDeidServiceOptions) *runtime.Pager[PrivateLinksClientListByDeidServiceResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinksClientListByDeidServiceResponse]{ + More: func(page PrivateLinksClientListByDeidServiceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinksClientListByDeidServiceResponse) (PrivateLinksClientListByDeidServiceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinksClient.NewListByDeidServicePager") + 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.listByDeidServiceCreateRequest(ctx, resourceGroupName, deidServiceName, options) + }, nil) + if err != nil { + return PrivateLinksClientListByDeidServiceResponse{}, err + } + return client.listByDeidServiceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByDeidServiceCreateRequest creates the ListByDeidService request. +func (client *PrivateLinksClient) listByDeidServiceCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, options *PrivateLinksClientListByDeidServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources" + 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 deidServiceName == "" { + return nil, errors.New("parameter deidServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName)) + 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-28-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDeidServiceHandleResponse handles the ListByDeidService response. +func (client *PrivateLinksClient) listByDeidServiceHandleResponse(resp *http.Response) (PrivateLinksClientListByDeidServiceResponse, error) { + result := PrivateLinksClientListByDeidServiceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinksClientListByDeidServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/responses.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/responses.go new file mode 100644 index 000000000000..ffa0de091d16 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/responses.go @@ -0,0 +1,79 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +// DeidServicesClientCreateResponse contains the response from method DeidServicesClient.BeginCreate. +type DeidServicesClientCreateResponse struct { + // A HealthDataAIServicesProviderHub resource + DeidService +} + +// DeidServicesClientDeleteResponse contains the response from method DeidServicesClient.BeginDelete. +type DeidServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// DeidServicesClientGetResponse contains the response from method DeidServicesClient.Get. +type DeidServicesClientGetResponse struct { + // A HealthDataAIServicesProviderHub resource + DeidService +} + +// DeidServicesClientListByResourceGroupResponse contains the response from method DeidServicesClient.NewListByResourceGroupPager. +type DeidServicesClientListByResourceGroupResponse struct { + // The response of a DeidService list operation. + DeidServiceListResult +} + +// DeidServicesClientListBySubscriptionResponse contains the response from method DeidServicesClient.NewListBySubscriptionPager. +type DeidServicesClientListBySubscriptionResponse struct { + // The response of a DeidService list operation. + DeidServiceListResult +} + +// DeidServicesClientUpdateResponse contains the response from method DeidServicesClient.BeginUpdate. +type DeidServicesClientUpdateResponse struct { + // A HealthDataAIServicesProviderHub resource + DeidService +} + +// 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 +} + +// PrivateEndpointConnectionsClientCreateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreate. +type PrivateEndpointConnectionsClientCreateResponse struct { + // Holder for private endpoint connections + PrivateEndpointConnectionResource +} + +// 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 { + // Holder for private endpoint connections + PrivateEndpointConnectionResource +} + +// PrivateEndpointConnectionsClientListByDeidServiceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByDeidServicePager. +type PrivateEndpointConnectionsClientListByDeidServiceResponse struct { + // The response of a PrivateEndpointConnectionResource list operation. + PrivateEndpointConnectionResourceListResult +} + +// PrivateLinksClientListByDeidServiceResponse contains the response from method PrivateLinksClient.NewListByDeidServicePager. +type PrivateLinksClientListByDeidServiceResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult +} diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/time_rfc3339.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/time_rfc3339.go new file mode 100644 index 000000000000..4d45d06107c3 --- /dev/null +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armhealthdataaiservices + +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/CHANGELOG.md b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md index deed2bfbe77c..05df8404263b 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-08-09) +### 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/constants.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/constants.go index 6e1de599534b..52c2e8477f02 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/constants.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/constants.go @@ -10,7 +10,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/go.mod b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.mod index 077eab11ed96..267bb1b5a802 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 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/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/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/largeinstance/armlargeinstance/CHANGELOG.md b/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md index 6ae3f0cc31bd..92b0d3ae7e72 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-08-09) +### Other Changes + + ## 0.1.0 (2024-02-23) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md b/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md index 1621b2cee069..662c6249d038 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurelargeinstance/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurelargeinstance/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-2023-07-20-preview +module-version: 0.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargeinstance_client_example_test.go b/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargeinstance_client_example_test.go deleted file mode 100644 index 556b44f1c8ff..000000000000 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargeinstance_client_example_test.go +++ /dev/null @@ -1,537 +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 armlargeinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_ListBySubscription.json -func ExampleAzureLargeInstanceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeInstanceClient().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.AzureLargeInstanceListResult = armlargeinstance.AzureLargeInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeInstance{ - // { - // Name: to.Ptr("myAzureLargeInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureLargeInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_ListByResourceGroup.json -func ExampleAzureLargeInstanceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeInstanceClient().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.AzureLargeInstanceListResult = armlargeinstance.AzureLargeInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeInstance{ - // { - // Name: to.Ptr("myAzureLargeMetalInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeMetalInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName1"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myABMInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myABMInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS384), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumHPE), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.101"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeMetalInstance1"), - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.201"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Get.json -func ExampleAzureLargeInstanceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeInstanceClient().Get(ctx, "myResourceGroup", "myAzureLargeInstance", 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.AzureLargeInstance = armlargeinstance.AzureLargeInstance{ - // Name: to.Ptr("myAzureLargeInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_PatchTags_Delete.json -func ExampleAzureLargeInstanceClient_Update_azureLargeInstanceDeleteTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeInstanceClient().Update(ctx, "myResourceGroup", "myALInstance", armlargeinstance.AzureLargeInstanceTagsUpdate{}, 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.AzureLargeInstance = armlargeinstance.AzureLargeInstance{ - // Name: to.Ptr("myALInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance2"), - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_PatchTags.json -func ExampleAzureLargeInstanceClient_Update_azureLargeInstanceUpdateTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeInstanceClient().Update(ctx, "myResourceGroup", "myALInstance", armlargeinstance.AzureLargeInstanceTagsUpdate{}, 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.AzureLargeInstance = armlargeinstance.AzureLargeInstance{ - // Name: to.Ptr("myALInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance2"), - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Restart.json -func ExampleAzureLargeInstanceClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureLargeInstanceClient().BeginRestart(ctx, "myResourceGroup", "myALInstance", &armlargeinstance.AzureLargeInstanceClientBeginRestartOptions{ForceParameter: 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.OperationStatusResult = armlargeinstance.OperationStatusResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armlargeinstance.ErrorDetail{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T21:17:24.905Z"); return t}()), - // Status: to.Ptr("InProgress"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Shutdown.json -func ExampleAzureLargeInstanceClient_BeginShutdown() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureLargeInstanceClient().BeginShutdown(ctx, "myResourceGroup", "myALInstance", 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.OperationStatusResult = armlargeinstance.OperationStatusResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armlargeinstance.ErrorDetail{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T21:17:24.905Z"); return t}()), - // Status: to.Ptr("InProgress"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Start.json -func ExampleAzureLargeInstanceClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureLargeInstanceClient().BeginStart(ctx, "myResourceGroup", "myALInstance", 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.OperationStatusResult = armlargeinstance.OperationStatusResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armlargeinstance.ErrorDetail{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T21:17:24.905Z"); return t}()), - // Status: to.Ptr("InProgress"), - // } -} diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargestorageinstance_client_example_test.go b/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargestorageinstance_client_example_test.go deleted file mode 100644 index 3948f1478309..000000000000 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargestorageinstance_client_example_test.go +++ /dev/null @@ -1,357 +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 armlargeinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_ListBySubscription.json -func ExampleAzureLargeStorageInstanceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeStorageInstanceClient().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.AzureLargeStorageInstanceListResult = armlargeinstance.AzureLargeStorageInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeStorageInstance{ - // { - // Name: to.Ptr("myAzureLargeInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureLargeInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24f7"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("RI"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("NFS"), - // WorkloadType: to.Ptr("Cogito"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_ListByResourceGroup.json -func ExampleAzureLargeStorageInstanceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeStorageInstanceClient().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.AzureLargeStorageInstanceListResult = armlargeinstance.AzureLargeStorageInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeStorageInstance{ - // { - // Name: to.Ptr("myAzureLargeStorageInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureLargeStorageInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24f7"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("RI"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("NFS"), - // WorkloadType: to.Ptr("Cogito"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_Get.json -func ExampleAzureLargeStorageInstanceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeStorageInstanceClient().Get(ctx, "myResourceGroup", "myAzureLargeStorageInstance", 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.AzureLargeStorageInstance = armlargeinstance.AzureLargeStorageInstance{ - // Name: to.Ptr("myAzureLargeStorageInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_PatchTags_Delete.json -func ExampleAzureLargeStorageInstanceClient_Update_azureLargeStorageInstanceDeleteTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeStorageInstanceClient().Update(ctx, "myResourceGroup", "myALSInstance", armlargeinstance.AzureLargeStorageInstanceTagsUpdate{}, 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.AzureLargeStorageInstance = armlargeinstance.AzureLargeStorageInstance{ - // Name: to.Ptr("myAzureLargeStorageInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_PatchTags.json -func ExampleAzureLargeStorageInstanceClient_Update_azureLargeStorageInstanceUpdateTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeStorageInstanceClient().Update(ctx, "myResourceGroup", "myALSInstance", armlargeinstance.AzureLargeStorageInstanceTagsUpdate{}, 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.AzureLargeStorageInstance = armlargeinstance.AzureLargeStorageInstance{ - // Name: to.Ptr("myAzureLargeStorageInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go b/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go index 5454bc356d7b..6b3ab4d13abc 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go @@ -10,7 +10,7 @@ package armlargeinstance const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod b/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod index 0588179ee391..941291653853 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armla go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum b/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/operations_client_example_test.go b/sdk/resourcemanager/largeinstance/armlargeinstance/operations_client_example_test.go deleted file mode 100644 index 2db610fcb800..000000000000 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/operations_client_example_test.go +++ /dev/null @@ -1,66 +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 armlargeinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstanceOperations_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 := armlargeinstance.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 = armlargeinstance.OperationListResult{ - // Value: []*armlargeinstance.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureLargeInstance/read"), - // Display: &armlargeinstance.OperationDisplay{ - // Description: to.Ptr("Read any AzureLargeInstance"), - // Operation: to.Ptr("Read AzureLargeInstance"), - // Provider: to.Ptr("Microsoft Azure Large Instance"), - // Resource: to.Ptr("AzureLargeInstance"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureLargeInstance"), - // Display: &armlargeinstance.OperationDisplay{ - // Description: to.Ptr("Start any AzureLargeInstance"), - // Operation: to.Ptr("Start AzureLargeInstance"), - // Provider: to.Ptr("Microsoft Azure Large Instance"), - // Resource: to.Ptr("AzureLargeInstance"), - // }, - // IsDataAction: to.Ptr(true), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md b/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md index d9bf9ac599cf..f9128f835dfb 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 2.0.1 (2024-08-09) +### 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/constants.go b/sdk/resourcemanager/liftrqumulo/armqumulo/constants.go index 4760ab6a01bf..23d46f36a5be 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/constants.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/constants.go @@ -10,7 +10,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/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 77ecca426c38..06c6c3eba290 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum b/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 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/loadtesting/armloadtesting/CHANGELOG.md b/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md index 22bec5129b54..b2c44b149cd6 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md +++ b/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 2.0.0 (2024-08-09) +### 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 05fe0c2c3046..367694ec56b4 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/README.md +++ b/sdk/resourcemanager/loadtesting/armloadtesting/README.md @@ -1,6 +1,6 @@ # Azure Load Testing Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2) The `armloadtesting` module provides operations for working with Azure Load Testing. @@ -20,7 +20,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..440681993887 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/client_factory.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/client_factory.go @@ -17,40 +17,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..a8f5a6ee2c6b 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/constants.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/constants.go @@ -10,7 +10,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 +90,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 +110,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/loadtests_server.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go index 262e95a6be41..322193fee147 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go @@ -16,7 +16,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,10 +26,10 @@ 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 + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, loadTestName string, options *armloadtesting.LoadTestsClientBeginDeleteOptions) (resp azfake.PollerResponder[armloadtesting.LoadTestsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method LoadTestsClient.Get @@ -50,7 +50,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. @@ -198,9 +198,9 @@ func (l *LoadTestsServerTransport) dispatchBeginDelete(req *http.Request) (*http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { l.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { l.beginDelete.remove(req) @@ -365,7 +365,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 } diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go index b697bdd5da9d..ffcf46472c53 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go @@ -15,7 +15,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" ) diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go index 660c2aa50377..24cfe703fa79 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go @@ -16,7 +16,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 +26,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 diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/loadtesting/armloadtesting/go.mod b/sdk/resourcemanager/loadtesting/armloadtesting/go.mod index b4a0def893c8..0105fd9faa1f 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.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.9.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // 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.2.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..2ab13521d97d 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client.go @@ -28,7 +28,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 +43,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 +70,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 +96,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, options *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 +118,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 +149,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 +167,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 } @@ -200,12 +200,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 @@ -264,7 +264,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. @@ -318,13 +318,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 @@ -373,7 +373,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 +383,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] { @@ -438,28 +438,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 +470,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 +496,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, options *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 +518,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..71f41688ccce 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/models.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/models.go @@ -18,14 +18,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 +37,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 +50,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/fa5fc227-a624-475e-b696-cdd604c735bc/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 +91,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 +118,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 +227,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 +268,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 +284,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..76b361cf32df 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/models_serde.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/models_serde.go @@ -307,16 +307,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 +338,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 +347,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 +373,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 +587,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 +621,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 +634,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 +758,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 +913,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..e8674b9bbfcb 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/operations_client.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/operations_client.go @@ -37,7 +37,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. 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/quotas_client.go b/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go index 996cc9dd0dbe..6dd5425ff0ed 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go @@ -28,7 +28,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 +47,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 +75,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, options *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 +97,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 +116,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 @@ -176,10 +176,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]{ @@ -229,7 +229,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 88% rename from sdk/resourcemanager/loadtesting/armloadtesting/response_types.go rename to sdk/resourcemanager/loadtesting/armloadtesting/responses.go index bac914afaefd..8477db639eaf 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/response_types.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/responses.go @@ -10,7 +10,7 @@ package armloadtesting // LoadTestsClientCreateOrUpdateResponse contains the response from method LoadTestsClient.BeginCreateOrUpdate. type LoadTestsClientCreateOrUpdateResponse struct { - // LoadTest details + // LoadTest details. LoadTestResource } @@ -21,31 +21,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 +69,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..ed29c15ca4dd 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/time_rfc3339.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/migrationdiscovery/armmigrationdiscoverysap/CHANGELOG.md b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/CHANGELOG.md index fdefa2e3b32f..94a03e053697 100644 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/CHANGELOG.md +++ b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-08-09) +### Other Changes + + ## 0.1.0 (2024-03-22) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/autorest.md b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/autorest.md index 3b90f376b49e..7e72985b9cb6 100644 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/autorest.md +++ b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2023-10 +module-version: 0.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/constants.go b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/constants.go index 1eb76935814a..acbb4837e0fe 100644 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/constants.go +++ b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/constants.go @@ -10,7 +10,7 @@ package armmigrationdiscoverysap const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.mod b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.mod index 1b414a7dba61..64d070d6a148 100644 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.mod +++ b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrationdiscovery/ go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.sum b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.sum +++ b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/models.go b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/models.go index 8227a2c33571..6ce2220e7f26 100644 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/models.go +++ b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/models.go @@ -250,7 +250,7 @@ type SAPDiscoverySiteListResult struct { // REQUIRED; The SAPDiscoverySite items on this page Value []*SAPDiscoverySite - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -304,7 +304,7 @@ type SAPInstanceListResult struct { // REQUIRED; The SAPInstance items on this page Value []*SAPInstance - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -368,7 +368,7 @@ type ServerInstanceListResult struct { // REQUIRED; The ServerInstance items on this page Value []*ServerInstance - // 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/migrationdiscovery/armmigrationdiscoverysap/operations_client_example_test.go b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/operations_client_example_test.go deleted file mode 100644 index 4d29d642043e..000000000000 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/operations_client_example_test.go +++ /dev/null @@ -1,316 +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 armmigrationdiscoverysap_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-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 := armmigrationdiscoverysap.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 = armmigrationdiscoverysap.OperationListResult{ - // Value: []*armmigrationdiscoverysap.Operation{ - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor."), - // Operation: to.Ptr("monitors_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified resource group."), - // Operation: to.Ptr("monitors_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Creates a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/delete"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP monitor with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each provider instances."), - // Operation: to.Ptr("ProviderInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/delete"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets a list of properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Creates a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/delete"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP Landscape monitor configuration with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("SapLandscapeMonitor_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Set SapDiscoverySites"), - // Operation: to.Ptr("Creates or updates the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Delete"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Delete SapDiscoverySites"), - // Operation: to.Ptr("Deletes the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Read SapDiscoverySites"), - // Operation: to.Ptr("Reads the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Set SapInstances"), - // Operation: to.Ptr("Creates or updates the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Delete"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Delete SapInstances"), - // Operation: to.Ptr("Deletes the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Read SapInstances"), - // Operation: to.Ptr("Reads the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Set serverInstances"), - // Operation: to.Ptr("Creates or updates the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Delete"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Delete serverInstances"), - // Operation: to.Ptr("Deletes the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Read serverInstances"), - // Operation: to.Ptr("Reads the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/Write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Set connectors"), - // Operation: to.Ptr("Creates or updates the connectors"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/Read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Read connectors"), - // Operation: to.Ptr("Reads the connectors"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/Write"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Set acssBackups"), - // Operation: to.Ptr("Creates or updates the acssBackups"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/Read"), - // Display: &armmigrationdiscoverysap.OperationDisplay{ - // Description: to.Ptr("Read acssBackups"), - // Operation: to.Ptr("Reads the acssBackups"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/sapdiscoverysites_client_example_test.go b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/sapdiscoverysites_client_example_test.go deleted file mode 100644 index 297ecab3b5b4..000000000000 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/sapdiscoverysites_client_example_test.go +++ /dev/null @@ -1,452 +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 armmigrationdiscoverysap_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/migrationdiscovery/armmigrationdiscoverysap" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListBySubscription.json -func ExampleSapDiscoverySitesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSapDiscoverySitesClient().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.SAPDiscoverySiteListResult = armmigrationdiscoverysap.SAPDiscoverySiteListResult{ - // Value: []*armmigrationdiscoverysap.SAPDiscoverySite{ - // { - // Name: to.Ptr("SampleSite"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId"), - // MigrateProjectID: to.Ptr("MigrateProjectId"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("SampleSite1"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite1"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId1"), - // MigrateProjectID: to.Ptr("MigrateProjectId1"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListByResourceGroup.json -func ExampleSapDiscoverySitesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSapDiscoverySitesClient().NewListByResourceGroupPager("test-rg", 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.SAPDiscoverySiteListResult = armmigrationdiscoverysap.SAPDiscoverySiteListResult{ - // Value: []*armmigrationdiscoverysap.SAPDiscoverySite{ - // { - // Name: to.Ptr("SampleSite"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId"), - // MigrateProjectID: to.Ptr("MigrateProjectId"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("SampleSite1"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite1"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId1"), - // MigrateProjectID: to.Ptr("MigrateProjectId1"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Get.json -func ExampleSapDiscoverySitesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapDiscoverySitesClient().Get(ctx, "test-rg", "SampleSite", 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.SAPDiscoverySite = armmigrationdiscoverysap.SAPDiscoverySite{ - // Name: to.Ptr("SampleSite"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId"), - // MigrateProjectID: to.Ptr("MigrateProjectId"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Create.json -func ExampleSapDiscoverySitesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSapDiscoverySitesClient().BeginCreate(ctx, "test-rg", "SampleSite", armmigrationdiscoverysap.SAPDiscoverySite{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "property1": to.Ptr("value1"), - "property2": to.Ptr("value2"), - }, - Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - MasterSiteID: to.Ptr("MasterSiteIdResourceId"), - MigrateProjectID: to.Ptr("MigrateProjectId"), - }, - }, 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.SAPDiscoverySite = armmigrationdiscoverysap.SAPDiscoverySite{ - // Name: to.Ptr("SampleSite"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId"), - // MigrateProjectID: to.Ptr("MigrateProjectId"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Update.json -func ExampleSapDiscoverySitesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapDiscoverySitesClient().Update(ctx, "test-rg", "SampleSite", armmigrationdiscoverysap.SAPDiscoverySiteTagsUpdate{ - Tags: map[string]*string{ - "tag1": 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.SAPDiscoverySite = armmigrationdiscoverysap.SAPDiscoverySite{ - // Name: to.Ptr("SampleSite"), - // Type: to.Ptr("microsoft.workloads/sapDiscoverySites"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPDiscoverySiteProperties{ - // Errors: &armmigrationdiscoverysap.SAPMigrateError{ - // Properties: &armmigrationdiscoverysap.ErrorDefinition{ - // Code: to.Ptr("ErrorCode1"), - // Message: to.Ptr("This would be an elaborate error message"), - // Details: []*armmigrationdiscoverysap.ErrorDefinition{ - // { - // Code: to.Ptr("ErrorCode2"), - // Message: to.Ptr("This would be an elaborate error message"), - // }}, - // }, - // }, - // MasterSiteID: to.Ptr("MasterSiteIdResourceId"), - // MigrateProjectID: to.Ptr("MigrateProjectId"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Delete.json -func ExampleSapDiscoverySitesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSapDiscoverySitesClient().BeginDelete(ctx, "test-rg", "SampleSite", 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/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ImportEntities.json -func ExampleSapDiscoverySitesClient_BeginImportEntities() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSapDiscoverySitesClient().BeginImportEntities(ctx, "test-rg", "SampleSite", 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.OperationStatusResult = armmigrationdiscoverysap.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // Error: &armmigrationdiscoverysap.ErrorDetail{ - // Code: to.Ptr("ExcelUploadNotSupported"), - // Message: to.Ptr("Excel upload is not supported for a natively discovered Site."), - // Details: []*armmigrationdiscoverysap.ErrorDetail{ - // { - // Code: to.Ptr("ParallelExcelUploadNotSuppoeted"), - // Message: to.Ptr("Only one excel upload operation allowed for a discovery site at a time."), - // }}, - // }, - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/sapinstances_client_example_test.go b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/sapinstances_client_example_test.go deleted file mode 100644 index 42942f7c05dc..000000000000 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/sapinstances_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 armmigrationdiscoverysap_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/migrationdiscovery/armmigrationdiscoverysap" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_List.json -func ExampleSapInstancesClient_NewListBySapDiscoverySitePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSapInstancesClient().NewListBySapDiscoverySitePager("test-rg", "SampleSite", 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.SAPInstanceListResult = armmigrationdiscoverysap.SAPInstanceListResult{ - // Value: []*armmigrationdiscoverysap.SAPInstance{ - // { - // Name: to.Ptr("MPP_MPP"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPInstanceProperties{ - // Application: to.Ptr("HR"), - // Environment: to.Ptr(armmigrationdiscoverysap.SapInstanceEnvironmentProduction), - // LandscapeSid: to.Ptr("MPP"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SystemSid: to.Ptr("MPP"), - // }, - // }, - // { - // Name: to.Ptr("MPP_MPP_DR"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP_DR"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPInstanceProperties{ - // Application: to.Ptr("HR"), - // Environment: to.Ptr(armmigrationdiscoverysap.SapInstanceEnvironmentDisasterRecovery), - // LandscapeSid: to.Ptr("MPP"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SystemSid: to.Ptr("MPP"), - // }, - // }, - // { - // Name: to.Ptr("MPP_MPD"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPD"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPInstanceProperties{ - // Application: to.Ptr("HR"), - // Environment: to.Ptr(armmigrationdiscoverysap.SapInstanceEnvironmentDevelopment), - // LandscapeSid: to.Ptr("MPP"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SystemSid: to.Ptr("MPD"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Get.json -func ExampleSapInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapInstancesClient().Get(ctx, "test-rg", "SampleSite", "MPP_MPP", 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.SAPInstance = armmigrationdiscoverysap.SAPInstance{ - // Name: to.Ptr("MPP_MPP"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPInstanceProperties{ - // Application: to.Ptr("HR"), - // Environment: to.Ptr(armmigrationdiscoverysap.SapInstanceEnvironmentProduction), - // LandscapeSid: to.Ptr("MPP"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SystemSid: to.Ptr("MPP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Create.json -func ExampleSapInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSapInstancesClient().BeginCreate(ctx, "test-rg", "SampleSite", "MPP_MPP", armmigrationdiscoverysap.SAPInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "property1": to.Ptr("value1"), - "property2": to.Ptr("value2"), - }, - Properties: &armmigrationdiscoverysap.SAPInstanceProperties{}, - }, 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.SAPInstance = armmigrationdiscoverysap.SAPInstance{ - // Name: to.Ptr("MPP_MPP"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "property1": to.Ptr("value1"), - // "property2": to.Ptr("value2"), - // }, - // Properties: &armmigrationdiscoverysap.SAPInstanceProperties{ - // Application: to.Ptr("HR"), - // Environment: to.Ptr(armmigrationdiscoverysap.SapInstanceEnvironmentProduction), - // LandscapeSid: to.Ptr("MPP"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SystemSid: to.Ptr("MPP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Update.json -func ExampleSapInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapInstancesClient().Update(ctx, "test-rg", "SampleSite", "MPP_MPP", armmigrationdiscoverysap.SAPInstanceTagsUpdate{ - Tags: map[string]*string{ - "tag1": 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.SAPInstance = armmigrationdiscoverysap.SAPInstance{ - // Name: to.Ptr("MPP_MPP"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // }, - // Properties: &armmigrationdiscoverysap.SAPInstanceProperties{ - // Environment: to.Ptr(armmigrationdiscoverysap.SapInstanceEnvironmentProduction), - // LandscapeSid: to.Ptr("MPP"), - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SystemSid: to.Ptr("MPP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Delete.json -func ExampleSapInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSapInstancesClient().BeginDelete(ctx, "test-rg", "SampleSite", "MPP_MPP", 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/migrationdiscovery/armmigrationdiscoverysap/serverinstances_client_example_test.go b/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/serverinstances_client_example_test.go deleted file mode 100644 index ef81fcddf291..000000000000 --- a/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap/serverinstances_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmigrationdiscoverysap_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrationdiscovery/armmigrationdiscoverysap" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_List.json -func ExampleServerInstancesClient_NewListBySapInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerInstancesClient().NewListBySapInstancePager("test-rg", "SampleSite", "MPP_MPP", 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.ServerInstanceListResult = armmigrationdiscoverysap.ServerInstanceListResult{ - // Value: []*armmigrationdiscoverysap.ServerInstance{ - // { - // Name: to.Ptr("APP_SapServer1"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP/serverInstances/APP_SapServer1"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Properties: &armmigrationdiscoverysap.ServerInstanceProperties{ - // ConfigurationData: &armmigrationdiscoverysap.ConfigurationData{ - // CPU: to.Ptr[int32](8), - // CPUInMhz: to.Ptr[int32](2300), - // CPUType: to.Ptr("AMD EPYC 7452 Processor"), - // DatabaseType: to.Ptr(armmigrationdiscoverysap.DatabaseTypeAdabas), - // HardwareManufacturer: to.Ptr("Microsoft Corporation"), - // Model: to.Ptr("Virtual Machine"), - // RAM: to.Ptr[int32](256), - // Saps: to.Ptr[int32](7000), - // TargetHanaRAMSizeGB: to.Ptr[int32](512), - // TotalDiskIops: to.Ptr[int32](1000), - // TotalDiskSizeGB: to.Ptr[int32](512), - // }, - // InstanceSid: to.Ptr("MPP"), - // OperatingSystem: to.Ptr(armmigrationdiscoverysap.OperatingSystem("IBM")), - // PerformanceData: &armmigrationdiscoverysap.ExcelPerformanceData{ - // DataSource: to.Ptr(armmigrationdiscoverysap.DataSourceExcel), - // MaxCPULoad: to.Ptr[int32](10), - // TotalSourceDbSizeGB: to.Ptr[int32](750), - // }, - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SapInstanceType: to.Ptr(armmigrationdiscoverysap.SapInstanceTypeAPP), - // SapProduct: to.Ptr("SAP ERP ENHANCE PACKAGE"), - // SapProductVersion: to.Ptr("6.08"), - // ServerName: to.Ptr("SapServer1"), - // }, - // }, - // { - // Name: to.Ptr("APP_SapServer2"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP/serverInstances/APP_SapServer2"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Properties: &armmigrationdiscoverysap.ServerInstanceProperties{ - // ConfigurationData: &armmigrationdiscoverysap.ConfigurationData{ - // CPU: to.Ptr[int32](8), - // CPUInMhz: to.Ptr[int32](2300), - // CPUType: to.Ptr("AMD EPYC 7452 Processor"), - // DatabaseType: to.Ptr(armmigrationdiscoverysap.DatabaseTypeAdabas), - // HardwareManufacturer: to.Ptr("Microsoft Corporation"), - // Model: to.Ptr("Virtual Machine"), - // RAM: to.Ptr[int32](256), - // Saps: to.Ptr[int32](7000), - // TargetHanaRAMSizeGB: to.Ptr[int32](512), - // TotalDiskIops: to.Ptr[int32](1000), - // TotalDiskSizeGB: to.Ptr[int32](512), - // }, - // InstanceSid: to.Ptr("MPP"), - // OperatingSystem: to.Ptr(armmigrationdiscoverysap.OperatingSystem("IBM")), - // PerformanceData: &armmigrationdiscoverysap.ExcelPerformanceData{ - // DataSource: to.Ptr(armmigrationdiscoverysap.DataSourceExcel), - // MaxCPULoad: to.Ptr[int32](10), - // TotalSourceDbSizeGB: to.Ptr[int32](750), - // }, - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SapInstanceType: to.Ptr(armmigrationdiscoverysap.SapInstanceTypeAPP), - // SapProduct: to.Ptr("SAP ERP ENHANCE PACKAGE"), - // SapProductVersion: to.Ptr("6.08"), - // ServerName: to.Ptr("SapServer2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Get.json -func ExampleServerInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerInstancesClient().Get(ctx, "test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1", 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.ServerInstance = armmigrationdiscoverysap.ServerInstance{ - // Name: to.Ptr("APP_SapServer1"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP/serverInstances/APP_SapServer1"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Properties: &armmigrationdiscoverysap.ServerInstanceProperties{ - // ConfigurationData: &armmigrationdiscoverysap.ConfigurationData{ - // CPU: to.Ptr[int32](8), - // CPUInMhz: to.Ptr[int32](2300), - // CPUType: to.Ptr("AMD EPYC 7452 Processor"), - // DatabaseType: to.Ptr(armmigrationdiscoverysap.DatabaseTypeAdabas), - // HardwareManufacturer: to.Ptr("Microsoft Corporation"), - // Model: to.Ptr("Virtual Machine"), - // RAM: to.Ptr[int32](256), - // Saps: to.Ptr[int32](7000), - // TargetHanaRAMSizeGB: to.Ptr[int32](512), - // TotalDiskIops: to.Ptr[int32](1000), - // TotalDiskSizeGB: to.Ptr[int32](512), - // }, - // InstanceSid: to.Ptr("MPP"), - // OperatingSystem: to.Ptr(armmigrationdiscoverysap.OperatingSystem("IBM")), - // PerformanceData: &armmigrationdiscoverysap.ExcelPerformanceData{ - // DataSource: to.Ptr(armmigrationdiscoverysap.DataSourceExcel), - // MaxCPULoad: to.Ptr[int32](10), - // TotalSourceDbSizeGB: to.Ptr[int32](750), - // }, - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SapInstanceType: to.Ptr(armmigrationdiscoverysap.SapInstanceTypeAPP), - // SapProduct: to.Ptr("SAP ERP ENHANCE PACKAGE"), - // SapProductVersion: to.Ptr("6.08"), - // ServerName: to.Ptr("SapServer1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Create.json -func ExampleServerInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerInstancesClient().BeginCreate(ctx, "test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1", armmigrationdiscoverysap.ServerInstance{}, 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.ServerInstance = armmigrationdiscoverysap.ServerInstance{ - // Name: to.Ptr("APP_SapServer1"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP/serverInstances/APP_SapServer1"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Properties: &armmigrationdiscoverysap.ServerInstanceProperties{ - // ConfigurationData: &armmigrationdiscoverysap.ConfigurationData{ - // CPU: to.Ptr[int32](8), - // CPUInMhz: to.Ptr[int32](2300), - // CPUType: to.Ptr("AMD EPYC 7452 Processor"), - // DatabaseType: to.Ptr(armmigrationdiscoverysap.DatabaseTypeAdabas), - // HardwareManufacturer: to.Ptr("Microsoft Corporation"), - // Model: to.Ptr("Virtual Machine"), - // RAM: to.Ptr[int32](256), - // Saps: to.Ptr[int32](7000), - // TargetHanaRAMSizeGB: to.Ptr[int32](512), - // TotalDiskIops: to.Ptr[int32](1000), - // TotalDiskSizeGB: to.Ptr[int32](512), - // }, - // InstanceSid: to.Ptr("MPP"), - // OperatingSystem: to.Ptr(armmigrationdiscoverysap.OperatingSystem("IBM")), - // PerformanceData: &armmigrationdiscoverysap.ExcelPerformanceData{ - // DataSource: to.Ptr(armmigrationdiscoverysap.DataSourceExcel), - // MaxCPULoad: to.Ptr[int32](10), - // TotalSourceDbSizeGB: to.Ptr[int32](750), - // }, - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SapInstanceType: to.Ptr(armmigrationdiscoverysap.SapInstanceTypeAPP), - // SapProduct: to.Ptr("SAP ERP ENHANCE PACKAGE"), - // SapProductVersion: to.Ptr("6.08"), - // ServerName: to.Ptr("SapServer1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Update.json -func ExampleServerInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerInstancesClient().Update(ctx, "test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1", armmigrationdiscoverysap.UpdateServerInstanceRequest{ - Properties: &armmigrationdiscoverysap.ServerInstanceProperties{}, - }, 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.ServerInstance = armmigrationdiscoverysap.ServerInstance{ - // Name: to.Ptr("APP_SapServer1"), - // Type: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapDiscoverySites/SampleSite/sapInstances/MPP_MPP/serverInstances/APP_SapServer1"), - // SystemData: &armmigrationdiscoverysap.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // CreatedBy: to.Ptr("UserName"), - // CreatedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-26T14:15:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("UserName"), - // LastModifiedByType: to.Ptr(armmigrationdiscoverysap.CreatedByTypeUser), - // }, - // Properties: &armmigrationdiscoverysap.ServerInstanceProperties{ - // ConfigurationData: &armmigrationdiscoverysap.ConfigurationData{ - // CPU: to.Ptr[int32](8), - // CPUInMhz: to.Ptr[int32](2300), - // CPUType: to.Ptr("AMD EPYC 7452 Processor"), - // DatabaseType: to.Ptr(armmigrationdiscoverysap.DatabaseTypeAdabas), - // HardwareManufacturer: to.Ptr("Microsoft Corporation"), - // Model: to.Ptr("Virtual Machine"), - // RAM: to.Ptr[int32](256), - // Saps: to.Ptr[int32](7000), - // TargetHanaRAMSizeGB: to.Ptr[int32](512), - // TotalDiskIops: to.Ptr[int32](1000), - // TotalDiskSizeGB: to.Ptr[int32](512), - // }, - // InstanceSid: to.Ptr("MPP"), - // OperatingSystem: to.Ptr(armmigrationdiscoverysap.OperatingSystem("IBM")), - // PerformanceData: &armmigrationdiscoverysap.ExcelPerformanceData{ - // DataSource: to.Ptr(armmigrationdiscoverysap.DataSourceExcel), - // MaxCPULoad: to.Ptr[int32](10), - // TotalSourceDbSizeGB: to.Ptr[int32](750), - // }, - // ProvisioningState: to.Ptr(armmigrationdiscoverysap.ProvisioningStateSucceeded), - // SapInstanceType: to.Ptr(armmigrationdiscoverysap.SapInstanceTypeAPP), - // SapProduct: to.Ptr("SAP ERP ENHANCE PACKAGE"), - // SapProductVersion: to.Ptr("6.08"), - // ServerName: to.Ptr("SapServer1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/475747ff6322e9bf180b8911d871561b264379c3/specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Delete.json -func ExampleServerInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmigrationdiscoverysap.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerInstancesClient().BeginDelete(ctx, "test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1", 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/mobilepacketcore/armmobilepacketcore/CHANGELOG.md b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/CHANGELOG.md new file mode 100644 index 000000000000..9bd48c17a095 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore` 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/mobilepacketcore/armmobilepacketcore/LICENSE.txt b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/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/mobilepacketcore/armmobilepacketcore/README.md b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/README.md new file mode 100644 index 000000000000..f2ff924b95c1 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/README.md @@ -0,0 +1,92 @@ +# Azure Mobilepacketcore Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore) + +The `armmobilepacketcore` module provides operations for working with Azure Mobilepacketcore. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore) + +# 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 Mobilepacketcore module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Mobilepacketcore. 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 Mobilepacketcore 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 := armmobilepacketcore.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 := armmobilepacketcore.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.NewAmfDeploymentsClient() +``` + +## 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 `Mobilepacketcore` 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/mobilepacketcore/armmobilepacketcore/amfdeployments_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/amfdeployments_client.go new file mode 100644 index 000000000000..78f479b09069 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/amfdeployments_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// AmfDeploymentsClient contains the methods for the AmfDeployments group. +// Don't use this type directly, use NewAmfDeploymentsClient() instead. +type AmfDeploymentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAmfDeploymentsClient creates a new instance of AmfDeploymentsClient 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 NewAmfDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AmfDeploymentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AmfDeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a AmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - amfDeploymentName - The name of the AMF Deployment +// - resource - Resource create parameters. +// - options - AmfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the AmfDeploymentsClient.BeginCreateOrUpdate +// method. +func (client *AmfDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, amfDeploymentName string, resource AmfDeploymentResource, options *AmfDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AmfDeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, amfDeploymentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AmfDeploymentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AmfDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a AmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *AmfDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, amfDeploymentName string, resource AmfDeploymentResource, options *AmfDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AmfDeploymentsClient.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, amfDeploymentName, 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 *AmfDeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, amfDeploymentName string, resource AmfDeploymentResource, options *AmfDeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/amfDeployments/{amfDeploymentName}" + 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 amfDeploymentName == "" { + return nil, errors.New("parameter amfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{amfDeploymentName}", url.PathEscape(amfDeploymentName)) + 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-10-15-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 - Delete a AmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - amfDeploymentName - The name of the AMF Deployment +// - options - AmfDeploymentsClientBeginDeleteOptions contains the optional parameters for the AmfDeploymentsClient.BeginDelete +// method. +func (client *AmfDeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *AmfDeploymentsClientBeginDeleteOptions) (*runtime.Poller[AmfDeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, amfDeploymentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AmfDeploymentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AmfDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a AmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *AmfDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *AmfDeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AmfDeploymentsClient.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, amfDeploymentName, 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 *AmfDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *AmfDeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/amfDeployments/{amfDeploymentName}" + 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 amfDeploymentName == "" { + return nil, errors.New("parameter amfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{amfDeploymentName}", url.PathEscape(amfDeploymentName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a AmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - amfDeploymentName - The name of the AMF Deployment +// - options - AmfDeploymentsClientGetOptions contains the optional parameters for the AmfDeploymentsClient.Get method. +func (client *AmfDeploymentsClient) Get(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *AmfDeploymentsClientGetOptions) (AmfDeploymentsClientGetResponse, error) { + var err error + const operationName = "AmfDeploymentsClient.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, amfDeploymentName, options) + if err != nil { + return AmfDeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AmfDeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AmfDeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AmfDeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *AmfDeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/amfDeployments/{amfDeploymentName}" + 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 amfDeploymentName == "" { + return nil, errors.New("parameter amfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{amfDeploymentName}", url.PathEscape(amfDeploymentName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AmfDeploymentsClient) getHandleResponse(resp *http.Response) (AmfDeploymentsClientGetResponse, error) { + result := AmfDeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AmfDeploymentResource); err != nil { + return AmfDeploymentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all Access and Mobility Function Deployments by Resource Group. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AmfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the AmfDeploymentsClient.NewListByResourceGroupPager +// method. +func (client *AmfDeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *AmfDeploymentsClientListByResourceGroupOptions) *runtime.Pager[AmfDeploymentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AmfDeploymentsClientListByResourceGroupResponse]{ + More: func(page AmfDeploymentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AmfDeploymentsClientListByResourceGroupResponse) (AmfDeploymentsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AmfDeploymentsClient.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 AmfDeploymentsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AmfDeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AmfDeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/amfDeployments" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AmfDeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (AmfDeploymentsClientListByResourceGroupResponse, error) { + result := AmfDeploymentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AmfDeploymentResourceListResult); err != nil { + return AmfDeploymentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all Access and Mobility Function Deployments by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - AmfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the AmfDeploymentsClient.NewListBySubscriptionPager +// method. +func (client *AmfDeploymentsClient) NewListBySubscriptionPager(options *AmfDeploymentsClientListBySubscriptionOptions) *runtime.Pager[AmfDeploymentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AmfDeploymentsClientListBySubscriptionResponse]{ + More: func(page AmfDeploymentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AmfDeploymentsClientListBySubscriptionResponse) (AmfDeploymentsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AmfDeploymentsClient.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 AmfDeploymentsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AmfDeploymentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AmfDeploymentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/amfDeployments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AmfDeploymentsClient) listBySubscriptionHandleResponse(resp *http.Response) (AmfDeploymentsClientListBySubscriptionResponse, error) { + result := AmfDeploymentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AmfDeploymentResourceListResult); err != nil { + return AmfDeploymentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a AmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - amfDeploymentName - The name of the AMF Deployment +// - properties - The resource properties to be updated. +// - options - AmfDeploymentsClientUpdateTagsOptions contains the optional parameters for the AmfDeploymentsClient.UpdateTags +// method. +func (client *AmfDeploymentsClient) UpdateTags(ctx context.Context, resourceGroupName string, amfDeploymentName string, properties AmfDeploymentResourceTagsUpdate, options *AmfDeploymentsClientUpdateTagsOptions) (AmfDeploymentsClientUpdateTagsResponse, error) { + var err error + const operationName = "AmfDeploymentsClient.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, amfDeploymentName, properties, options) + if err != nil { + return AmfDeploymentsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AmfDeploymentsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AmfDeploymentsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *AmfDeploymentsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, amfDeploymentName string, properties AmfDeploymentResourceTagsUpdate, options *AmfDeploymentsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/amfDeployments/{amfDeploymentName}" + 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 amfDeploymentName == "" { + return nil, errors.New("parameter amfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{amfDeploymentName}", url.PathEscape(amfDeploymentName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *AmfDeploymentsClient) updateTagsHandleResponse(resp *http.Response) (AmfDeploymentsClientUpdateTagsResponse, error) { + result := AmfDeploymentsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AmfDeploymentResource); err != nil { + return AmfDeploymentsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/autorest.md b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/autorest.md new file mode 100644 index 000000000000..d12d8eaf50ed --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/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/mobilepacketcore/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mobilepacketcore/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/mobilepacketcore/armmobilepacketcore/build.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/build.go new file mode 100644 index 000000000000..1d417de88e44 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/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/mobilepacketcore/armmobilepacketcore + +package armmobilepacketcore diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml new file mode 100644 index 000000000000..31ca3ed89071 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ci.yml @@ -0,0 +1,28 @@ +# 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/mobilepacketcore/armmobilepacketcore/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/mobilepacketcore/armmobilepacketcore' diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go new file mode 100644 index 000000000000..b1a24fdfbf40 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/client_factory.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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 +} + +// NewAmfDeploymentsClient creates a new instance of AmfDeploymentsClient. +func (c *ClientFactory) NewAmfDeploymentsClient() *AmfDeploymentsClient { + return &AmfDeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewClusterServicesClient creates a new instance of ClusterServicesClient. +func (c *ClientFactory) NewClusterServicesClient() *ClusterServicesClient { + return &ClusterServicesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewNrfDeploymentsClient creates a new instance of NrfDeploymentsClient. +func (c *ClientFactory) NewNrfDeploymentsClient() *NrfDeploymentsClient { + return &NrfDeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewNssfDeploymentsClient creates a new instance of NssfDeploymentsClient. +func (c *ClientFactory) NewNssfDeploymentsClient() *NssfDeploymentsClient { + return &NssfDeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewObservabilityServicesClient creates a new instance of ObservabilityServicesClient. +func (c *ClientFactory) NewObservabilityServicesClient() *ObservabilityServicesClient { + return &ObservabilityServicesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewSmfDeploymentsClient creates a new instance of SmfDeploymentsClient. +func (c *ClientFactory) NewSmfDeploymentsClient() *SmfDeploymentsClient { + return &SmfDeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpfDeploymentsClient creates a new instance of UpfDeploymentsClient. +func (c *ClientFactory) NewUpfDeploymentsClient() *UpfDeploymentsClient { + return &UpfDeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/clusterservices_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/clusterservices_client.go new file mode 100644 index 000000000000..e22dfa70262a --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/clusterservices_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// ClusterServicesClient contains the methods for the ClusterServices group. +// Don't use this type directly, use NewClusterServicesClient() instead. +type ClusterServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewClusterServicesClient creates a new instance of ClusterServicesClient 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 NewClusterServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClusterServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ClusterServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a ClusterServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterServiceName - The name of the Cluster Service +// - resource - Resource create parameters. +// - options - ClusterServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterServicesClient.BeginCreateOrUpdate +// method. +func (client *ClusterServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterServiceName string, resource ClusterServiceResource, options *ClusterServicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClusterServicesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterServiceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterServicesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClusterServicesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a ClusterServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *ClusterServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterServiceName string, resource ClusterServiceResource, options *ClusterServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ClusterServicesClient.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, clusterServiceName, 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 *ClusterServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterServiceName string, resource ClusterServiceResource, options *ClusterServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/clusterServices/{clusterServiceName}" + 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 clusterServiceName == "" { + return nil, errors.New("parameter clusterServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterServiceName}", url.PathEscape(clusterServiceName)) + 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-10-15-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 - Delete a ClusterServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterServiceName - The name of the Cluster Service +// - options - ClusterServicesClientBeginDeleteOptions contains the optional parameters for the ClusterServicesClient.BeginDelete +// method. +func (client *ClusterServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterServiceName string, options *ClusterServicesClientBeginDeleteOptions) (*runtime.Poller[ClusterServicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterServiceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterServicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClusterServicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a ClusterServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *ClusterServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterServiceName string, options *ClusterServicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ClusterServicesClient.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, clusterServiceName, 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 *ClusterServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterServiceName string, options *ClusterServicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/clusterServices/{clusterServiceName}" + 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 clusterServiceName == "" { + return nil, errors.New("parameter clusterServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterServiceName}", url.PathEscape(clusterServiceName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a ClusterServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterServiceName - The name of the Cluster Service +// - options - ClusterServicesClientGetOptions contains the optional parameters for the ClusterServicesClient.Get method. +func (client *ClusterServicesClient) Get(ctx context.Context, resourceGroupName string, clusterServiceName string, options *ClusterServicesClientGetOptions) (ClusterServicesClientGetResponse, error) { + var err error + const operationName = "ClusterServicesClient.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, clusterServiceName, options) + if err != nil { + return ClusterServicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClusterServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClusterServicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ClusterServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterServiceName string, options *ClusterServicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/clusterServices/{clusterServiceName}" + 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 clusterServiceName == "" { + return nil, errors.New("parameter clusterServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterServiceName}", url.PathEscape(clusterServiceName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ClusterServicesClient) getHandleResponse(resp *http.Response) (ClusterServicesClientGetResponse, error) { + result := ClusterServicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterServiceResource); err != nil { + return ClusterServicesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all Cluster Services by Resource Group. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ClusterServicesClientListByResourceGroupOptions contains the optional parameters for the ClusterServicesClient.NewListByResourceGroupPager +// method. +func (client *ClusterServicesClient) NewListByResourceGroupPager(resourceGroupName string, options *ClusterServicesClientListByResourceGroupOptions) *runtime.Pager[ClusterServicesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ClusterServicesClientListByResourceGroupResponse]{ + More: func(page ClusterServicesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClusterServicesClientListByResourceGroupResponse) (ClusterServicesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClusterServicesClient.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 ClusterServicesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ClusterServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClusterServicesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/clusterServices" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ClusterServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ClusterServicesClientListByResourceGroupResponse, error) { + result := ClusterServicesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterServiceResourceListResult); err != nil { + return ClusterServicesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all Cluster Services by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - ClusterServicesClientListBySubscriptionOptions contains the optional parameters for the ClusterServicesClient.NewListBySubscriptionPager +// method. +func (client *ClusterServicesClient) NewListBySubscriptionPager(options *ClusterServicesClientListBySubscriptionOptions) *runtime.Pager[ClusterServicesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ClusterServicesClientListBySubscriptionResponse]{ + More: func(page ClusterServicesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClusterServicesClientListBySubscriptionResponse) (ClusterServicesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClusterServicesClient.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 ClusterServicesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ClusterServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ClusterServicesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/clusterServices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ClusterServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (ClusterServicesClientListBySubscriptionResponse, error) { + result := ClusterServicesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterServiceResourceListResult); err != nil { + return ClusterServicesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a ClusterServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterServiceName - The name of the Cluster Service +// - properties - The resource properties to be updated. +// - options - ClusterServicesClientUpdateTagsOptions contains the optional parameters for the ClusterServicesClient.UpdateTags +// method. +func (client *ClusterServicesClient) UpdateTags(ctx context.Context, resourceGroupName string, clusterServiceName string, properties ClusterServiceResourceTagsUpdate, options *ClusterServicesClientUpdateTagsOptions) (ClusterServicesClientUpdateTagsResponse, error) { + var err error + const operationName = "ClusterServicesClient.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, clusterServiceName, properties, options) + if err != nil { + return ClusterServicesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClusterServicesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClusterServicesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ClusterServicesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, clusterServiceName string, properties ClusterServiceResourceTagsUpdate, options *ClusterServicesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/clusterServices/{clusterServiceName}" + 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 clusterServiceName == "" { + return nil, errors.New("parameter clusterServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterServiceName}", url.PathEscape(clusterServiceName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ClusterServicesClient) updateTagsHandleResponse(resp *http.Response) (ClusterServicesClientUpdateTagsResponse, error) { + result := ClusterServicesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterServiceResource); err != nil { + return ClusterServicesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go new file mode 100644 index 000000000000..3b3d022a8036 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/constants.go @@ -0,0 +1,136 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore" + 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, + } +} + +// ClusterType - Cluster Type Definitions +type ClusterType string + +const ( + // ClusterTypeAks - Azure Kubernetes Service + ClusterTypeAks ClusterType = "Aks" + // ClusterTypeNexusAks - Azure Operator Nexus Kubernetes Service + ClusterTypeNexusAks ClusterType = "NexusAks" +) + +// PossibleClusterTypeValues returns the possible values for the ClusterType const type. +func PossibleClusterTypeValues() []ClusterType { + return []ClusterType{ + ClusterTypeAks, + ClusterTypeNexusAks, + } +} + +// 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 - Provisioning state of the resource +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Resource has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource is getting deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Resource is getting provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Resource is updating + 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, + } +} + +// SKUDeploymentType - Deployment Type Definitions +type SKUDeploymentType string + +const ( + // SKUDeploymentTypeLab - Lab Deployment + SKUDeploymentTypeLab SKUDeploymentType = "Lab" + // SKUDeploymentTypeProduction - Production Deployment + SKUDeploymentTypeProduction SKUDeploymentType = "Production" +) + +// PossibleSKUDeploymentTypeValues returns the possible values for the SKUDeploymentType const type. +func PossibleSKUDeploymentTypeValues() []SKUDeploymentType { + return []SKUDeploymentType{ + SKUDeploymentTypeLab, + SKUDeploymentTypeProduction, + } +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/amfdeployments_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/amfdeployments_server.go new file mode 100644 index 000000000000..510a2d7c5257 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/amfdeployments_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// AmfDeploymentsServer is a fake server for instances of the armmobilepacketcore.AmfDeploymentsClient type. +type AmfDeploymentsServer struct { + // BeginCreateOrUpdate is the fake for method AmfDeploymentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, amfDeploymentName string, resource armmobilepacketcore.AmfDeploymentResource, options *armmobilepacketcore.AmfDeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.AmfDeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AmfDeploymentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *armmobilepacketcore.AmfDeploymentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.AmfDeploymentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AmfDeploymentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, amfDeploymentName string, options *armmobilepacketcore.AmfDeploymentsClientGetOptions) (resp azfake.Responder[armmobilepacketcore.AmfDeploymentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method AmfDeploymentsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.AmfDeploymentsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.AmfDeploymentsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method AmfDeploymentsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.AmfDeploymentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.AmfDeploymentsClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method AmfDeploymentsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, amfDeploymentName string, properties armmobilepacketcore.AmfDeploymentResourceTagsUpdate, options *armmobilepacketcore.AmfDeploymentsClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.AmfDeploymentsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewAmfDeploymentsServerTransport creates a new instance of AmfDeploymentsServerTransport with the provided implementation. +// The returned AmfDeploymentsServerTransport instance is connected to an instance of armmobilepacketcore.AmfDeploymentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAmfDeploymentsServerTransport(srv *AmfDeploymentsServer) *AmfDeploymentsServerTransport { + return &AmfDeploymentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.AmfDeploymentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.AmfDeploymentsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.AmfDeploymentsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.AmfDeploymentsClientListBySubscriptionResponse]](), + } +} + +// AmfDeploymentsServerTransport connects instances of armmobilepacketcore.AmfDeploymentsClient to instances of AmfDeploymentsServer. +// Don't use this type directly, use NewAmfDeploymentsServerTransport instead. +type AmfDeploymentsServerTransport struct { + srv *AmfDeploymentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.AmfDeploymentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.AmfDeploymentsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.AmfDeploymentsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.AmfDeploymentsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for AmfDeploymentsServerTransport. +func (a *AmfDeploymentsServerTransport) 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 "AmfDeploymentsClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AmfDeploymentsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AmfDeploymentsClient.Get": + resp, err = a.dispatchGet(req) + case "AmfDeploymentsClient.NewListByResourceGroupPager": + resp, err = a.dispatchNewListByResourceGroupPager(req) + case "AmfDeploymentsClient.NewListBySubscriptionPager": + resp, err = a.dispatchNewListBySubscriptionPager(req) + case "AmfDeploymentsClient.UpdateTags": + resp, err = a.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AmfDeploymentsServerTransport) 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\.MobilePacketCore/amfDeployments/(?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[armmobilepacketcore.AmfDeploymentResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + amfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("amfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, amfDeploymentNameParam, 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 *AmfDeploymentsServerTransport) 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\.MobilePacketCore/amfDeployments/(?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 + } + amfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("amfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, amfDeploymentNameParam, 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.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)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AmfDeploymentsServerTransport) 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\.MobilePacketCore/amfDeployments/(?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 + } + amfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("amfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, amfDeploymentNameParam, 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).AmfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AmfDeploymentsServerTransport) 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\.MobilePacketCore/amfDeployments` + 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 *armmobilepacketcore.AmfDeploymentsClientListByResourceGroupResponse, 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 *AmfDeploymentsServerTransport) 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\.MobilePacketCore/amfDeployments` + 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 *armmobilepacketcore.AmfDeploymentsClientListBySubscriptionResponse, 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 *AmfDeploymentsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if a.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\.MobilePacketCore/amfDeployments/(?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[armmobilepacketcore.AmfDeploymentResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + amfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("amfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.UpdateTags(req.Context(), resourceGroupNameParam, amfDeploymentNameParam, 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).AmfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/clusterservices_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/clusterservices_server.go new file mode 100644 index 000000000000..fdee3bd3e8b4 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/clusterservices_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// ClusterServicesServer is a fake server for instances of the armmobilepacketcore.ClusterServicesClient type. +type ClusterServicesServer struct { + // BeginCreateOrUpdate is the fake for method ClusterServicesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, clusterServiceName string, resource armmobilepacketcore.ClusterServiceResource, options *armmobilepacketcore.ClusterServicesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.ClusterServicesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ClusterServicesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterServiceName string, options *armmobilepacketcore.ClusterServicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.ClusterServicesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ClusterServicesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterServiceName string, options *armmobilepacketcore.ClusterServicesClientGetOptions) (resp azfake.Responder[armmobilepacketcore.ClusterServicesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ClusterServicesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.ClusterServicesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.ClusterServicesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ClusterServicesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.ClusterServicesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.ClusterServicesClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method ClusterServicesClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, clusterServiceName string, properties armmobilepacketcore.ClusterServiceResourceTagsUpdate, options *armmobilepacketcore.ClusterServicesClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.ClusterServicesClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewClusterServicesServerTransport creates a new instance of ClusterServicesServerTransport with the provided implementation. +// The returned ClusterServicesServerTransport instance is connected to an instance of armmobilepacketcore.ClusterServicesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewClusterServicesServerTransport(srv *ClusterServicesServer) *ClusterServicesServerTransport { + return &ClusterServicesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.ClusterServicesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.ClusterServicesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.ClusterServicesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.ClusterServicesClientListBySubscriptionResponse]](), + } +} + +// ClusterServicesServerTransport connects instances of armmobilepacketcore.ClusterServicesClient to instances of ClusterServicesServer. +// Don't use this type directly, use NewClusterServicesServerTransport instead. +type ClusterServicesServerTransport struct { + srv *ClusterServicesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.ClusterServicesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.ClusterServicesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.ClusterServicesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.ClusterServicesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for ClusterServicesServerTransport. +func (c *ClusterServicesServerTransport) 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 "ClusterServicesClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "ClusterServicesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ClusterServicesClient.Get": + resp, err = c.dispatchGet(req) + case "ClusterServicesClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "ClusterServicesClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "ClusterServicesClient.UpdateTags": + resp, err = c.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ClusterServicesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/clusterServices/(?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[armmobilepacketcore.ClusterServiceResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, clusterServiceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.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) { + c.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) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *ClusterServicesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/clusterServices/(?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 + } + clusterServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterServiceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ClusterServicesServerTransport) 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~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/clusterServices/(?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 + } + clusterServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, clusterServiceNameParam, 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).ClusterServiceResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClusterServicesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/clusterServices` + 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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmobilepacketcore.ClusterServicesClientListByResourceGroupResponse, 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) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *ClusterServicesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/clusterServices` + 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 := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmobilepacketcore.ClusterServicesClientListBySubscriptionResponse, 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) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *ClusterServicesServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if c.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\.MobilePacketCore/clusterServices/(?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[armmobilepacketcore.ClusterServiceResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.UpdateTags(req.Context(), resourceGroupNameParam, clusterServiceNameParam, 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).ClusterServiceResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/internal.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/mobilepacketcore/armmobilepacketcore/fake/nrfdeployments_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/nrfdeployments_server.go new file mode 100644 index 000000000000..3b3bb351aec6 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/nrfdeployments_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// NrfDeploymentsServer is a fake server for instances of the armmobilepacketcore.NrfDeploymentsClient type. +type NrfDeploymentsServer struct { + // BeginCreateOrUpdate is the fake for method NrfDeploymentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, nrfDeploymentName string, resource armmobilepacketcore.NrfDeploymentResource, options *armmobilepacketcore.NrfDeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.NrfDeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method NrfDeploymentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *armmobilepacketcore.NrfDeploymentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.NrfDeploymentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method NrfDeploymentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *armmobilepacketcore.NrfDeploymentsClientGetOptions) (resp azfake.Responder[armmobilepacketcore.NrfDeploymentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method NrfDeploymentsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.NrfDeploymentsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.NrfDeploymentsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method NrfDeploymentsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.NrfDeploymentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.NrfDeploymentsClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method NrfDeploymentsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, nrfDeploymentName string, properties armmobilepacketcore.NrfDeploymentResourceTagsUpdate, options *armmobilepacketcore.NrfDeploymentsClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.NrfDeploymentsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewNrfDeploymentsServerTransport creates a new instance of NrfDeploymentsServerTransport with the provided implementation. +// The returned NrfDeploymentsServerTransport instance is connected to an instance of armmobilepacketcore.NrfDeploymentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewNrfDeploymentsServerTransport(srv *NrfDeploymentsServer) *NrfDeploymentsServerTransport { + return &NrfDeploymentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.NrfDeploymentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.NrfDeploymentsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.NrfDeploymentsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.NrfDeploymentsClientListBySubscriptionResponse]](), + } +} + +// NrfDeploymentsServerTransport connects instances of armmobilepacketcore.NrfDeploymentsClient to instances of NrfDeploymentsServer. +// Don't use this type directly, use NewNrfDeploymentsServerTransport instead. +type NrfDeploymentsServerTransport struct { + srv *NrfDeploymentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.NrfDeploymentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.NrfDeploymentsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.NrfDeploymentsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.NrfDeploymentsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for NrfDeploymentsServerTransport. +func (n *NrfDeploymentsServerTransport) 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 "NrfDeploymentsClient.BeginCreateOrUpdate": + resp, err = n.dispatchBeginCreateOrUpdate(req) + case "NrfDeploymentsClient.BeginDelete": + resp, err = n.dispatchBeginDelete(req) + case "NrfDeploymentsClient.Get": + resp, err = n.dispatchGet(req) + case "NrfDeploymentsClient.NewListByResourceGroupPager": + resp, err = n.dispatchNewListByResourceGroupPager(req) + case "NrfDeploymentsClient.NewListBySubscriptionPager": + resp, err = n.dispatchNewListBySubscriptionPager(req) + case "NrfDeploymentsClient.UpdateTags": + resp, err = n.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (n *NrfDeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if n.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nrfDeployments/(?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[armmobilepacketcore.NrfDeploymentResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nrfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nrfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, nrfDeploymentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + n.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) { + n.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) { + n.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (n *NrfDeploymentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if n.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := n.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nrfDeployments/(?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 + } + nrfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nrfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginDelete(req.Context(), resourceGroupNameParam, nrfDeploymentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + n.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + n.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + n.beginDelete.remove(req) + } + + return resp, nil +} + +func (n *NrfDeploymentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/nrfDeployments/(?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 + } + nrfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nrfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, nrfDeploymentNameParam, 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).NrfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (n *NrfDeploymentsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := n.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nrfDeployments` + 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 := n.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + n.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmobilepacketcore.NrfDeploymentsClientListByResourceGroupResponse, 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) { + n.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + n.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (n *NrfDeploymentsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := n.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nrfDeployments` + 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 := n.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + n.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmobilepacketcore.NrfDeploymentsClientListBySubscriptionResponse, 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) { + n.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + n.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (n *NrfDeploymentsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/nrfDeployments/(?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[armmobilepacketcore.NrfDeploymentResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nrfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nrfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.UpdateTags(req.Context(), resourceGroupNameParam, nrfDeploymentNameParam, 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).NrfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/nssfdeployments_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/nssfdeployments_server.go new file mode 100644 index 000000000000..cb5076346bcf --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/nssfdeployments_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// NssfDeploymentsServer is a fake server for instances of the armmobilepacketcore.NssfDeploymentsClient type. +type NssfDeploymentsServer struct { + // BeginCreateOrUpdate is the fake for method NssfDeploymentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, nssfDeploymentName string, resource armmobilepacketcore.NssfDeploymentResource, options *armmobilepacketcore.NssfDeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.NssfDeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method NssfDeploymentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *armmobilepacketcore.NssfDeploymentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.NssfDeploymentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method NssfDeploymentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *armmobilepacketcore.NssfDeploymentsClientGetOptions) (resp azfake.Responder[armmobilepacketcore.NssfDeploymentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method NssfDeploymentsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.NssfDeploymentsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.NssfDeploymentsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method NssfDeploymentsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.NssfDeploymentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.NssfDeploymentsClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method NssfDeploymentsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, nssfDeploymentName string, properties armmobilepacketcore.NssfDeploymentResourceTagsUpdate, options *armmobilepacketcore.NssfDeploymentsClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.NssfDeploymentsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewNssfDeploymentsServerTransport creates a new instance of NssfDeploymentsServerTransport with the provided implementation. +// The returned NssfDeploymentsServerTransport instance is connected to an instance of armmobilepacketcore.NssfDeploymentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewNssfDeploymentsServerTransport(srv *NssfDeploymentsServer) *NssfDeploymentsServerTransport { + return &NssfDeploymentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.NssfDeploymentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.NssfDeploymentsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.NssfDeploymentsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.NssfDeploymentsClientListBySubscriptionResponse]](), + } +} + +// NssfDeploymentsServerTransport connects instances of armmobilepacketcore.NssfDeploymentsClient to instances of NssfDeploymentsServer. +// Don't use this type directly, use NewNssfDeploymentsServerTransport instead. +type NssfDeploymentsServerTransport struct { + srv *NssfDeploymentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.NssfDeploymentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.NssfDeploymentsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.NssfDeploymentsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.NssfDeploymentsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for NssfDeploymentsServerTransport. +func (n *NssfDeploymentsServerTransport) 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 "NssfDeploymentsClient.BeginCreateOrUpdate": + resp, err = n.dispatchBeginCreateOrUpdate(req) + case "NssfDeploymentsClient.BeginDelete": + resp, err = n.dispatchBeginDelete(req) + case "NssfDeploymentsClient.Get": + resp, err = n.dispatchGet(req) + case "NssfDeploymentsClient.NewListByResourceGroupPager": + resp, err = n.dispatchNewListByResourceGroupPager(req) + case "NssfDeploymentsClient.NewListBySubscriptionPager": + resp, err = n.dispatchNewListBySubscriptionPager(req) + case "NssfDeploymentsClient.UpdateTags": + resp, err = n.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (n *NssfDeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if n.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nssfDeployments/(?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[armmobilepacketcore.NssfDeploymentResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nssfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nssfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, nssfDeploymentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + n.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) { + n.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) { + n.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (n *NssfDeploymentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if n.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := n.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nssfDeployments/(?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 + } + nssfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nssfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginDelete(req.Context(), resourceGroupNameParam, nssfDeploymentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + n.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + n.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + n.beginDelete.remove(req) + } + + return resp, nil +} + +func (n *NssfDeploymentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/nssfDeployments/(?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 + } + nssfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nssfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, nssfDeploymentNameParam, 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).NssfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (n *NssfDeploymentsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := n.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nssfDeployments` + 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 := n.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + n.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmobilepacketcore.NssfDeploymentsClientListByResourceGroupResponse, 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) { + n.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + n.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (n *NssfDeploymentsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := n.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/nssfDeployments` + 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 := n.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + n.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmobilepacketcore.NssfDeploymentsClientListBySubscriptionResponse, 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) { + n.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + n.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (n *NssfDeploymentsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/nssfDeployments/(?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[armmobilepacketcore.NssfDeploymentResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nssfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nssfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.UpdateTags(req.Context(), resourceGroupNameParam, nssfDeploymentNameParam, 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).NssfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/observabilityservices_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/observabilityservices_server.go new file mode 100644 index 000000000000..534f5e2e8b26 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/observabilityservices_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// ObservabilityServicesServer is a fake server for instances of the armmobilepacketcore.ObservabilityServicesClient type. +type ObservabilityServicesServer struct { + // BeginCreateOrUpdate is the fake for method ObservabilityServicesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, observabilityServiceName string, resource armmobilepacketcore.ObservabilityServiceResource, options *armmobilepacketcore.ObservabilityServicesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.ObservabilityServicesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ObservabilityServicesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *armmobilepacketcore.ObservabilityServicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.ObservabilityServicesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ObservabilityServicesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *armmobilepacketcore.ObservabilityServicesClientGetOptions) (resp azfake.Responder[armmobilepacketcore.ObservabilityServicesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ObservabilityServicesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.ObservabilityServicesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.ObservabilityServicesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ObservabilityServicesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.ObservabilityServicesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.ObservabilityServicesClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method ObservabilityServicesClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, observabilityServiceName string, properties armmobilepacketcore.ObservabilityServiceResourceTagsUpdate, options *armmobilepacketcore.ObservabilityServicesClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.ObservabilityServicesClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewObservabilityServicesServerTransport creates a new instance of ObservabilityServicesServerTransport with the provided implementation. +// The returned ObservabilityServicesServerTransport instance is connected to an instance of armmobilepacketcore.ObservabilityServicesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewObservabilityServicesServerTransport(srv *ObservabilityServicesServer) *ObservabilityServicesServerTransport { + return &ObservabilityServicesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.ObservabilityServicesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.ObservabilityServicesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.ObservabilityServicesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.ObservabilityServicesClientListBySubscriptionResponse]](), + } +} + +// ObservabilityServicesServerTransport connects instances of armmobilepacketcore.ObservabilityServicesClient to instances of ObservabilityServicesServer. +// Don't use this type directly, use NewObservabilityServicesServerTransport instead. +type ObservabilityServicesServerTransport struct { + srv *ObservabilityServicesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.ObservabilityServicesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.ObservabilityServicesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.ObservabilityServicesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.ObservabilityServicesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for ObservabilityServicesServerTransport. +func (o *ObservabilityServicesServerTransport) 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 "ObservabilityServicesClient.BeginCreateOrUpdate": + resp, err = o.dispatchBeginCreateOrUpdate(req) + case "ObservabilityServicesClient.BeginDelete": + resp, err = o.dispatchBeginDelete(req) + case "ObservabilityServicesClient.Get": + resp, err = o.dispatchGet(req) + case "ObservabilityServicesClient.NewListByResourceGroupPager": + resp, err = o.dispatchNewListByResourceGroupPager(req) + case "ObservabilityServicesClient.NewListBySubscriptionPager": + resp, err = o.dispatchNewListBySubscriptionPager(req) + case "ObservabilityServicesClient.UpdateTags": + resp, err = o.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *ObservabilityServicesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if o.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := o.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/observabilityServices/(?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[armmobilepacketcore.ObservabilityServiceResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + observabilityServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("observabilityServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, observabilityServiceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + o.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) { + o.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) { + o.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (o *ObservabilityServicesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if o.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := o.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/observabilityServices/(?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 + } + observabilityServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("observabilityServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginDelete(req.Context(), resourceGroupNameParam, observabilityServiceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + o.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + o.beginDelete.remove(req) + } + + return resp, nil +} + +func (o *ObservabilityServicesServerTransport) 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\.MobilePacketCore/observabilityServices/(?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 + } + observabilityServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("observabilityServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, observabilityServiceNameParam, 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).ObservabilityServiceResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *ObservabilityServicesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := o.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/observabilityServices` + 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 := o.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + o.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmobilepacketcore.ObservabilityServicesClientListByResourceGroupResponse, 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) { + o.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + o.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (o *ObservabilityServicesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := o.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/observabilityServices` + 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 := o.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + o.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmobilepacketcore.ObservabilityServicesClientListBySubscriptionResponse, 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) { + o.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + o.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (o *ObservabilityServicesServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if o.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\.MobilePacketCore/observabilityServices/(?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[armmobilepacketcore.ObservabilityServiceResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + observabilityServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("observabilityServiceName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.UpdateTags(req.Context(), resourceGroupNameParam, observabilityServiceNameParam, 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).ObservabilityServiceResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/operations_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/operations_server.go new file mode 100644 index 000000000000..a9b180152452 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" +) + +// OperationsServer is a fake server for instances of the armmobilepacketcore.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armmobilepacketcore.OperationsClientListOptions) (resp azfake.PagerResponder[armmobilepacketcore.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armmobilepacketcore.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[armmobilepacketcore.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armmobilepacketcore.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armmobilepacketcore.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armmobilepacketcore.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 +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/server_factory.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/server_factory.go new file mode 100644 index 000000000000..90c74fc32a94 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/server_factory.go @@ -0,0 +1,124 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore.ClientFactory type. +type ServerFactory struct { + AmfDeploymentsServer AmfDeploymentsServer + ClusterServicesServer ClusterServicesServer + NrfDeploymentsServer NrfDeploymentsServer + NssfDeploymentsServer NssfDeploymentsServer + ObservabilityServicesServer ObservabilityServicesServer + OperationsServer OperationsServer + SmfDeploymentsServer SmfDeploymentsServer + UpfDeploymentsServer UpfDeploymentsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armmobilepacketcore.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 armmobilepacketcore.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAmfDeploymentsServer *AmfDeploymentsServerTransport + trClusterServicesServer *ClusterServicesServerTransport + trNrfDeploymentsServer *NrfDeploymentsServerTransport + trNssfDeploymentsServer *NssfDeploymentsServerTransport + trObservabilityServicesServer *ObservabilityServicesServerTransport + trOperationsServer *OperationsServerTransport + trSmfDeploymentsServer *SmfDeploymentsServerTransport + trUpfDeploymentsServer *UpfDeploymentsServerTransport +} + +// 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 "AmfDeploymentsClient": + initServer(s, &s.trAmfDeploymentsServer, func() *AmfDeploymentsServerTransport { + return NewAmfDeploymentsServerTransport(&s.srv.AmfDeploymentsServer) + }) + resp, err = s.trAmfDeploymentsServer.Do(req) + case "ClusterServicesClient": + initServer(s, &s.trClusterServicesServer, func() *ClusterServicesServerTransport { + return NewClusterServicesServerTransport(&s.srv.ClusterServicesServer) + }) + resp, err = s.trClusterServicesServer.Do(req) + case "NrfDeploymentsClient": + initServer(s, &s.trNrfDeploymentsServer, func() *NrfDeploymentsServerTransport { + return NewNrfDeploymentsServerTransport(&s.srv.NrfDeploymentsServer) + }) + resp, err = s.trNrfDeploymentsServer.Do(req) + case "NssfDeploymentsClient": + initServer(s, &s.trNssfDeploymentsServer, func() *NssfDeploymentsServerTransport { + return NewNssfDeploymentsServerTransport(&s.srv.NssfDeploymentsServer) + }) + resp, err = s.trNssfDeploymentsServer.Do(req) + case "ObservabilityServicesClient": + initServer(s, &s.trObservabilityServicesServer, func() *ObservabilityServicesServerTransport { + return NewObservabilityServicesServerTransport(&s.srv.ObservabilityServicesServer) + }) + resp, err = s.trObservabilityServicesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "SmfDeploymentsClient": + initServer(s, &s.trSmfDeploymentsServer, func() *SmfDeploymentsServerTransport { + return NewSmfDeploymentsServerTransport(&s.srv.SmfDeploymentsServer) + }) + resp, err = s.trSmfDeploymentsServer.Do(req) + case "UpfDeploymentsClient": + initServer(s, &s.trUpfDeploymentsServer, func() *UpfDeploymentsServerTransport { + return NewUpfDeploymentsServerTransport(&s.srv.UpfDeploymentsServer) + }) + resp, err = s.trUpfDeploymentsServer.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/mobilepacketcore/armmobilepacketcore/fake/smfdeployments_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/smfdeployments_server.go new file mode 100644 index 000000000000..0095f0ed80c1 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/smfdeployments_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// SmfDeploymentsServer is a fake server for instances of the armmobilepacketcore.SmfDeploymentsClient type. +type SmfDeploymentsServer struct { + // BeginCreateOrUpdate is the fake for method SmfDeploymentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, smfDeploymentName string, resource armmobilepacketcore.SmfDeploymentResource, options *armmobilepacketcore.SmfDeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.SmfDeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SmfDeploymentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *armmobilepacketcore.SmfDeploymentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.SmfDeploymentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SmfDeploymentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *armmobilepacketcore.SmfDeploymentsClientGetOptions) (resp azfake.Responder[armmobilepacketcore.SmfDeploymentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SmfDeploymentsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.SmfDeploymentsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.SmfDeploymentsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SmfDeploymentsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.SmfDeploymentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.SmfDeploymentsClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method SmfDeploymentsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, smfDeploymentName string, properties armmobilepacketcore.SmfDeploymentResourceTagsUpdate, options *armmobilepacketcore.SmfDeploymentsClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.SmfDeploymentsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewSmfDeploymentsServerTransport creates a new instance of SmfDeploymentsServerTransport with the provided implementation. +// The returned SmfDeploymentsServerTransport instance is connected to an instance of armmobilepacketcore.SmfDeploymentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSmfDeploymentsServerTransport(srv *SmfDeploymentsServer) *SmfDeploymentsServerTransport { + return &SmfDeploymentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.SmfDeploymentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.SmfDeploymentsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.SmfDeploymentsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.SmfDeploymentsClientListBySubscriptionResponse]](), + } +} + +// SmfDeploymentsServerTransport connects instances of armmobilepacketcore.SmfDeploymentsClient to instances of SmfDeploymentsServer. +// Don't use this type directly, use NewSmfDeploymentsServerTransport instead. +type SmfDeploymentsServerTransport struct { + srv *SmfDeploymentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.SmfDeploymentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.SmfDeploymentsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.SmfDeploymentsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.SmfDeploymentsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for SmfDeploymentsServerTransport. +func (s *SmfDeploymentsServerTransport) 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 "SmfDeploymentsClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SmfDeploymentsClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SmfDeploymentsClient.Get": + resp, err = s.dispatchGet(req) + case "SmfDeploymentsClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SmfDeploymentsClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "SmfDeploymentsClient.UpdateTags": + resp, err = s.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SmfDeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/smfDeployments/(?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[armmobilepacketcore.SmfDeploymentResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + smfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("smfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, smfDeploymentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.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) { + s.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) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SmfDeploymentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/smfDeployments/(?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 + } + smfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("smfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, smfDeploymentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SmfDeploymentsServerTransport) 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\.MobilePacketCore/smfDeployments/(?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 + } + smfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("smfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, smfDeploymentNameParam, 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).SmfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SmfDeploymentsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/smfDeployments` + 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 := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmobilepacketcore.SmfDeploymentsClientListByResourceGroupResponse, 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) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SmfDeploymentsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/smfDeployments` + 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 := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmobilepacketcore.SmfDeploymentsClientListBySubscriptionResponse, 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) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SmfDeploymentsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if s.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\.MobilePacketCore/smfDeployments/(?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[armmobilepacketcore.SmfDeploymentResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + smfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("smfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.UpdateTags(req.Context(), resourceGroupNameParam, smfDeploymentNameParam, 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).SmfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/time_rfc3339.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore/fake/upfdeployments_server.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/upfdeployments_server.go new file mode 100644 index 000000000000..966690d92d71 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/fake/upfdeployments_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mobilepacketcore/armmobilepacketcore" + "net/http" + "net/url" + "regexp" +) + +// UpfDeploymentsServer is a fake server for instances of the armmobilepacketcore.UpfDeploymentsClient type. +type UpfDeploymentsServer struct { + // BeginCreateOrUpdate is the fake for method UpfDeploymentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, upfDeploymentName string, resource armmobilepacketcore.UpfDeploymentResource, options *armmobilepacketcore.UpfDeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmobilepacketcore.UpfDeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method UpfDeploymentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *armmobilepacketcore.UpfDeploymentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmobilepacketcore.UpfDeploymentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpfDeploymentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *armmobilepacketcore.UpfDeploymentsClientGetOptions) (resp azfake.Responder[armmobilepacketcore.UpfDeploymentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method UpfDeploymentsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmobilepacketcore.UpfDeploymentsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmobilepacketcore.UpfDeploymentsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method UpfDeploymentsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmobilepacketcore.UpfDeploymentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmobilepacketcore.UpfDeploymentsClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method UpfDeploymentsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, upfDeploymentName string, properties armmobilepacketcore.UpfDeploymentResourceTagsUpdate, options *armmobilepacketcore.UpfDeploymentsClientUpdateTagsOptions) (resp azfake.Responder[armmobilepacketcore.UpfDeploymentsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewUpfDeploymentsServerTransport creates a new instance of UpfDeploymentsServerTransport with the provided implementation. +// The returned UpfDeploymentsServerTransport instance is connected to an instance of armmobilepacketcore.UpfDeploymentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpfDeploymentsServerTransport(srv *UpfDeploymentsServer) *UpfDeploymentsServerTransport { + return &UpfDeploymentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmobilepacketcore.UpfDeploymentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmobilepacketcore.UpfDeploymentsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmobilepacketcore.UpfDeploymentsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmobilepacketcore.UpfDeploymentsClientListBySubscriptionResponse]](), + } +} + +// UpfDeploymentsServerTransport connects instances of armmobilepacketcore.UpfDeploymentsClient to instances of UpfDeploymentsServer. +// Don't use this type directly, use NewUpfDeploymentsServerTransport instead. +type UpfDeploymentsServerTransport struct { + srv *UpfDeploymentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmobilepacketcore.UpfDeploymentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmobilepacketcore.UpfDeploymentsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmobilepacketcore.UpfDeploymentsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmobilepacketcore.UpfDeploymentsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for UpfDeploymentsServerTransport. +func (u *UpfDeploymentsServerTransport) 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 "UpfDeploymentsClient.BeginCreateOrUpdate": + resp, err = u.dispatchBeginCreateOrUpdate(req) + case "UpfDeploymentsClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpfDeploymentsClient.Get": + resp, err = u.dispatchGet(req) + case "UpfDeploymentsClient.NewListByResourceGroupPager": + resp, err = u.dispatchNewListByResourceGroupPager(req) + case "UpfDeploymentsClient.NewListBySubscriptionPager": + resp, err = u.dispatchNewListBySubscriptionPager(req) + case "UpfDeploymentsClient.UpdateTags": + resp, err = u.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpfDeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if u.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := u.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/upfDeployments/(?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[armmobilepacketcore.UpfDeploymentResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + upfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("upfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, upfDeploymentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + u.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) { + u.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) { + u.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (u *UpfDeploymentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/upfDeployments/(?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 + } + upfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("upfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, upfDeploymentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + u.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpfDeploymentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.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\.MobilePacketCore/upfDeployments/(?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 + } + upfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("upfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, upfDeploymentNameParam, 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).UpfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpfDeploymentsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := u.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/upfDeployments` + 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 := u.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + u.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmobilepacketcore.UpfDeploymentsClientListByResourceGroupResponse, 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) { + u.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + u.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (u *UpfDeploymentsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := u.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/upfDeployments` + 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 := u.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + u.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmobilepacketcore.UpfDeploymentsClientListBySubscriptionResponse, 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) { + u.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + u.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (u *UpfDeploymentsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if u.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\.MobilePacketCore/upfDeployments/(?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[armmobilepacketcore.UpfDeploymentResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + upfDeploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("upfDeploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.UpdateTags(req.Context(), resourceGroupNameParam, upfDeploymentNameParam, 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).UpfDeploymentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod new file mode 100644 index 000000000000..1e2385bcc8b9 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/interfaces.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/interfaces.go new file mode 100644 index 000000000000..299022f0452b --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/interfaces.go @@ -0,0 +1,18 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +// ClusterServiceClusterTypeSpecificDataClassification provides polymorphic access to related types. +// Call the interface's GetClusterServiceClusterTypeSpecificData() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ClusterServiceAksClusterData, *ClusterServiceClusterTypeSpecificData, *ClusterServiceNexusAksClusterData +type ClusterServiceClusterTypeSpecificDataClassification interface { + // GetClusterServiceClusterTypeSpecificData returns the ClusterServiceClusterTypeSpecificData content of the underlying type. + GetClusterServiceClusterTypeSpecificData() *ClusterServiceClusterTypeSpecificData +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go new file mode 100644 index 000000000000..9ecdfdf7f1be --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models.go @@ -0,0 +1,571 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +import "time" + +// AmfDeploymentResource - Azure for Operators 5G Core Access and Mobility Function (AMF) Deployment Resource +type AmfDeploymentResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *AmfDeploymentResourceProperties + + // 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 +} + +// AmfDeploymentResourceListResult - The response of a AmfDeploymentResource list operation. +type AmfDeploymentResourceListResult struct { + // REQUIRED; The AmfDeploymentResource items on this page + Value []*AmfDeploymentResource + + // The link to the next page of items + NextLink *string +} + +// AmfDeploymentResourceProperties - AMF Deployment Properties. +type AmfDeploymentResourceProperties struct { + // REQUIRED; Reference to cluster where the Network Function is deployed + ClusterService *string + + // Azure for Operators 5G Core AMF component parameters + ComponentParameters *string + + // Azure for Operators 5G Core AMF secrets parameters + SecretsParameters *string + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release version. This is inherited from the cluster + ReleaseVersion *string +} + +// AmfDeploymentResourceTagsUpdate - The type used for updating tags in AmfDeploymentResource resources. +type AmfDeploymentResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// ClusterServiceAksClusterData - AKS Cluster specific data. +type ClusterServiceAksClusterData struct { + // REQUIRED; Custom Location resource ID + CustomLocationID *string + + // REQUIRED; Cluster Type + Type *ClusterType +} + +// GetClusterServiceClusterTypeSpecificData implements the ClusterServiceClusterTypeSpecificDataClassification interface for +// type ClusterServiceAksClusterData. +func (c *ClusterServiceAksClusterData) GetClusterServiceClusterTypeSpecificData() *ClusterServiceClusterTypeSpecificData { + return &ClusterServiceClusterTypeSpecificData{ + CustomLocationID: c.CustomLocationID, + Type: c.Type, + } +} + +// ClusterServiceClusterTypeSpecificData - Cluster Service cluster type specific data. +type ClusterServiceClusterTypeSpecificData struct { + // REQUIRED; Custom Location resource ID + CustomLocationID *string + + // REQUIRED; Cluster Type + Type *ClusterType +} + +// GetClusterServiceClusterTypeSpecificData implements the ClusterServiceClusterTypeSpecificDataClassification interface for +// type ClusterServiceClusterTypeSpecificData. +func (c *ClusterServiceClusterTypeSpecificData) GetClusterServiceClusterTypeSpecificData() *ClusterServiceClusterTypeSpecificData { + return c +} + +// ClusterServiceNexusAksClusterData - Nexus AKS Cluster specific data. +type ClusterServiceNexusAksClusterData struct { + // REQUIRED; Custom Location resource ID + CustomLocationID *string + + // REQUIRED; Cluster Type + Type *ClusterType +} + +// GetClusterServiceClusterTypeSpecificData implements the ClusterServiceClusterTypeSpecificDataClassification interface for +// type ClusterServiceNexusAksClusterData. +func (c *ClusterServiceNexusAksClusterData) GetClusterServiceClusterTypeSpecificData() *ClusterServiceClusterTypeSpecificData { + return &ClusterServiceClusterTypeSpecificData{ + CustomLocationID: c.CustomLocationID, + Type: c.Type, + } +} + +// ClusterServiceResource - Azure for Operators 5G Core Cluster Service Resource +type ClusterServiceResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *ClusterServiceResourceProperties + + // 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 +} + +// ClusterServiceResourceListResult - The response of a ClusterServiceResource list operation. +type ClusterServiceResourceListResult struct { + // REQUIRED; The ClusterServiceResource items on this page + Value []*ClusterServiceResource + + // The link to the next page of items + NextLink *string +} + +// ClusterServiceResourceProperties - Cluster Service Properties. +type ClusterServiceResourceProperties struct { + // REQUIRED; Cluster type specific data. Contents depend on the cluster type + ClusterTypeSpecificData ClusterServiceClusterTypeSpecificDataClassification + + // REQUIRED; Azure for Operators 5G Core Local PaaS component parameters. One set per component type + ComponentParameters []*QualifiedComponentDeploymentParameters + + // REQUIRED; Cluster type (Lab or Production) + DeploymentType *SKUDeploymentType + + // REQUIRED; Azure for Operators 5G Core Release Version. This is applied to all platform as a service (PaaS) components and + // running workloads in this cluster + ReleaseVersion *string + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// ClusterServiceResourceTagsUpdate - The type used for updating tags in ClusterServiceResource resources. +type ClusterServiceResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// NrfDeploymentResource - Azure for Operators 5G Core Network Repository Function (NRF) Deployment Resource +type NrfDeploymentResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *NrfDeploymentResourceProperties + + // 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 +} + +// NrfDeploymentResourceListResult - The response of a NrfDeploymentResource list operation. +type NrfDeploymentResourceListResult struct { + // REQUIRED; The NrfDeploymentResource items on this page + Value []*NrfDeploymentResource + + // The link to the next page of items + NextLink *string +} + +// NrfDeploymentResourceProperties - NRF Deployment Properties. +type NrfDeploymentResourceProperties struct { + // REQUIRED; Reference to cluster where the Network Function is deployed + ClusterService *string + + // Azure for Operators 5G Core NRF component parameters + ComponentParameters *string + + // Azure for Operators 5G Core NRF secrets parameters + SecretsParameters *string + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release version. This is inherited from the cluster + ReleaseVersion *string +} + +// NrfDeploymentResourceTagsUpdate - The type used for updating tags in NrfDeploymentResource resources. +type NrfDeploymentResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// NssfDeploymentResource - Azure for Operators 5G Core Network Slice Selection Function (NSSF) Deployment Resource +type NssfDeploymentResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *NssfDeploymentResourceProperties + + // 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 +} + +// NssfDeploymentResourceListResult - The response of a NssfDeploymentResource list operation. +type NssfDeploymentResourceListResult struct { + // REQUIRED; The NssfDeploymentResource items on this page + Value []*NssfDeploymentResource + + // The link to the next page of items + NextLink *string +} + +// NssfDeploymentResourceProperties - NSSF Deployment Properties. +type NssfDeploymentResourceProperties struct { + // REQUIRED; Reference to cluster where the Network Function is deployed + ClusterService *string + + // Azure for Operators 5G Core NSSF component parameters + ComponentParameters *string + + // Azure for Operators 5G Core NSSF secrets parameters + SecretsParameters *string + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release version. This is inherited from the cluster + ReleaseVersion *string +} + +// NssfDeploymentResourceTagsUpdate - The type used for updating tags in NssfDeploymentResource resources. +type NssfDeploymentResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// ObservabilityServiceResource - Azure for Operators 5G Core Observability Service Resource +type ObservabilityServiceResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *ObservabilityServiceResourceProperties + + // 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 +} + +// ObservabilityServiceResourceListResult - The response of a ObservabilityServiceResource list operation. +type ObservabilityServiceResourceListResult struct { + // REQUIRED; The ObservabilityServiceResource items on this page + Value []*ObservabilityServiceResource + + // The link to the next page of items + NextLink *string +} + +// ObservabilityServiceResourceProperties - Observability Service Properties. +type ObservabilityServiceResourceProperties struct { + // REQUIRED; Reference to cluster where the observability components are deployed + ClusterService *string + + // REQUIRED; Azure for Operators 5G Core Observability component parameters. One set per component type + ComponentParameters []*QualifiedComponentDeploymentParameters + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release version. This is inherited from the cluster + ReleaseVersion *string +} + +// ObservabilityServiceResourceTagsUpdate - The type used for updating tags in ObservabilityServiceResource resources. +type ObservabilityServiceResourceTagsUpdate 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 +} + +// OperationalStatus - Operational Status of the resource +type OperationalStatus struct { + // READ-ONLY; Health check results + HealthCheck *string + + // READ-ONLY; Status of the deployed workload + Workload *string +} + +// QualifiedComponentDeploymentParameters - Containerized Network Function (CNF) Qualified Deployment Parameters +type QualifiedComponentDeploymentParameters struct { + // REQUIRED; Federation Type + Type *string + + // Deployment Parameters + Parameters *string + + // Deployment secrets + Secrets *string +} + +// SmfDeploymentResource - Azure for Operators 5G Core Session Management Function (SMF) Deployment Resource +type SmfDeploymentResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SmfDeploymentResourceProperties + + // 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 +} + +// SmfDeploymentResourceListResult - The response of a SmfDeploymentResource list operation. +type SmfDeploymentResourceListResult struct { + // REQUIRED; The SmfDeploymentResource items on this page + Value []*SmfDeploymentResource + + // The link to the next page of items + NextLink *string +} + +// SmfDeploymentResourceProperties - SMF Deployment Properties. +type SmfDeploymentResourceProperties struct { + // REQUIRED; Reference to cluster where the Network Function is deployed + ClusterService *string + + // Azure for Operators 5G Core SMF component parameters + ComponentParameters *string + + // Azure for Operators 5G Core SMF secrets parameters + SecretsParameters *string + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release version. This is inherited from the cluster + ReleaseVersion *string +} + +// SmfDeploymentResourceTagsUpdate - The type used for updating tags in SmfDeploymentResource resources. +type SmfDeploymentResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*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 +} + +// UpfDeploymentResource - Azure for Operators 5G Core User Plane Function (UPF) Deployment Resource +type UpfDeploymentResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *UpfDeploymentResourceProperties + + // 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 +} + +// UpfDeploymentResourceListResult - The response of a UpfDeploymentResource list operation. +type UpfDeploymentResourceListResult struct { + // REQUIRED; The UpfDeploymentResource items on this page + Value []*UpfDeploymentResource + + // The link to the next page of items + NextLink *string +} + +// UpfDeploymentResourceProperties - UPF Deployment Properties. +type UpfDeploymentResourceProperties struct { + // REQUIRED; Reference to cluster where the Network Function is deployed + ClusterService *string + + // REQUIRED; Azure for Operators 5G Core UPF component parameters + ComponentParameters *string + + // Azure for Operators 5G Core F secrets parameters + SecretsParameters *string + + // READ-ONLY; Operational status + OperationalStatus *OperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release version. This is inherited from the cluster + ReleaseVersion *string +} + +// UpfDeploymentResourceTagsUpdate - The type used for updating tags in UpfDeploymentResource resources. +type UpfDeploymentResourceTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go new file mode 100644 index 000000000000..83129d523448 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/models_serde.go @@ -0,0 +1,1443 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AmfDeploymentResource. +func (a AmfDeploymentResource) 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 AmfDeploymentResource. +func (a *AmfDeploymentResource) UnmarshalJSON(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 AmfDeploymentResourceListResult. +func (a AmfDeploymentResourceListResult) 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 AmfDeploymentResourceListResult. +func (a *AmfDeploymentResourceListResult) UnmarshalJSON(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 AmfDeploymentResourceProperties. +func (a AmfDeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterService", a.ClusterService) + populate(objectMap, "componentParameters", a.ComponentParameters) + populate(objectMap, "operationalStatus", a.OperationalStatus) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "releaseVersion", a.ReleaseVersion) + populate(objectMap, "secretsParameters", a.SecretsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AmfDeploymentResourceProperties. +func (a *AmfDeploymentResourceProperties) UnmarshalJSON(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 "clusterService": + err = unpopulate(val, "ClusterService", &a.ClusterService) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &a.ComponentParameters) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &a.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &a.ReleaseVersion) + delete(rawMsg, key) + case "secretsParameters": + err = unpopulate(val, "SecretsParameters", &a.SecretsParameters) + 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 AmfDeploymentResourceTagsUpdate. +func (a AmfDeploymentResourceTagsUpdate) 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 AmfDeploymentResourceTagsUpdate. +func (a *AmfDeploymentResourceTagsUpdate) UnmarshalJSON(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 ClusterServiceAksClusterData. +func (c ClusterServiceAksClusterData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customLocationId", c.CustomLocationID) + objectMap["type"] = ClusterTypeAks + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceAksClusterData. +func (c *ClusterServiceAksClusterData) UnmarshalJSON(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 "customLocationId": + err = unpopulate(val, "CustomLocationID", &c.CustomLocationID) + 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 ClusterServiceClusterTypeSpecificData. +func (c ClusterServiceClusterTypeSpecificData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customLocationId", c.CustomLocationID) + objectMap["type"] = c.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceClusterTypeSpecificData. +func (c *ClusterServiceClusterTypeSpecificData) UnmarshalJSON(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 "customLocationId": + err = unpopulate(val, "CustomLocationID", &c.CustomLocationID) + 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 ClusterServiceNexusAksClusterData. +func (c ClusterServiceNexusAksClusterData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customLocationId", c.CustomLocationID) + objectMap["type"] = ClusterTypeNexusAks + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceNexusAksClusterData. +func (c *ClusterServiceNexusAksClusterData) UnmarshalJSON(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 "customLocationId": + err = unpopulate(val, "CustomLocationID", &c.CustomLocationID) + 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 ClusterServiceResource. +func (c ClusterServiceResource) 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) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceResource. +func (c *ClusterServiceResource) UnmarshalJSON(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 "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) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 ClusterServiceResourceListResult. +func (c ClusterServiceResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceResourceListResult. +func (c *ClusterServiceResourceListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 ClusterServiceResourceProperties. +func (c ClusterServiceResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterTypeSpecificData", c.ClusterTypeSpecificData) + populate(objectMap, "componentParameters", c.ComponentParameters) + populate(objectMap, "deploymentType", c.DeploymentType) + populate(objectMap, "operationalStatus", c.OperationalStatus) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "releaseVersion", c.ReleaseVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceResourceProperties. +func (c *ClusterServiceResourceProperties) UnmarshalJSON(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 "clusterTypeSpecificData": + c.ClusterTypeSpecificData, err = unmarshalClusterServiceClusterTypeSpecificDataClassification(val) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &c.ComponentParameters) + delete(rawMsg, key) + case "deploymentType": + err = unpopulate(val, "DeploymentType", &c.DeploymentType) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &c.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &c.ReleaseVersion) + 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 ClusterServiceResourceTagsUpdate. +func (c ClusterServiceResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServiceResourceTagsUpdate. +func (c *ClusterServiceResourceTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 NrfDeploymentResource. +func (n NrfDeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrfDeploymentResource. +func (n *NrfDeploymentResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NrfDeploymentResourceListResult. +func (n NrfDeploymentResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrfDeploymentResourceListResult. +func (n *NrfDeploymentResourceListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + 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 NrfDeploymentResourceProperties. +func (n NrfDeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterService", n.ClusterService) + populate(objectMap, "componentParameters", n.ComponentParameters) + populate(objectMap, "operationalStatus", n.OperationalStatus) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "releaseVersion", n.ReleaseVersion) + populate(objectMap, "secretsParameters", n.SecretsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrfDeploymentResourceProperties. +func (n *NrfDeploymentResourceProperties) UnmarshalJSON(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 "clusterService": + err = unpopulate(val, "ClusterService", &n.ClusterService) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &n.ComponentParameters) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &n.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &n.ReleaseVersion) + delete(rawMsg, key) + case "secretsParameters": + err = unpopulate(val, "SecretsParameters", &n.SecretsParameters) + 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 NrfDeploymentResourceTagsUpdate. +func (n NrfDeploymentResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrfDeploymentResourceTagsUpdate. +func (n *NrfDeploymentResourceTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &n.Tags) + 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 NssfDeploymentResource. +func (n NssfDeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NssfDeploymentResource. +func (n *NssfDeploymentResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NssfDeploymentResourceListResult. +func (n NssfDeploymentResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NssfDeploymentResourceListResult. +func (n *NssfDeploymentResourceListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + 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 NssfDeploymentResourceProperties. +func (n NssfDeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterService", n.ClusterService) + populate(objectMap, "componentParameters", n.ComponentParameters) + populate(objectMap, "operationalStatus", n.OperationalStatus) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "releaseVersion", n.ReleaseVersion) + populate(objectMap, "secretsParameters", n.SecretsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NssfDeploymentResourceProperties. +func (n *NssfDeploymentResourceProperties) UnmarshalJSON(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 "clusterService": + err = unpopulate(val, "ClusterService", &n.ClusterService) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &n.ComponentParameters) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &n.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &n.ReleaseVersion) + delete(rawMsg, key) + case "secretsParameters": + err = unpopulate(val, "SecretsParameters", &n.SecretsParameters) + 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 NssfDeploymentResourceTagsUpdate. +func (n NssfDeploymentResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NssfDeploymentResourceTagsUpdate. +func (n *NssfDeploymentResourceTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &n.Tags) + 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 ObservabilityServiceResource. +func (o ObservabilityServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "location", o.Location) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "tags", o.Tags) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObservabilityServiceResource. +func (o *ObservabilityServiceResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &o.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &o.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + 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 ObservabilityServiceResourceListResult. +func (o ObservabilityServiceResourceListResult) 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 ObservabilityServiceResourceListResult. +func (o *ObservabilityServiceResourceListResult) UnmarshalJSON(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 ObservabilityServiceResourceProperties. +func (o ObservabilityServiceResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterService", o.ClusterService) + populate(objectMap, "componentParameters", o.ComponentParameters) + populate(objectMap, "operationalStatus", o.OperationalStatus) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "releaseVersion", o.ReleaseVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObservabilityServiceResourceProperties. +func (o *ObservabilityServiceResourceProperties) UnmarshalJSON(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 "clusterService": + err = unpopulate(val, "ClusterService", &o.ClusterService) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &o.ComponentParameters) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &o.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &o.ReleaseVersion) + 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 ObservabilityServiceResourceTagsUpdate. +func (o ObservabilityServiceResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", o.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObservabilityServiceResourceTagsUpdate. +func (o *ObservabilityServiceResourceTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &o.Tags) + 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 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 OperationalStatus. +func (o OperationalStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "healthCheck", o.HealthCheck) + populate(objectMap, "workload", o.Workload) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationalStatus. +func (o *OperationalStatus) UnmarshalJSON(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 "healthCheck": + err = unpopulate(val, "HealthCheck", &o.HealthCheck) + delete(rawMsg, key) + case "workload": + err = unpopulate(val, "Workload", &o.Workload) + 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 QualifiedComponentDeploymentParameters. +func (q QualifiedComponentDeploymentParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "parameters", q.Parameters) + populate(objectMap, "secrets", q.Secrets) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QualifiedComponentDeploymentParameters. +func (q *QualifiedComponentDeploymentParameters) UnmarshalJSON(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) + } + for key, val := range rawMsg { + var err error + switch key { + case "parameters": + err = unpopulate(val, "Parameters", &q.Parameters) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &q.Secrets) + 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) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SmfDeploymentResource. +func (s SmfDeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + 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 SmfDeploymentResource. +func (s *SmfDeploymentResource) UnmarshalJSON(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 "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 SmfDeploymentResourceListResult. +func (s SmfDeploymentResourceListResult) 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 SmfDeploymentResourceListResult. +func (s *SmfDeploymentResourceListResult) UnmarshalJSON(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 SmfDeploymentResourceProperties. +func (s SmfDeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterService", s.ClusterService) + populate(objectMap, "componentParameters", s.ComponentParameters) + populate(objectMap, "operationalStatus", s.OperationalStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "releaseVersion", s.ReleaseVersion) + populate(objectMap, "secretsParameters", s.SecretsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SmfDeploymentResourceProperties. +func (s *SmfDeploymentResourceProperties) UnmarshalJSON(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 "clusterService": + err = unpopulate(val, "ClusterService", &s.ClusterService) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &s.ComponentParameters) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &s.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &s.ReleaseVersion) + delete(rawMsg, key) + case "secretsParameters": + err = unpopulate(val, "SecretsParameters", &s.SecretsParameters) + 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 SmfDeploymentResourceTagsUpdate. +func (s SmfDeploymentResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SmfDeploymentResourceTagsUpdate. +func (s *SmfDeploymentResourceTagsUpdate) UnmarshalJSON(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 "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 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 UpfDeploymentResource. +func (u UpfDeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "tags", u.Tags) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpfDeploymentResource. +func (u *UpfDeploymentResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + 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 UpfDeploymentResourceListResult. +func (u UpfDeploymentResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpfDeploymentResourceListResult. +func (u *UpfDeploymentResourceListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + 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 UpfDeploymentResourceProperties. +func (u UpfDeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterService", u.ClusterService) + populate(objectMap, "componentParameters", u.ComponentParameters) + populate(objectMap, "operationalStatus", u.OperationalStatus) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "releaseVersion", u.ReleaseVersion) + populate(objectMap, "secretsParameters", u.SecretsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpfDeploymentResourceProperties. +func (u *UpfDeploymentResourceProperties) UnmarshalJSON(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 "clusterService": + err = unpopulate(val, "ClusterService", &u.ClusterService) + delete(rawMsg, key) + case "componentParameters": + err = unpopulate(val, "ComponentParameters", &u.ComponentParameters) + delete(rawMsg, key) + case "operationalStatus": + err = unpopulate(val, "OperationalStatus", &u.OperationalStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "releaseVersion": + err = unpopulate(val, "ReleaseVersion", &u.ReleaseVersion) + delete(rawMsg, key) + case "secretsParameters": + err = unpopulate(val, "SecretsParameters", &u.SecretsParameters) + 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 UpfDeploymentResourceTagsUpdate. +func (u UpfDeploymentResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpfDeploymentResourceTagsUpdate. +func (u *UpfDeploymentResourceTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &u.Tags) + 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 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/mobilepacketcore/armmobilepacketcore/nrfdeployments_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/nrfdeployments_client.go new file mode 100644 index 000000000000..e568033f2f70 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/nrfdeployments_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// NrfDeploymentsClient contains the methods for the NrfDeployments group. +// Don't use this type directly, use NewNrfDeploymentsClient() instead. +type NrfDeploymentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNrfDeploymentsClient creates a new instance of NrfDeploymentsClient 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 NewNrfDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NrfDeploymentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NrfDeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a NrfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nrfDeploymentName - The name of the NrfDeployment +// - resource - Resource create parameters. +// - options - NrfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the NrfDeploymentsClient.BeginCreateOrUpdate +// method. +func (client *NrfDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, nrfDeploymentName string, resource NrfDeploymentResource, options *NrfDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NrfDeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, nrfDeploymentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NrfDeploymentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NrfDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a NrfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *NrfDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, nrfDeploymentName string, resource NrfDeploymentResource, options *NrfDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "NrfDeploymentsClient.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, nrfDeploymentName, 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 *NrfDeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, nrfDeploymentName string, resource NrfDeploymentResource, options *NrfDeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nrfDeployments/{nrfDeploymentName}" + 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 nrfDeploymentName == "" { + return nil, errors.New("parameter nrfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nrfDeploymentName}", url.PathEscape(nrfDeploymentName)) + 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-10-15-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 - Delete a NrfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nrfDeploymentName - The name of the NrfDeployment +// - options - NrfDeploymentsClientBeginDeleteOptions contains the optional parameters for the NrfDeploymentsClient.BeginDelete +// method. +func (client *NrfDeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *NrfDeploymentsClientBeginDeleteOptions) (*runtime.Poller[NrfDeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, nrfDeploymentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NrfDeploymentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NrfDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a NrfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *NrfDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *NrfDeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "NrfDeploymentsClient.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, nrfDeploymentName, 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 *NrfDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *NrfDeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nrfDeployments/{nrfDeploymentName}" + 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 nrfDeploymentName == "" { + return nil, errors.New("parameter nrfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nrfDeploymentName}", url.PathEscape(nrfDeploymentName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a NrfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nrfDeploymentName - The name of the NrfDeployment +// - options - NrfDeploymentsClientGetOptions contains the optional parameters for the NrfDeploymentsClient.Get method. +func (client *NrfDeploymentsClient) Get(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *NrfDeploymentsClientGetOptions) (NrfDeploymentsClientGetResponse, error) { + var err error + const operationName = "NrfDeploymentsClient.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, nrfDeploymentName, options) + if err != nil { + return NrfDeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NrfDeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NrfDeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NrfDeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, nrfDeploymentName string, options *NrfDeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nrfDeployments/{nrfDeploymentName}" + 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 nrfDeploymentName == "" { + return nil, errors.New("parameter nrfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nrfDeploymentName}", url.PathEscape(nrfDeploymentName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NrfDeploymentsClient) getHandleResponse(resp *http.Response) (NrfDeploymentsClientGetResponse, error) { + result := NrfDeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NrfDeploymentResource); err != nil { + return NrfDeploymentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all Network Repository Function Deployments by Resource Group. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - NrfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the NrfDeploymentsClient.NewListByResourceGroupPager +// method. +func (client *NrfDeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *NrfDeploymentsClientListByResourceGroupOptions) *runtime.Pager[NrfDeploymentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[NrfDeploymentsClientListByResourceGroupResponse]{ + More: func(page NrfDeploymentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NrfDeploymentsClientListByResourceGroupResponse) (NrfDeploymentsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NrfDeploymentsClient.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 NrfDeploymentsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *NrfDeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NrfDeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nrfDeployments" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *NrfDeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (NrfDeploymentsClientListByResourceGroupResponse, error) { + result := NrfDeploymentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NrfDeploymentResourceListResult); err != nil { + return NrfDeploymentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all Network Repository Function Deployments by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - NrfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the NrfDeploymentsClient.NewListBySubscriptionPager +// method. +func (client *NrfDeploymentsClient) NewListBySubscriptionPager(options *NrfDeploymentsClientListBySubscriptionOptions) *runtime.Pager[NrfDeploymentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[NrfDeploymentsClientListBySubscriptionResponse]{ + More: func(page NrfDeploymentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NrfDeploymentsClientListBySubscriptionResponse) (NrfDeploymentsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NrfDeploymentsClient.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 NrfDeploymentsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *NrfDeploymentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *NrfDeploymentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/nrfDeployments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *NrfDeploymentsClient) listBySubscriptionHandleResponse(resp *http.Response) (NrfDeploymentsClientListBySubscriptionResponse, error) { + result := NrfDeploymentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NrfDeploymentResourceListResult); err != nil { + return NrfDeploymentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a NrfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nrfDeploymentName - The name of the NrfDeployment +// - properties - The resource properties to be updated. +// - options - NrfDeploymentsClientUpdateTagsOptions contains the optional parameters for the NrfDeploymentsClient.UpdateTags +// method. +func (client *NrfDeploymentsClient) UpdateTags(ctx context.Context, resourceGroupName string, nrfDeploymentName string, properties NrfDeploymentResourceTagsUpdate, options *NrfDeploymentsClientUpdateTagsOptions) (NrfDeploymentsClientUpdateTagsResponse, error) { + var err error + const operationName = "NrfDeploymentsClient.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, nrfDeploymentName, properties, options) + if err != nil { + return NrfDeploymentsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NrfDeploymentsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NrfDeploymentsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *NrfDeploymentsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, nrfDeploymentName string, properties NrfDeploymentResourceTagsUpdate, options *NrfDeploymentsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nrfDeployments/{nrfDeploymentName}" + 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 nrfDeploymentName == "" { + return nil, errors.New("parameter nrfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nrfDeploymentName}", url.PathEscape(nrfDeploymentName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *NrfDeploymentsClient) updateTagsHandleResponse(resp *http.Response) (NrfDeploymentsClientUpdateTagsResponse, error) { + result := NrfDeploymentsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NrfDeploymentResource); err != nil { + return NrfDeploymentsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/nssfdeployments_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/nssfdeployments_client.go new file mode 100644 index 000000000000..f7f70dc789c6 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/nssfdeployments_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// NssfDeploymentsClient contains the methods for the NssfDeployments group. +// Don't use this type directly, use NewNssfDeploymentsClient() instead. +type NssfDeploymentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNssfDeploymentsClient creates a new instance of NssfDeploymentsClient 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 NewNssfDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NssfDeploymentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NssfDeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a NssfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nssfDeploymentName - The name of the NssfDeployment +// - resource - Resource create parameters. +// - options - NssfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the NssfDeploymentsClient.BeginCreateOrUpdate +// method. +func (client *NssfDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, nssfDeploymentName string, resource NssfDeploymentResource, options *NssfDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NssfDeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, nssfDeploymentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NssfDeploymentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NssfDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a NssfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *NssfDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, nssfDeploymentName string, resource NssfDeploymentResource, options *NssfDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "NssfDeploymentsClient.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, nssfDeploymentName, 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 *NssfDeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, nssfDeploymentName string, resource NssfDeploymentResource, options *NssfDeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nssfDeployments/{nssfDeploymentName}" + 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 nssfDeploymentName == "" { + return nil, errors.New("parameter nssfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nssfDeploymentName}", url.PathEscape(nssfDeploymentName)) + 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-10-15-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 - Delete a NssfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nssfDeploymentName - The name of the NssfDeployment +// - options - NssfDeploymentsClientBeginDeleteOptions contains the optional parameters for the NssfDeploymentsClient.BeginDelete +// method. +func (client *NssfDeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *NssfDeploymentsClientBeginDeleteOptions) (*runtime.Poller[NssfDeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, nssfDeploymentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NssfDeploymentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NssfDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a NssfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *NssfDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *NssfDeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "NssfDeploymentsClient.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, nssfDeploymentName, 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 *NssfDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *NssfDeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nssfDeployments/{nssfDeploymentName}" + 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 nssfDeploymentName == "" { + return nil, errors.New("parameter nssfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nssfDeploymentName}", url.PathEscape(nssfDeploymentName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a NssfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nssfDeploymentName - The name of the NssfDeployment +// - options - NssfDeploymentsClientGetOptions contains the optional parameters for the NssfDeploymentsClient.Get method. +func (client *NssfDeploymentsClient) Get(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *NssfDeploymentsClientGetOptions) (NssfDeploymentsClientGetResponse, error) { + var err error + const operationName = "NssfDeploymentsClient.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, nssfDeploymentName, options) + if err != nil { + return NssfDeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NssfDeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NssfDeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NssfDeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, nssfDeploymentName string, options *NssfDeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nssfDeployments/{nssfDeploymentName}" + 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 nssfDeploymentName == "" { + return nil, errors.New("parameter nssfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nssfDeploymentName}", url.PathEscape(nssfDeploymentName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NssfDeploymentsClient) getHandleResponse(resp *http.Response) (NssfDeploymentsClientGetResponse, error) { + result := NssfDeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NssfDeploymentResource); err != nil { + return NssfDeploymentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all Network Slice Selection Function Deployments by Resource Group. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - NssfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the NssfDeploymentsClient.NewListByResourceGroupPager +// method. +func (client *NssfDeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *NssfDeploymentsClientListByResourceGroupOptions) *runtime.Pager[NssfDeploymentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[NssfDeploymentsClientListByResourceGroupResponse]{ + More: func(page NssfDeploymentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NssfDeploymentsClientListByResourceGroupResponse) (NssfDeploymentsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NssfDeploymentsClient.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 NssfDeploymentsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *NssfDeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NssfDeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nssfDeployments" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *NssfDeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (NssfDeploymentsClientListByResourceGroupResponse, error) { + result := NssfDeploymentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NssfDeploymentResourceListResult); err != nil { + return NssfDeploymentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all Network Slice Selection Function Deployments by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - NssfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the NssfDeploymentsClient.NewListBySubscriptionPager +// method. +func (client *NssfDeploymentsClient) NewListBySubscriptionPager(options *NssfDeploymentsClientListBySubscriptionOptions) *runtime.Pager[NssfDeploymentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[NssfDeploymentsClientListBySubscriptionResponse]{ + More: func(page NssfDeploymentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NssfDeploymentsClientListBySubscriptionResponse) (NssfDeploymentsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NssfDeploymentsClient.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 NssfDeploymentsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *NssfDeploymentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *NssfDeploymentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/nssfDeployments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *NssfDeploymentsClient) listBySubscriptionHandleResponse(resp *http.Response) (NssfDeploymentsClientListBySubscriptionResponse, error) { + result := NssfDeploymentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NssfDeploymentResourceListResult); err != nil { + return NssfDeploymentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a NssfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - nssfDeploymentName - The name of the NssfDeployment +// - properties - The resource properties to be updated. +// - options - NssfDeploymentsClientUpdateTagsOptions contains the optional parameters for the NssfDeploymentsClient.UpdateTags +// method. +func (client *NssfDeploymentsClient) UpdateTags(ctx context.Context, resourceGroupName string, nssfDeploymentName string, properties NssfDeploymentResourceTagsUpdate, options *NssfDeploymentsClientUpdateTagsOptions) (NssfDeploymentsClientUpdateTagsResponse, error) { + var err error + const operationName = "NssfDeploymentsClient.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, nssfDeploymentName, properties, options) + if err != nil { + return NssfDeploymentsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NssfDeploymentsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NssfDeploymentsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *NssfDeploymentsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, nssfDeploymentName string, properties NssfDeploymentResourceTagsUpdate, options *NssfDeploymentsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/nssfDeployments/{nssfDeploymentName}" + 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 nssfDeploymentName == "" { + return nil, errors.New("parameter nssfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nssfDeploymentName}", url.PathEscape(nssfDeploymentName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *NssfDeploymentsClient) updateTagsHandleResponse(resp *http.Response) (NssfDeploymentsClientUpdateTagsResponse, error) { + result := NssfDeploymentsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NssfDeploymentResource); err != nil { + return NssfDeploymentsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/observabilityservices_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/observabilityservices_client.go new file mode 100644 index 000000000000..9dfcaab0ef9b --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/observabilityservices_client.go @@ -0,0 +1,451 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// ObservabilityServicesClient contains the methods for the ObservabilityServices group. +// Don't use this type directly, use NewObservabilityServicesClient() instead. +type ObservabilityServicesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewObservabilityServicesClient creates a new instance of ObservabilityServicesClient 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 NewObservabilityServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ObservabilityServicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ObservabilityServicesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a ObservabilityServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - observabilityServiceName - The name of the Observability Service +// - resource - Resource create parameters. +// - options - ObservabilityServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ObservabilityServicesClient.BeginCreateOrUpdate +// method. +func (client *ObservabilityServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, observabilityServiceName string, resource ObservabilityServiceResource, options *ObservabilityServicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ObservabilityServicesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, observabilityServiceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ObservabilityServicesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ObservabilityServicesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a ObservabilityServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *ObservabilityServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, observabilityServiceName string, resource ObservabilityServiceResource, options *ObservabilityServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ObservabilityServicesClient.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, observabilityServiceName, 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 *ObservabilityServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, observabilityServiceName string, resource ObservabilityServiceResource, options *ObservabilityServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/observabilityServices/{observabilityServiceName}" + 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 observabilityServiceName == "" { + return nil, errors.New("parameter observabilityServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{observabilityServiceName}", url.PathEscape(observabilityServiceName)) + 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-10-15-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 - Delete a ObservabilityServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - observabilityServiceName - The name of the Observability Service +// - options - ObservabilityServicesClientBeginDeleteOptions contains the optional parameters for the ObservabilityServicesClient.BeginDelete +// method. +func (client *ObservabilityServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *ObservabilityServicesClientBeginDeleteOptions) (*runtime.Poller[ObservabilityServicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, observabilityServiceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ObservabilityServicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ObservabilityServicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a ObservabilityServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *ObservabilityServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *ObservabilityServicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ObservabilityServicesClient.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, observabilityServiceName, 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 *ObservabilityServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *ObservabilityServicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/observabilityServices/{observabilityServiceName}" + 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 observabilityServiceName == "" { + return nil, errors.New("parameter observabilityServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{observabilityServiceName}", url.PathEscape(observabilityServiceName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a ObservabilityServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - observabilityServiceName - The name of the Observability Service +// - options - ObservabilityServicesClientGetOptions contains the optional parameters for the ObservabilityServicesClient.Get +// method. +func (client *ObservabilityServicesClient) Get(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *ObservabilityServicesClientGetOptions) (ObservabilityServicesClientGetResponse, error) { + var err error + const operationName = "ObservabilityServicesClient.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, observabilityServiceName, options) + if err != nil { + return ObservabilityServicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ObservabilityServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ObservabilityServicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ObservabilityServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, observabilityServiceName string, options *ObservabilityServicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/observabilityServices/{observabilityServiceName}" + 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 observabilityServiceName == "" { + return nil, errors.New("parameter observabilityServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{observabilityServiceName}", url.PathEscape(observabilityServiceName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ObservabilityServicesClient) getHandleResponse(resp *http.Response) (ObservabilityServicesClientGetResponse, error) { + result := ObservabilityServicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObservabilityServiceResource); err != nil { + return ObservabilityServicesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all Observability Services by Resource Group. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ObservabilityServicesClientListByResourceGroupOptions contains the optional parameters for the ObservabilityServicesClient.NewListByResourceGroupPager +// method. +func (client *ObservabilityServicesClient) NewListByResourceGroupPager(resourceGroupName string, options *ObservabilityServicesClientListByResourceGroupOptions) *runtime.Pager[ObservabilityServicesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ObservabilityServicesClientListByResourceGroupResponse]{ + More: func(page ObservabilityServicesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ObservabilityServicesClientListByResourceGroupResponse) (ObservabilityServicesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ObservabilityServicesClient.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 ObservabilityServicesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ObservabilityServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ObservabilityServicesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/observabilityServices" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ObservabilityServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ObservabilityServicesClientListByResourceGroupResponse, error) { + result := ObservabilityServicesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObservabilityServiceResourceListResult); err != nil { + return ObservabilityServicesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all Observability Services by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - ObservabilityServicesClientListBySubscriptionOptions contains the optional parameters for the ObservabilityServicesClient.NewListBySubscriptionPager +// method. +func (client *ObservabilityServicesClient) NewListBySubscriptionPager(options *ObservabilityServicesClientListBySubscriptionOptions) *runtime.Pager[ObservabilityServicesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ObservabilityServicesClientListBySubscriptionResponse]{ + More: func(page ObservabilityServicesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ObservabilityServicesClientListBySubscriptionResponse) (ObservabilityServicesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ObservabilityServicesClient.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 ObservabilityServicesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ObservabilityServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ObservabilityServicesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/observabilityServices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ObservabilityServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (ObservabilityServicesClientListBySubscriptionResponse, error) { + result := ObservabilityServicesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObservabilityServiceResourceListResult); err != nil { + return ObservabilityServicesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a ObservabilityServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - observabilityServiceName - The name of the Observability Service +// - properties - The resource properties to be updated. +// - options - ObservabilityServicesClientUpdateTagsOptions contains the optional parameters for the ObservabilityServicesClient.UpdateTags +// method. +func (client *ObservabilityServicesClient) UpdateTags(ctx context.Context, resourceGroupName string, observabilityServiceName string, properties ObservabilityServiceResourceTagsUpdate, options *ObservabilityServicesClientUpdateTagsOptions) (ObservabilityServicesClientUpdateTagsResponse, error) { + var err error + const operationName = "ObservabilityServicesClient.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, observabilityServiceName, properties, options) + if err != nil { + return ObservabilityServicesClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ObservabilityServicesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ObservabilityServicesClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ObservabilityServicesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, observabilityServiceName string, properties ObservabilityServiceResourceTagsUpdate, options *ObservabilityServicesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/observabilityServices/{observabilityServiceName}" + 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 observabilityServiceName == "" { + return nil, errors.New("parameter observabilityServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{observabilityServiceName}", url.PathEscape(observabilityServiceName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ObservabilityServicesClient) updateTagsHandleResponse(resp *http.Response) (ObservabilityServicesClientUpdateTagsResponse, error) { + result := ObservabilityServicesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ObservabilityServiceResource); err != nil { + return ObservabilityServicesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go new file mode 100644 index 000000000000..2407df5a973f --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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 2023-10-15-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + 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.MobilePacketCore/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-15-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/mobilepacketcore/armmobilepacketcore/options.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/options.go new file mode 100644 index 000000000000..8df64f1f318f --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/options.go @@ -0,0 +1,261 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +// AmfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the AmfDeploymentsClient.BeginCreateOrUpdate +// method. +type AmfDeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AmfDeploymentsClientBeginDeleteOptions contains the optional parameters for the AmfDeploymentsClient.BeginDelete method. +type AmfDeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AmfDeploymentsClientGetOptions contains the optional parameters for the AmfDeploymentsClient.Get method. +type AmfDeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AmfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the AmfDeploymentsClient.NewListByResourceGroupPager +// method. +type AmfDeploymentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AmfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the AmfDeploymentsClient.NewListBySubscriptionPager +// method. +type AmfDeploymentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AmfDeploymentsClientUpdateTagsOptions contains the optional parameters for the AmfDeploymentsClient.UpdateTags method. +type AmfDeploymentsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ClusterServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterServicesClient.BeginCreateOrUpdate +// method. +type ClusterServicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterServicesClientBeginDeleteOptions contains the optional parameters for the ClusterServicesClient.BeginDelete method. +type ClusterServicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterServicesClientGetOptions contains the optional parameters for the ClusterServicesClient.Get method. +type ClusterServicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClusterServicesClientListByResourceGroupOptions contains the optional parameters for the ClusterServicesClient.NewListByResourceGroupPager +// method. +type ClusterServicesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClusterServicesClientListBySubscriptionOptions contains the optional parameters for the ClusterServicesClient.NewListBySubscriptionPager +// method. +type ClusterServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClusterServicesClientUpdateTagsOptions contains the optional parameters for the ClusterServicesClient.UpdateTags method. +type ClusterServicesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// NrfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the NrfDeploymentsClient.BeginCreateOrUpdate +// method. +type NrfDeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NrfDeploymentsClientBeginDeleteOptions contains the optional parameters for the NrfDeploymentsClient.BeginDelete method. +type NrfDeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NrfDeploymentsClientGetOptions contains the optional parameters for the NrfDeploymentsClient.Get method. +type NrfDeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NrfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the NrfDeploymentsClient.NewListByResourceGroupPager +// method. +type NrfDeploymentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// NrfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the NrfDeploymentsClient.NewListBySubscriptionPager +// method. +type NrfDeploymentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// NrfDeploymentsClientUpdateTagsOptions contains the optional parameters for the NrfDeploymentsClient.UpdateTags method. +type NrfDeploymentsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// NssfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the NssfDeploymentsClient.BeginCreateOrUpdate +// method. +type NssfDeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NssfDeploymentsClientBeginDeleteOptions contains the optional parameters for the NssfDeploymentsClient.BeginDelete method. +type NssfDeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NssfDeploymentsClientGetOptions contains the optional parameters for the NssfDeploymentsClient.Get method. +type NssfDeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NssfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the NssfDeploymentsClient.NewListByResourceGroupPager +// method. +type NssfDeploymentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// NssfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the NssfDeploymentsClient.NewListBySubscriptionPager +// method. +type NssfDeploymentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// NssfDeploymentsClientUpdateTagsOptions contains the optional parameters for the NssfDeploymentsClient.UpdateTags method. +type NssfDeploymentsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ObservabilityServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ObservabilityServicesClient.BeginCreateOrUpdate +// method. +type ObservabilityServicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ObservabilityServicesClientBeginDeleteOptions contains the optional parameters for the ObservabilityServicesClient.BeginDelete +// method. +type ObservabilityServicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ObservabilityServicesClientGetOptions contains the optional parameters for the ObservabilityServicesClient.Get method. +type ObservabilityServicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ObservabilityServicesClientListByResourceGroupOptions contains the optional parameters for the ObservabilityServicesClient.NewListByResourceGroupPager +// method. +type ObservabilityServicesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ObservabilityServicesClientListBySubscriptionOptions contains the optional parameters for the ObservabilityServicesClient.NewListBySubscriptionPager +// method. +type ObservabilityServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ObservabilityServicesClientUpdateTagsOptions contains the optional parameters for the ObservabilityServicesClient.UpdateTags +// method. +type ObservabilityServicesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SmfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the SmfDeploymentsClient.BeginCreateOrUpdate +// method. +type SmfDeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SmfDeploymentsClientBeginDeleteOptions contains the optional parameters for the SmfDeploymentsClient.BeginDelete method. +type SmfDeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SmfDeploymentsClientGetOptions contains the optional parameters for the SmfDeploymentsClient.Get method. +type SmfDeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SmfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the SmfDeploymentsClient.NewListByResourceGroupPager +// method. +type SmfDeploymentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SmfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the SmfDeploymentsClient.NewListBySubscriptionPager +// method. +type SmfDeploymentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SmfDeploymentsClientUpdateTagsOptions contains the optional parameters for the SmfDeploymentsClient.UpdateTags method. +type SmfDeploymentsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// UpfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the UpfDeploymentsClient.BeginCreateOrUpdate +// method. +type UpfDeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpfDeploymentsClientBeginDeleteOptions contains the optional parameters for the UpfDeploymentsClient.BeginDelete method. +type UpfDeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpfDeploymentsClientGetOptions contains the optional parameters for the UpfDeploymentsClient.Get method. +type UpfDeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the UpfDeploymentsClient.NewListByResourceGroupPager +// method. +type UpfDeploymentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// UpfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the UpfDeploymentsClient.NewListBySubscriptionPager +// method. +type UpfDeploymentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// UpfDeploymentsClientUpdateTagsOptions contains the optional parameters for the UpfDeploymentsClient.UpdateTags method. +type UpfDeploymentsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/polymorphic_helpers.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/polymorphic_helpers.go new file mode 100644 index 000000000000..598b7f01e61d --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/polymorphic_helpers.go @@ -0,0 +1,34 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +import "encoding/json" + +func unmarshalClusterServiceClusterTypeSpecificDataClassification(rawMsg json.RawMessage) (ClusterServiceClusterTypeSpecificDataClassification, 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 ClusterServiceClusterTypeSpecificDataClassification + switch m["type"] { + case string(ClusterTypeAks): + b = &ClusterServiceAksClusterData{} + case string(ClusterTypeNexusAks): + b = &ClusterServiceNexusAksClusterData{} + default: + b = &ClusterServiceClusterTypeSpecificData{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/responses.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/responses.go new file mode 100644 index 000000000000..a227f1d69e01 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/responses.go @@ -0,0 +1,260 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +// AmfDeploymentsClientCreateOrUpdateResponse contains the response from method AmfDeploymentsClient.BeginCreateOrUpdate. +type AmfDeploymentsClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core Access and Mobility Function (AMF) Deployment Resource + AmfDeploymentResource +} + +// AmfDeploymentsClientDeleteResponse contains the response from method AmfDeploymentsClient.BeginDelete. +type AmfDeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// AmfDeploymentsClientGetResponse contains the response from method AmfDeploymentsClient.Get. +type AmfDeploymentsClientGetResponse struct { + // Azure for Operators 5G Core Access and Mobility Function (AMF) Deployment Resource + AmfDeploymentResource +} + +// AmfDeploymentsClientListByResourceGroupResponse contains the response from method AmfDeploymentsClient.NewListByResourceGroupPager. +type AmfDeploymentsClientListByResourceGroupResponse struct { + // The response of a AmfDeploymentResource list operation. + AmfDeploymentResourceListResult +} + +// AmfDeploymentsClientListBySubscriptionResponse contains the response from method AmfDeploymentsClient.NewListBySubscriptionPager. +type AmfDeploymentsClientListBySubscriptionResponse struct { + // The response of a AmfDeploymentResource list operation. + AmfDeploymentResourceListResult +} + +// AmfDeploymentsClientUpdateTagsResponse contains the response from method AmfDeploymentsClient.UpdateTags. +type AmfDeploymentsClientUpdateTagsResponse struct { + // Azure for Operators 5G Core Access and Mobility Function (AMF) Deployment Resource + AmfDeploymentResource +} + +// ClusterServicesClientCreateOrUpdateResponse contains the response from method ClusterServicesClient.BeginCreateOrUpdate. +type ClusterServicesClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core Cluster Service Resource + ClusterServiceResource +} + +// ClusterServicesClientDeleteResponse contains the response from method ClusterServicesClient.BeginDelete. +type ClusterServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// ClusterServicesClientGetResponse contains the response from method ClusterServicesClient.Get. +type ClusterServicesClientGetResponse struct { + // Azure for Operators 5G Core Cluster Service Resource + ClusterServiceResource +} + +// ClusterServicesClientListByResourceGroupResponse contains the response from method ClusterServicesClient.NewListByResourceGroupPager. +type ClusterServicesClientListByResourceGroupResponse struct { + // The response of a ClusterServiceResource list operation. + ClusterServiceResourceListResult +} + +// ClusterServicesClientListBySubscriptionResponse contains the response from method ClusterServicesClient.NewListBySubscriptionPager. +type ClusterServicesClientListBySubscriptionResponse struct { + // The response of a ClusterServiceResource list operation. + ClusterServiceResourceListResult +} + +// ClusterServicesClientUpdateTagsResponse contains the response from method ClusterServicesClient.UpdateTags. +type ClusterServicesClientUpdateTagsResponse struct { + // Azure for Operators 5G Core Cluster Service Resource + ClusterServiceResource +} + +// NrfDeploymentsClientCreateOrUpdateResponse contains the response from method NrfDeploymentsClient.BeginCreateOrUpdate. +type NrfDeploymentsClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core Network Repository Function (NRF) Deployment Resource + NrfDeploymentResource +} + +// NrfDeploymentsClientDeleteResponse contains the response from method NrfDeploymentsClient.BeginDelete. +type NrfDeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// NrfDeploymentsClientGetResponse contains the response from method NrfDeploymentsClient.Get. +type NrfDeploymentsClientGetResponse struct { + // Azure for Operators 5G Core Network Repository Function (NRF) Deployment Resource + NrfDeploymentResource +} + +// NrfDeploymentsClientListByResourceGroupResponse contains the response from method NrfDeploymentsClient.NewListByResourceGroupPager. +type NrfDeploymentsClientListByResourceGroupResponse struct { + // The response of a NrfDeploymentResource list operation. + NrfDeploymentResourceListResult +} + +// NrfDeploymentsClientListBySubscriptionResponse contains the response from method NrfDeploymentsClient.NewListBySubscriptionPager. +type NrfDeploymentsClientListBySubscriptionResponse struct { + // The response of a NrfDeploymentResource list operation. + NrfDeploymentResourceListResult +} + +// NrfDeploymentsClientUpdateTagsResponse contains the response from method NrfDeploymentsClient.UpdateTags. +type NrfDeploymentsClientUpdateTagsResponse struct { + // Azure for Operators 5G Core Network Repository Function (NRF) Deployment Resource + NrfDeploymentResource +} + +// NssfDeploymentsClientCreateOrUpdateResponse contains the response from method NssfDeploymentsClient.BeginCreateOrUpdate. +type NssfDeploymentsClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core Network Slice Selection Function (NSSF) Deployment Resource + NssfDeploymentResource +} + +// NssfDeploymentsClientDeleteResponse contains the response from method NssfDeploymentsClient.BeginDelete. +type NssfDeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// NssfDeploymentsClientGetResponse contains the response from method NssfDeploymentsClient.Get. +type NssfDeploymentsClientGetResponse struct { + // Azure for Operators 5G Core Network Slice Selection Function (NSSF) Deployment Resource + NssfDeploymentResource +} + +// NssfDeploymentsClientListByResourceGroupResponse contains the response from method NssfDeploymentsClient.NewListByResourceGroupPager. +type NssfDeploymentsClientListByResourceGroupResponse struct { + // The response of a NssfDeploymentResource list operation. + NssfDeploymentResourceListResult +} + +// NssfDeploymentsClientListBySubscriptionResponse contains the response from method NssfDeploymentsClient.NewListBySubscriptionPager. +type NssfDeploymentsClientListBySubscriptionResponse struct { + // The response of a NssfDeploymentResource list operation. + NssfDeploymentResourceListResult +} + +// NssfDeploymentsClientUpdateTagsResponse contains the response from method NssfDeploymentsClient.UpdateTags. +type NssfDeploymentsClientUpdateTagsResponse struct { + // Azure for Operators 5G Core Network Slice Selection Function (NSSF) Deployment Resource + NssfDeploymentResource +} + +// ObservabilityServicesClientCreateOrUpdateResponse contains the response from method ObservabilityServicesClient.BeginCreateOrUpdate. +type ObservabilityServicesClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core Observability Service Resource + ObservabilityServiceResource +} + +// ObservabilityServicesClientDeleteResponse contains the response from method ObservabilityServicesClient.BeginDelete. +type ObservabilityServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// ObservabilityServicesClientGetResponse contains the response from method ObservabilityServicesClient.Get. +type ObservabilityServicesClientGetResponse struct { + // Azure for Operators 5G Core Observability Service Resource + ObservabilityServiceResource +} + +// ObservabilityServicesClientListByResourceGroupResponse contains the response from method ObservabilityServicesClient.NewListByResourceGroupPager. +type ObservabilityServicesClientListByResourceGroupResponse struct { + // The response of a ObservabilityServiceResource list operation. + ObservabilityServiceResourceListResult +} + +// ObservabilityServicesClientListBySubscriptionResponse contains the response from method ObservabilityServicesClient.NewListBySubscriptionPager. +type ObservabilityServicesClientListBySubscriptionResponse struct { + // The response of a ObservabilityServiceResource list operation. + ObservabilityServiceResourceListResult +} + +// ObservabilityServicesClientUpdateTagsResponse contains the response from method ObservabilityServicesClient.UpdateTags. +type ObservabilityServicesClientUpdateTagsResponse struct { + // Azure for Operators 5G Core Observability Service Resource + ObservabilityServiceResource +} + +// 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 +} + +// SmfDeploymentsClientCreateOrUpdateResponse contains the response from method SmfDeploymentsClient.BeginCreateOrUpdate. +type SmfDeploymentsClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core Session Management Function (SMF) Deployment Resource + SmfDeploymentResource +} + +// SmfDeploymentsClientDeleteResponse contains the response from method SmfDeploymentsClient.BeginDelete. +type SmfDeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// SmfDeploymentsClientGetResponse contains the response from method SmfDeploymentsClient.Get. +type SmfDeploymentsClientGetResponse struct { + // Azure for Operators 5G Core Session Management Function (SMF) Deployment Resource + SmfDeploymentResource +} + +// SmfDeploymentsClientListByResourceGroupResponse contains the response from method SmfDeploymentsClient.NewListByResourceGroupPager. +type SmfDeploymentsClientListByResourceGroupResponse struct { + // The response of a SmfDeploymentResource list operation. + SmfDeploymentResourceListResult +} + +// SmfDeploymentsClientListBySubscriptionResponse contains the response from method SmfDeploymentsClient.NewListBySubscriptionPager. +type SmfDeploymentsClientListBySubscriptionResponse struct { + // The response of a SmfDeploymentResource list operation. + SmfDeploymentResourceListResult +} + +// SmfDeploymentsClientUpdateTagsResponse contains the response from method SmfDeploymentsClient.UpdateTags. +type SmfDeploymentsClientUpdateTagsResponse struct { + // Azure for Operators 5G Core Session Management Function (SMF) Deployment Resource + SmfDeploymentResource +} + +// UpfDeploymentsClientCreateOrUpdateResponse contains the response from method UpfDeploymentsClient.BeginCreateOrUpdate. +type UpfDeploymentsClientCreateOrUpdateResponse struct { + // Azure for Operators 5G Core User Plane Function (UPF) Deployment Resource + UpfDeploymentResource +} + +// UpfDeploymentsClientDeleteResponse contains the response from method UpfDeploymentsClient.BeginDelete. +type UpfDeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// UpfDeploymentsClientGetResponse contains the response from method UpfDeploymentsClient.Get. +type UpfDeploymentsClientGetResponse struct { + // Azure for Operators 5G Core User Plane Function (UPF) Deployment Resource + UpfDeploymentResource +} + +// UpfDeploymentsClientListByResourceGroupResponse contains the response from method UpfDeploymentsClient.NewListByResourceGroupPager. +type UpfDeploymentsClientListByResourceGroupResponse struct { + // The response of a UpfDeploymentResource list operation. + UpfDeploymentResourceListResult +} + +// UpfDeploymentsClientListBySubscriptionResponse contains the response from method UpfDeploymentsClient.NewListBySubscriptionPager. +type UpfDeploymentsClientListBySubscriptionResponse struct { + // The response of a UpfDeploymentResource list operation. + UpfDeploymentResourceListResult +} + +// UpfDeploymentsClientUpdateTagsResponse contains the response from method UpfDeploymentsClient.UpdateTags. +type UpfDeploymentsClientUpdateTagsResponse struct { + // Azure for Operators 5G Core User Plane Function (UPF) Deployment Resource + UpfDeploymentResource +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/smfdeployments_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/smfdeployments_client.go new file mode 100644 index 000000000000..4c17f23b6170 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/smfdeployments_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// SmfDeploymentsClient contains the methods for the SmfDeployments group. +// Don't use this type directly, use NewSmfDeploymentsClient() instead. +type SmfDeploymentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSmfDeploymentsClient creates a new instance of SmfDeploymentsClient 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 NewSmfDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SmfDeploymentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SmfDeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a SmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - smfDeploymentName - The name of the SmfDeployment +// - resource - Resource create parameters. +// - options - SmfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the SmfDeploymentsClient.BeginCreateOrUpdate +// method. +func (client *SmfDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, smfDeploymentName string, resource SmfDeploymentResource, options *SmfDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SmfDeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, smfDeploymentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SmfDeploymentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SmfDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a SmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *SmfDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, smfDeploymentName string, resource SmfDeploymentResource, options *SmfDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SmfDeploymentsClient.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, smfDeploymentName, 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 *SmfDeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, smfDeploymentName string, resource SmfDeploymentResource, options *SmfDeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/smfDeployments/{smfDeploymentName}" + 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 smfDeploymentName == "" { + return nil, errors.New("parameter smfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{smfDeploymentName}", url.PathEscape(smfDeploymentName)) + 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-10-15-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 - Delete a SmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - smfDeploymentName - The name of the SmfDeployment +// - options - SmfDeploymentsClientBeginDeleteOptions contains the optional parameters for the SmfDeploymentsClient.BeginDelete +// method. +func (client *SmfDeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *SmfDeploymentsClientBeginDeleteOptions) (*runtime.Poller[SmfDeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, smfDeploymentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SmfDeploymentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SmfDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a SmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *SmfDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *SmfDeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SmfDeploymentsClient.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, smfDeploymentName, 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 *SmfDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *SmfDeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/smfDeployments/{smfDeploymentName}" + 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 smfDeploymentName == "" { + return nil, errors.New("parameter smfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{smfDeploymentName}", url.PathEscape(smfDeploymentName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - smfDeploymentName - The name of the SmfDeployment +// - options - SmfDeploymentsClientGetOptions contains the optional parameters for the SmfDeploymentsClient.Get method. +func (client *SmfDeploymentsClient) Get(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *SmfDeploymentsClientGetOptions) (SmfDeploymentsClientGetResponse, error) { + var err error + const operationName = "SmfDeploymentsClient.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, smfDeploymentName, options) + if err != nil { + return SmfDeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SmfDeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SmfDeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SmfDeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, smfDeploymentName string, options *SmfDeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/smfDeployments/{smfDeploymentName}" + 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 smfDeploymentName == "" { + return nil, errors.New("parameter smfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{smfDeploymentName}", url.PathEscape(smfDeploymentName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SmfDeploymentsClient) getHandleResponse(resp *http.Response) (SmfDeploymentsClientGetResponse, error) { + result := SmfDeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SmfDeploymentResource); err != nil { + return SmfDeploymentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all Session Management Function Deployments by Resource Group. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SmfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the SmfDeploymentsClient.NewListByResourceGroupPager +// method. +func (client *SmfDeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *SmfDeploymentsClientListByResourceGroupOptions) *runtime.Pager[SmfDeploymentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SmfDeploymentsClientListByResourceGroupResponse]{ + More: func(page SmfDeploymentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SmfDeploymentsClientListByResourceGroupResponse) (SmfDeploymentsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SmfDeploymentsClient.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 SmfDeploymentsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SmfDeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SmfDeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/smfDeployments" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SmfDeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (SmfDeploymentsClientListByResourceGroupResponse, error) { + result := SmfDeploymentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SmfDeploymentResourceListResult); err != nil { + return SmfDeploymentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all Session Management Function Deployments by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - SmfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the SmfDeploymentsClient.NewListBySubscriptionPager +// method. +func (client *SmfDeploymentsClient) NewListBySubscriptionPager(options *SmfDeploymentsClientListBySubscriptionOptions) *runtime.Pager[SmfDeploymentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SmfDeploymentsClientListBySubscriptionResponse]{ + More: func(page SmfDeploymentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SmfDeploymentsClientListBySubscriptionResponse) (SmfDeploymentsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SmfDeploymentsClient.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 SmfDeploymentsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SmfDeploymentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *SmfDeploymentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/smfDeployments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SmfDeploymentsClient) listBySubscriptionHandleResponse(resp *http.Response) (SmfDeploymentsClientListBySubscriptionResponse, error) { + result := SmfDeploymentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SmfDeploymentResourceListResult); err != nil { + return SmfDeploymentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a SmfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - smfDeploymentName - The name of the SmfDeployment +// - properties - The resource properties to be updated. +// - options - SmfDeploymentsClientUpdateTagsOptions contains the optional parameters for the SmfDeploymentsClient.UpdateTags +// method. +func (client *SmfDeploymentsClient) UpdateTags(ctx context.Context, resourceGroupName string, smfDeploymentName string, properties SmfDeploymentResourceTagsUpdate, options *SmfDeploymentsClientUpdateTagsOptions) (SmfDeploymentsClientUpdateTagsResponse, error) { + var err error + const operationName = "SmfDeploymentsClient.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, smfDeploymentName, properties, options) + if err != nil { + return SmfDeploymentsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SmfDeploymentsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SmfDeploymentsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *SmfDeploymentsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, smfDeploymentName string, properties SmfDeploymentResourceTagsUpdate, options *SmfDeploymentsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/smfDeployments/{smfDeploymentName}" + 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 smfDeploymentName == "" { + return nil, errors.New("parameter smfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{smfDeploymentName}", url.PathEscape(smfDeploymentName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *SmfDeploymentsClient) updateTagsHandleResponse(resp *http.Response) (SmfDeploymentsClientUpdateTagsResponse, error) { + result := SmfDeploymentsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SmfDeploymentResource); err != nil { + return SmfDeploymentsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go new file mode 100644 index 000000000000..4da2d1ef1c67 --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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/mobilepacketcore/armmobilepacketcore/upfdeployments_client.go b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/upfdeployments_client.go new file mode 100644 index 000000000000..71a5317c8b3f --- /dev/null +++ b/sdk/resourcemanager/mobilepacketcore/armmobilepacketcore/upfdeployments_client.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmobilepacketcore + +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" +) + +// UpfDeploymentsClient contains the methods for the UpfDeployments group. +// Don't use this type directly, use NewUpfDeploymentsClient() instead. +type UpfDeploymentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpfDeploymentsClient creates a new instance of UpfDeploymentsClient 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 NewUpfDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpfDeploymentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpfDeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a UpfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - upfDeploymentName - The name of the UpfDeployment +// - resource - Resource create parameters. +// - options - UpfDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the UpfDeploymentsClient.BeginCreateOrUpdate +// method. +func (client *UpfDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, upfDeploymentName string, resource UpfDeploymentResource, options *UpfDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[UpfDeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, upfDeploymentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpfDeploymentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpfDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a UpfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *UpfDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, upfDeploymentName string, resource UpfDeploymentResource, options *UpfDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "UpfDeploymentsClient.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, upfDeploymentName, 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 *UpfDeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, upfDeploymentName string, resource UpfDeploymentResource, options *UpfDeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/upfDeployments/{upfDeploymentName}" + 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 upfDeploymentName == "" { + return nil, errors.New("parameter upfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{upfDeploymentName}", url.PathEscape(upfDeploymentName)) + 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-10-15-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 - Delete a UpfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - upfDeploymentName - The name of the UpfDeployment +// - options - UpfDeploymentsClientBeginDeleteOptions contains the optional parameters for the UpfDeploymentsClient.BeginDelete +// method. +func (client *UpfDeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *UpfDeploymentsClientBeginDeleteOptions) (*runtime.Poller[UpfDeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, upfDeploymentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpfDeploymentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpfDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a UpfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +func (client *UpfDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *UpfDeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpfDeploymentsClient.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, upfDeploymentName, 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 *UpfDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *UpfDeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/upfDeployments/{upfDeploymentName}" + 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 upfDeploymentName == "" { + return nil, errors.New("parameter upfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{upfDeploymentName}", url.PathEscape(upfDeploymentName)) + 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-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a UpfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - upfDeploymentName - The name of the UpfDeployment +// - options - UpfDeploymentsClientGetOptions contains the optional parameters for the UpfDeploymentsClient.Get method. +func (client *UpfDeploymentsClient) Get(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *UpfDeploymentsClientGetOptions) (UpfDeploymentsClientGetResponse, error) { + var err error + const operationName = "UpfDeploymentsClient.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, upfDeploymentName, options) + if err != nil { + return UpfDeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpfDeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpfDeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpfDeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, upfDeploymentName string, options *UpfDeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/upfDeployments/{upfDeploymentName}" + 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 upfDeploymentName == "" { + return nil, errors.New("parameter upfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{upfDeploymentName}", url.PathEscape(upfDeploymentName)) + 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-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpfDeploymentsClient) getHandleResponse(resp *http.Response) (UpfDeploymentsClientGetResponse, error) { + result := UpfDeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpfDeploymentResource); err != nil { + return UpfDeploymentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all User Plane Function Deployments by Resource ID. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - UpfDeploymentsClientListByResourceGroupOptions contains the optional parameters for the UpfDeploymentsClient.NewListByResourceGroupPager +// method. +func (client *UpfDeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *UpfDeploymentsClientListByResourceGroupOptions) *runtime.Pager[UpfDeploymentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[UpfDeploymentsClientListByResourceGroupResponse]{ + More: func(page UpfDeploymentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpfDeploymentsClientListByResourceGroupResponse) (UpfDeploymentsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpfDeploymentsClient.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 UpfDeploymentsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *UpfDeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *UpfDeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/upfDeployments" + 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", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *UpfDeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (UpfDeploymentsClientListByResourceGroupResponse, error) { + result := UpfDeploymentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpfDeploymentResourceListResult); err != nil { + return UpfDeploymentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all User Plane Function Deployments by Subscription ID. +// +// Generated from API version 2023-10-15-preview +// - options - UpfDeploymentsClientListBySubscriptionOptions contains the optional parameters for the UpfDeploymentsClient.NewListBySubscriptionPager +// method. +func (client *UpfDeploymentsClient) NewListBySubscriptionPager(options *UpfDeploymentsClientListBySubscriptionOptions) *runtime.Pager[UpfDeploymentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[UpfDeploymentsClientListBySubscriptionResponse]{ + More: func(page UpfDeploymentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpfDeploymentsClientListBySubscriptionResponse) (UpfDeploymentsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpfDeploymentsClient.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 UpfDeploymentsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *UpfDeploymentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *UpfDeploymentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/upfDeployments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *UpfDeploymentsClient) listBySubscriptionHandleResponse(resp *http.Response) (UpfDeploymentsClientListBySubscriptionResponse, error) { + result := UpfDeploymentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpfDeploymentResourceListResult); err != nil { + return UpfDeploymentsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a UpfDeploymentResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - upfDeploymentName - The name of the UpfDeployment +// - properties - The resource properties to be updated. +// - options - UpfDeploymentsClientUpdateTagsOptions contains the optional parameters for the UpfDeploymentsClient.UpdateTags +// method. +func (client *UpfDeploymentsClient) UpdateTags(ctx context.Context, resourceGroupName string, upfDeploymentName string, properties UpfDeploymentResourceTagsUpdate, options *UpfDeploymentsClientUpdateTagsOptions) (UpfDeploymentsClientUpdateTagsResponse, error) { + var err error + const operationName = "UpfDeploymentsClient.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, upfDeploymentName, properties, options) + if err != nil { + return UpfDeploymentsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpfDeploymentsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpfDeploymentsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *UpfDeploymentsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, upfDeploymentName string, properties UpfDeploymentResourceTagsUpdate, options *UpfDeploymentsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/upfDeployments/{upfDeploymentName}" + 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 upfDeploymentName == "" { + return nil, errors.New("parameter upfDeploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{upfDeploymentName}", url.PathEscape(upfDeploymentName)) + 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-10-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *UpfDeploymentsClient) updateTagsHandleResponse(resp *http.Response) (UpfDeploymentsClientUpdateTagsResponse, error) { + result := UpfDeploymentsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpfDeploymentResource); err != nil { + return UpfDeploymentsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md index ef7b9daa3a52..161c0ff43b4e 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md +++ b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md @@ -1,5 +1,16 @@ # Release History +## 0.2.0 (2024-08-09) +### Breaking Changes + +- Type of `Properties.ClusterStatus` has been changed from `*MongoClusterStatus` to `*Status` +- Enum `MongoClusterStatus` has been removed + +### Features Added + +- New enum type `Status` with values `StatusDropping`, `StatusProvisioning`, `StatusReady`, `StatusStarting`, `StatusStopped`, `StatusStopping`, `StatusUpdating` + + ## 0.1.0 (2024-07-05) ### Other Changes diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go index f208f7874a40..3ebd949023b6 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go @@ -6,7 +6,7 @@ package armmongocluster const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -84,39 +84,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// MongoClusterStatus - The status of the Mongo cluster resource. -type MongoClusterStatus string - -const ( - // MongoClusterStatusDropping - The mongo cluster resource is being dropped. - MongoClusterStatusDropping MongoClusterStatus = "Dropping" - // MongoClusterStatusProvisioning - The mongo cluster resource is being provisioned. - MongoClusterStatusProvisioning MongoClusterStatus = "Provisioning" - // MongoClusterStatusReady - The mongo cluster resource is ready for use. - MongoClusterStatusReady MongoClusterStatus = "Ready" - // MongoClusterStatusStarting - The mongo cluster resource is being started. - MongoClusterStatusStarting MongoClusterStatus = "Starting" - // MongoClusterStatusStopped - The mongo cluster resource is stopped. - MongoClusterStatusStopped MongoClusterStatus = "Stopped" - // MongoClusterStatusStopping - The mongo cluster resource is being stopped. - MongoClusterStatusStopping MongoClusterStatus = "Stopping" - // MongoClusterStatusUpdating - The mongo cluster resource is being updated. - MongoClusterStatusUpdating MongoClusterStatus = "Updating" -) - -// PossibleMongoClusterStatusValues returns the possible values for the MongoClusterStatus const type. -func PossibleMongoClusterStatusValues() []MongoClusterStatus { - return []MongoClusterStatus{ - MongoClusterStatusDropping, - MongoClusterStatusProvisioning, - MongoClusterStatusReady, - MongoClusterStatusStarting, - MongoClusterStatusStopped, - MongoClusterStatusStopping, - MongoClusterStatusUpdating, - } -} - // NodeKind - The kind of the node on the cluster. type NodeKind string @@ -247,3 +214,36 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { PublicNetworkAccessEnabled, } } + +// Status - The status of the Mongo cluster resource. +type Status string + +const ( + // StatusDropping - The mongo cluster resource is being dropped. + StatusDropping Status = "Dropping" + // StatusProvisioning - The mongo cluster resource is being provisioned. + StatusProvisioning Status = "Provisioning" + // StatusReady - The mongo cluster resource is ready for use. + StatusReady Status = "Ready" + // StatusStarting - The mongo cluster resource is being started. + StatusStarting Status = "Starting" + // StatusStopped - The mongo cluster resource is stopped. + StatusStopped Status = "Stopped" + // StatusStopping - The mongo cluster resource is being stopped. + StatusStopping Status = "Stopping" + // StatusUpdating - The mongo cluster resource is being updated. + StatusUpdating Status = "Updating" +) + +// PossibleStatusValues returns the possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ + StatusDropping, + StatusProvisioning, + StatusReady, + StatusStarting, + StatusStopped, + StatusStopping, + StatusUpdating, + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go new file mode 100644 index 000000000000..d307bf876467 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.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) Go Code Generator. DO NOT EDIT. + +package armmongocluster_test + +import ( + "context" + "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/mongocluster/armmongocluster" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_FirewallRuleCreate.json +func ExampleFirewallRulesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallRulesClient().BeginCreateOrUpdate(ctx, "TestGroup", "myMongoCluster", "rule1", armmongocluster.FirewallRule{ + Properties: &armmongocluster.FirewallRuleProperties{ + StartIPAddress: to.Ptr("0.0.0.0"), + EndIPAddress: to.Ptr("255.255.255.255"), + }, + }, 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 = armmongocluster.FirewallRulesClientCreateOrUpdateResponse{ + // FirewallRule: &armmongocluster.FirewallRule{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"), + // Name: to.Ptr("rule1"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.FirewallRuleProperties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // StartIPAddress: to.Ptr("0.0.0.0"), + // EndIPAddress: to.Ptr("255.255.255.255"), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_FirewallRuleDelete.json +func ExampleFirewallRulesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallRulesClient().BeginDelete(ctx, "TestGroup", "myMongoCluster", "rule1", 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: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_FirewallRuleGet.json +func ExampleFirewallRulesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallRulesClient().Get(ctx, "TestGroup", "myMongoCluster", "rule1", 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 = armmongocluster.FirewallRulesClientGetResponse{ + // FirewallRule: &armmongocluster.FirewallRule{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"), + // Name: to.Ptr("rule1"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.FirewallRuleProperties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // StartIPAddress: to.Ptr("0.0.0.0"), + // EndIPAddress: to.Ptr("255.255.255.255"), + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_FirewallRuleList.json +func ExampleFirewallRulesClient_NewListByMongoClusterPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallRulesClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.FirewallRulesClientListByMongoClusterResponse{ + // FirewallRuleListResult: armmongocluster.FirewallRuleListResult{ + // Value: []*armmongocluster.FirewallRule{ + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"), + // Name: to.Ptr("rule1"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.FirewallRuleProperties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // StartIPAddress: to.Ptr("0.0.0.0"), + // EndIPAddress: to.Ptr("255.255.255.255"), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule2"), + // Name: to.Ptr("rule2"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.FirewallRuleProperties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // StartIPAddress: to.Ptr("1.0.0.0"), + // EndIPAddress: to.Ptr("255.0.0.0"), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod index d169be1bc464..11e54916d7e5 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod @@ -4,6 +4,7 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 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 @@ -11,7 +12,6 @@ require ( ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/models.go b/sdk/resourcemanager/mongocluster/armmongocluster/models.go index 2e4009b03995..7ff05f7fa4c0 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/models.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/models.go @@ -138,7 +138,7 @@ type Operation struct { // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // Localized display information for this particular operation. + // READ-ONLY; Localized display information for this particular operation. Display *OperationDisplay // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure @@ -156,17 +156,19 @@ type Operation struct { // OperationDisplay - Localized display information for and operation. type OperationDisplay struct { - // The short, localized friendly description of the operation; suitable for tool tips and detailed views. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", - // "Restart Virtual Machine". + // 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 - // The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } @@ -323,7 +325,7 @@ type Properties struct { ServerVersion *string // READ-ONLY; The status of the mongo cluster. - ClusterStatus *MongoClusterStatus + ClusterStatus *Status // READ-ONLY; The default mongo connection string for the cluster. ConnectionString *string @@ -370,7 +372,7 @@ type SystemData struct { // Update - The type used for update operations of the MongoCluster. type Update struct { - // The updatable properties of the MongoCluster. + // The resource-specific properties for this resource. Properties *UpdateProperties // Resource tags. diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go new file mode 100644 index 000000000000..83b1f33b0ada --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go @@ -0,0 +1,738 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmongocluster_test + +import ( + "context" + "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/mongocluster/armmongocluster" + "log" + "time" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_NameAvailability.json +func ExampleMongoClustersClient_CheckNameAvailability_checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMongoClustersClient().CheckNameAvailability(ctx, "westus2", armmongocluster.CheckNameAvailabilityRequest{ + Name: to.Ptr("newmongocluster"), + Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"), + }, 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 = armmongocluster.MongoClustersClientCheckNameAvailabilityResponse{ + // CheckNameAvailabilityResponse: &armmongocluster.CheckNameAvailabilityResponse{ + // NameAvailable: to.Ptr(true), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_NameAvailability_AlreadyExists.json +func ExampleMongoClustersClient_CheckNameAvailability_checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMongoClustersClient().CheckNameAvailability(ctx, "westus2", armmongocluster.CheckNameAvailabilityRequest{ + Name: to.Ptr("existingmongocluster"), + Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"), + }, 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 = armmongocluster.MongoClustersClientCheckNameAvailabilityResponse{ + // CheckNameAvailabilityResponse: &armmongocluster.CheckNameAvailabilityResponse{ + // NameAvailable: to.Ptr(false), + // Reason: to.Ptr(armmongocluster.CheckNameAvailabilityReasonAlreadyExists), + // Message: to.Ptr("Cluster name 'existingmongocluster' is already in use."), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Create.json +func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{ + Location: to.Ptr("westus2"), + Properties: &armmongocluster.Properties{ + AdministratorLogin: to.Ptr("mongoAdmin"), + AdministratorLoginPassword: to.Ptr("password"), + ServerVersion: to.Ptr("5.0"), + NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + { + Kind: to.Ptr(armmongocluster.NodeKindShard), + SKU: to.Ptr("M30"), + DiskSizeGB: to.Ptr[int64](128), + EnableHa: to.Ptr(true), + NodeCount: 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](128), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](3), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_CreatePITR.json +func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResourceFromAPointInTimeRestore() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.MongoCluster{ + Location: to.Ptr("westus2"), + Properties: &armmongocluster.Properties{ + CreateMode: to.Ptr(armmongocluster.CreateModePointInTimeRestore), + RestoreParameters: &armmongocluster.RestoreParameters{ + PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T20:07:35Z"); return t }()), + SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"), + }, + }, + }, 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 = armmongocluster.MongoClustersClientCreateOrUpdateResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](128), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](3), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Delete.json +func ExampleMongoClustersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginDelete(ctx, "TestResourceGroup", "myMongoCluster", 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: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Get.json +func ExampleMongoClustersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMongoClustersClient().Get(ctx, "TestResourceGroup", "myMongoCluster", 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 = armmongocluster.MongoClustersClientGetResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // Tags: map[string]*string{ + // "additionalProp1": to.Ptr("string"), + // "additionalProp2": to.Ptr("string"), + // "additionalProp3": to.Ptr("string"), + // }, + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](128), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_List.json +func ExampleMongoClustersClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMongoClustersClient().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 = armmongocluster.MongoClustersClientListResponse{ + // ListResult: armmongocluster.ListResult{ + // Value: []*armmongocluster.MongoCluster{ + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // Tags: map[string]*string{ + // "additionalProp1": to.Ptr("string"), + // "additionalProp2": to.Ptr("string"), + // "additionalProp3": to.Ptr("string"), + // }, + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](128), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster2"), + // Name: to.Ptr("myMongoCluster2"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // Tags: map[string]*string{ + // "additionalProp1": to.Ptr("string"), + // }, + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user2"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M40"), + // DiskSizeGB: to.Ptr[int64](256), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](2), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-10T20:07:35Z"), + // }, + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_ListByResourceGroup.json +func ExampleMongoClustersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMongoClustersClient().NewListByResourceGroupPager("TestResourceGroup", 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 = armmongocluster.MongoClustersClientListByResourceGroupResponse{ + // ListResult: armmongocluster.ListResult{ + // Value: []*armmongocluster.MongoCluster{ + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // Tags: map[string]*string{ + // "additionalProp1": to.Ptr("string"), + // "additionalProp2": to.Ptr("string"), + // "additionalProp3": to.Ptr("string"), + // }, + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](128), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster2"), + // Name: to.Ptr("myMongoCluster2"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // Tags: map[string]*string{ + // "additionalProp1": to.Ptr("string"), + // }, + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user2"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M40"), + // DiskSizeGB: to.Ptr[int64](256), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](2), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster2.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-10T20:07:35Z"), + // }, + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_ListConnectionStrings.json +func ExampleMongoClustersClient_ListConnectionStrings() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMongoClustersClient().ListConnectionStrings(ctx, "TestGroup", "myMongoCluster", 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 = armmongocluster.MongoClustersClientListConnectionStringsResponse{ + // ListConnectionStringsResult: &armmongocluster.ListConnectionStringsResult{ + // ConnectionStrings: []*armmongocluster.ConnectionString{ + // { + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // Description: to.Ptr("default connection string"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_PatchDiskSize.json +func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{ + Properties: &armmongocluster.UpdateProperties{ + NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + { + Kind: to.Ptr(armmongocluster.NodeKindShard), + DiskSizeGB: to.Ptr[int64](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 = armmongocluster.MongoClustersClientUpdateResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](256), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_PatchPrivateNetworkAccess.json +func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{ + Properties: &armmongocluster.UpdateProperties{ + PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled), + }, + }, 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 = armmongocluster.MongoClustersClientUpdateResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M30"), + // DiskSizeGB: to.Ptr[int64](256), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // PrivateEndpointConnections: []*armmongocluster.PrivateEndpointConnection{ + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/mymongocluster-pe.ffffffff-ffff-ffff-ffff-ffffffffffff"), + // SystemData: &armmongocluster.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()), + // CreatedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()), + // LastModifiedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // }, + // Properties: &armmongocluster.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armmongocluster.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.Network/privateEndpoints/mymongocluster-pe"), + // }, + // GroupIDs: []*string{ + // to.Ptr("MongoCluster"), + // }, + // PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved), + // Description: to.Ptr("Auto-approved"), + // ActionsRequired: to.Ptr("None"), + // }, + // }, + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Update.json +func ExampleMongoClustersClient_BeginUpdate_updatesAMongoClusterResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{ + Properties: &armmongocluster.UpdateProperties{ + AdministratorLogin: to.Ptr("mongoAdmin"), + AdministratorLoginPassword: to.Ptr("password"), + ServerVersion: to.Ptr("5.0"), + NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + { + Kind: to.Ptr(armmongocluster.NodeKindShard), + SKU: to.Ptr("M50"), + DiskSizeGB: to.Ptr[int64](256), + EnableHa: to.Ptr(true), + NodeCount: to.Ptr[int32](1), + }, + }, + PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + }, + }, 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 = armmongocluster.MongoClustersClientUpdateResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // ProvisioningState: to.Ptr(armmongocluster.ProvisioningStateSucceeded), + // AdministratorLogin: to.Ptr("mongoAdmin"), + // ServerVersion: to.Ptr("5.0"), + // NodeGroupSpecs: []*armmongocluster.NodeGroupSpec{ + // { + // Kind: to.Ptr(armmongocluster.NodeKindShard), + // SKU: to.Ptr("M50"), + // DiskSizeGB: to.Ptr[int64](256), + // EnableHa: to.Ptr(true), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessEnabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go new file mode 100644 index 000000000000..df164ee1d4a0 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmongocluster_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/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 := armmongocluster.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 = armmongocluster.OperationsClientListResponse{ + // OperationListResult: armmongocluster.OperationListResult{ + // Value: []*armmongocluster.Operation{ + // { + // Name: to.Ptr("Microsoft.DocumentDB/mongoClusters/read"), + // Display: &armmongocluster.OperationDisplay{ + // Provider: to.Ptr("Microsoft.DocumentDB"), + // Resource: to.Ptr("Mongo Cluster"), + // Operation: to.Ptr("Read Mongo Clusters"), + // Description: to.Ptr("Reads a Mongo Cluster or list all Mongo Clusters."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.DocumentDB/mongoClusters/write"), + // Display: &armmongocluster.OperationDisplay{ + // Provider: to.Ptr("Microsoft.DocumentDB"), + // Resource: to.Ptr("Mongo Cluster"), + // Operation: to.Ptr("Create or Update Mongo Cluster"), + // Description: to.Ptr("Create or Update the properties or tags of the specified Mongo Cluster."), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go new file mode 100644 index 000000000000..46799edeac10 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmongocluster_test + +import ( + "context" + "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/mongocluster/armmongocluster" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_PrivateEndpointConnectionPut.json +func ExamplePrivateEndpointConnectionsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "TestGroup", "myMongoCluster", "pecTest", armmongocluster.PrivateEndpointConnectionResource{ + Properties: &armmongocluster.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved), + Description: to.Ptr("Auto-Approved"), + }, + }, + }, 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 = armmongocluster.PrivateEndpointConnectionsClientCreateResponse{ + // PrivateEndpointConnectionResource: &armmongocluster.PrivateEndpointConnectionResource{ + // Name: to.Ptr("pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"), + // Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateEndpointConnections"), + // SystemData: &armmongocluster.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()), + // CreatedBy: to.Ptr("2df9eb86-36b5-49dc-86ae-9a63135bfa8c"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()), + // LastModifiedBy: to.Ptr("2ff9eb86-36b5-49dc-86ae-9a63135bfa8c"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // }, + // Properties: &armmongocluster.PrivateEndpointConnectionProperties{ + // ProvisioningState: to.Ptr(armmongocluster.PrivateEndpointConnectionProvisioningStateSucceeded), + // PrivateEndpoint: &armmongocluster.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/privateEndpoints/pecTest"), + // }, + // GroupIDs: []*string{ + // to.Ptr("MongoCluster"), + // }, + // PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved), + // Description: to.Ptr("Approved by admin"), + // ActionsRequired: to.Ptr("None"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_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 := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", 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: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_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 := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", 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 = armmongocluster.PrivateEndpointConnectionsClientGetResponse{ + // PrivateEndpointConnectionResource: &armmongocluster.PrivateEndpointConnectionResource{ + // Name: to.Ptr("pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"), + // Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateEndpointConnections"), + // SystemData: &armmongocluster.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()), + // CreatedBy: to.Ptr("2df9eb86-36b5-49dc-86ae-9a63135bfa8c"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()), + // LastModifiedBy: to.Ptr("2ff9eb86-36b5-49dc-86ae-9a63135bfa8c"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // }, + // Properties: &armmongocluster.PrivateEndpointConnectionProperties{ + // ProvisioningState: to.Ptr(armmongocluster.PrivateEndpointConnectionProvisioningStateSucceeded), + // PrivateEndpoint: &armmongocluster.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/privateEndpoints/pecTest"), + // }, + // GroupIDs: []*string{ + // to.Ptr("MongoCluster"), + // }, + // PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved), + // Description: to.Ptr("Auto-approved"), + // ActionsRequired: to.Ptr("None"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_PrivateEndpointConnectionList.json +func ExamplePrivateEndpointConnectionsClient_NewListByMongoClusterPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.PrivateEndpointConnectionsClientListByMongoClusterResponse{ + // PrivateEndpointConnectionResourceListResult: armmongocluster.PrivateEndpointConnectionResourceListResult{ + // Value: []*armmongocluster.PrivateEndpointConnectionResource{ + // { + // Name: to.Ptr("pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"), + // Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateEndpointConnections"), + // SystemData: &armmongocluster.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()), + // CreatedBy: to.Ptr("2df9eb86-36b5-49dc-86ae-9a63135bfa8c"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-09T05:51:31.1386869Z"); return t}()), + // LastModifiedBy: to.Ptr("2ff9eb86-36b5-49dc-86ae-9a63135bfa8c"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // }, + // Properties: &armmongocluster.PrivateEndpointConnectionProperties{ + // ProvisioningState: to.Ptr(armmongocluster.PrivateEndpointConnectionProvisioningStateSucceeded), + // PrivateEndpoint: &armmongocluster.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/privateEndpoints/pecTest"), + // }, + // GroupIDs: []*string{ + // to.Ptr("MongoCluster"), + // }, + // PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved), + // Description: to.Ptr("Auto-approved"), + // ActionsRequired: to.Ptr("None"), + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go new file mode 100644 index 000000000000..129e8a925970 --- /dev/null +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armmongocluster_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" + "log" +) + +// Generated from example definition: /mnt/vss/_work/1/s/azure-sdk-for-go/src/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_PrivateLinkResourceList.json +func ExamplePrivateLinksClient_NewListByMongoClusterPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateLinksClient().NewListByMongoClusterPager("TestGroup", "myMongoCluster", 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 = armmongocluster.PrivateLinksClientListByMongoClusterResponse{ + // PrivateLinkResourceListResult: armmongocluster.PrivateLinkResourceListResult{ + // Value: []*armmongocluster.PrivateLinkResource{ + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateLinkResources/MongoCluster"), + // Name: to.Ptr("MongoCluster"), + // Type: to.Ptr("Microsoft.DocumentDB/mongoClusters/privateLinkResources"), + // Properties: &armmongocluster.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("MongoCluster"), + // RequiredMembers: []*string{ + // to.Ptr("c.p7ex3v2euquypn"), + // }, + // RequiredZoneNames: []*string{ + // to.Ptr("privatelink.mongocluster.cosmos.azure.com"), + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml b/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml index 6f51513426e4..4385e761feb7 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml +++ b/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/mongocluster/DocumentDB.MongoCluster.Management -commit: 87a08b955c257c773a3bd42553c718d4b1092955 -repo: https://github.com/Azure/azure-rest-api-specs -additionalDirectories: +commit: 52d5e415c9026af1a6b3b4932f4338df7f40b0b8 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/CHANGELOG.md b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/CHANGELOG.md new file mode 100644 index 000000000000..5d5190386e05 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction` 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/mpcnetworkfunction/armmpcnetworkfunction/LICENSE.txt b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/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/mpcnetworkfunction/armmpcnetworkfunction/README.md b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/README.md new file mode 100644 index 000000000000..7c3f378f2df0 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/README.md @@ -0,0 +1,92 @@ +# Azure Mpcnetworkfunction Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction) + +The `armmpcnetworkfunction` module provides operations for working with Azure Mpcnetworkfunction. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction) + +# 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 Mpcnetworkfunction module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Mpcnetworkfunction. 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 Mpcnetworkfunction 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 := armmpcnetworkfunction.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 := armmpcnetworkfunction.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.NewNetworkFunctionsClient() +``` + +## 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 `Mpcnetworkfunction` 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/mpcnetworkfunction/armmpcnetworkfunction/autorest.md b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/autorest.md new file mode 100644 index 000000000000..884eaaba80bc --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/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/mpcnetworkfunction/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mpcnetworkfunction/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/mpcnetworkfunction/armmpcnetworkfunction/build.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/build.go new file mode 100644 index 000000000000..76ea384815d7 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/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/mpcnetworkfunction/armmpcnetworkfunction + +package armmpcnetworkfunction diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/ci.yml b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/ci.yml new file mode 100644 index 000000000000..4a1ecd8993a7 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/ci.yml @@ -0,0 +1,28 @@ +# 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/mpcnetworkfunction/armmpcnetworkfunction/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/mpcnetworkfunction/armmpcnetworkfunction' diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/client_factory.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/client_factory.go new file mode 100644 index 000000000000..5844f1abae58 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/client_factory.go @@ -0,0 +1,52 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +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. +// - 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 +} + +// NewNetworkFunctionsClient creates a new instance of NetworkFunctionsClient. +func (c *ClientFactory) NewNetworkFunctionsClient() *NetworkFunctionsClient { + return &NetworkFunctionsClient{ + 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/mpcnetworkfunction/armmpcnetworkfunction/constants.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/constants.go new file mode 100644 index 000000000000..5c9374bef039 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/constants.go @@ -0,0 +1,223 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction" + 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, + } +} + +// NetworkFunctionAdministrativeState - Network Function Administrative State enumerations +type NetworkFunctionAdministrativeState string + +const ( + // NetworkFunctionAdministrativeStateCommissioned - Resource has been commissioned + NetworkFunctionAdministrativeStateCommissioned NetworkFunctionAdministrativeState = "Commissioned" + // NetworkFunctionAdministrativeStateDecommissioned - Resource has been decommissioned + NetworkFunctionAdministrativeStateDecommissioned NetworkFunctionAdministrativeState = "Decommissioned" +) + +// PossibleNetworkFunctionAdministrativeStateValues returns the possible values for the NetworkFunctionAdministrativeState const type. +func PossibleNetworkFunctionAdministrativeStateValues() []NetworkFunctionAdministrativeState { + return []NetworkFunctionAdministrativeState{ + NetworkFunctionAdministrativeStateCommissioned, + NetworkFunctionAdministrativeStateDecommissioned, + } +} + +// NetworkFunctionOperationalStatus - Network Function Operational Status enumerations +type NetworkFunctionOperationalStatus string + +const ( + // NetworkFunctionOperationalStatusActive - Resource is fully deployed and operational + NetworkFunctionOperationalStatusActive NetworkFunctionOperationalStatus = "Active" + // NetworkFunctionOperationalStatusInactive - Resource is inactive + NetworkFunctionOperationalStatusInactive NetworkFunctionOperationalStatus = "Inactive" + // NetworkFunctionOperationalStatusInstantiatedNotProvisioned - Resource has been deployed, awaiting provisioning + NetworkFunctionOperationalStatusInstantiatedNotProvisioned NetworkFunctionOperationalStatus = "InstantiatedNotProvisioned" + // NetworkFunctionOperationalStatusInstantiatedProvisioned - Resource has been deployed and provisioned, awaiting testing + NetworkFunctionOperationalStatusInstantiatedProvisioned NetworkFunctionOperationalStatus = "InstantiatedProvisioned" +) + +// PossibleNetworkFunctionOperationalStatusValues returns the possible values for the NetworkFunctionOperationalStatus const type. +func PossibleNetworkFunctionOperationalStatusValues() []NetworkFunctionOperationalStatus { + return []NetworkFunctionOperationalStatus{ + NetworkFunctionOperationalStatusActive, + NetworkFunctionOperationalStatusInactive, + NetworkFunctionOperationalStatusInstantiatedNotProvisioned, + NetworkFunctionOperationalStatusInstantiatedProvisioned, + } +} + +// NetworkFunctionType - Type of Network Function +type NetworkFunctionType string + +const ( + // NetworkFunctionTypeAMF - Access and Mobility Function + NetworkFunctionTypeAMF NetworkFunctionType = "AMF" + // NetworkFunctionTypeEMS - Element Management System + NetworkFunctionTypeEMS NetworkFunctionType = "EMS" + // NetworkFunctionTypeEPDG - Evolved Packet Data Gateway + NetworkFunctionTypeEPDG NetworkFunctionType = "ePDG" + // NetworkFunctionTypeMME - Mobility Management Entity + NetworkFunctionTypeMME NetworkFunctionType = "MME" + // NetworkFunctionTypeN3IWF - Non-3GPP Interworking Function + NetworkFunctionTypeN3IWF NetworkFunctionType = "N3IWF" + // NetworkFunctionTypeNRF - Network Repository Function + NetworkFunctionTypeNRF NetworkFunctionType = "NRF" + // NetworkFunctionTypeNSSF - Network Slice Selection Function + NetworkFunctionTypeNSSF NetworkFunctionType = "NSSF" + // NetworkFunctionTypeOperationsPolicyManager - Operations and Policy Manager + NetworkFunctionTypeOperationsPolicyManager NetworkFunctionType = "OperationsPolicyManager" + // NetworkFunctionTypeRemotePaaS - Remote Platform As A Service Components + NetworkFunctionTypeRemotePaaS NetworkFunctionType = "RemotePaaS" + // NetworkFunctionTypeSMF - Session Management Function + NetworkFunctionTypeSMF NetworkFunctionType = "SMF" + // NetworkFunctionTypeSaegw - System Architecture Evolution Gateway. This combines the Serving Gateway (SGW) and the Packet + // Data Network Gateway (PGW) functionality + NetworkFunctionTypeSaegw NetworkFunctionType = "Saegw" + // NetworkFunctionTypeSaegwControlPlane - System Architecture Evolution Gateway Control Plane, control and user plane separation + // (CUPS) architecture + NetworkFunctionTypeSaegwControlPlane NetworkFunctionType = "SaegwControlPlane" + // NetworkFunctionTypeSaegwUserPlane - System Architecture Evolution Gateway User Plane, control and user plane separation + // (CUPS) architecture + NetworkFunctionTypeSaegwUserPlane NetworkFunctionType = "SaegwUserPlane" + // NetworkFunctionTypeUPF - User Plane Function + NetworkFunctionTypeUPF NetworkFunctionType = "UPF" +) + +// PossibleNetworkFunctionTypeValues returns the possible values for the NetworkFunctionType const type. +func PossibleNetworkFunctionTypeValues() []NetworkFunctionType { + return []NetworkFunctionType{ + NetworkFunctionTypeAMF, + NetworkFunctionTypeEMS, + NetworkFunctionTypeEPDG, + NetworkFunctionTypeMME, + NetworkFunctionTypeN3IWF, + NetworkFunctionTypeNRF, + NetworkFunctionTypeNSSF, + NetworkFunctionTypeOperationsPolicyManager, + NetworkFunctionTypeRemotePaaS, + NetworkFunctionTypeSMF, + NetworkFunctionTypeSaegw, + NetworkFunctionTypeSaegwControlPlane, + NetworkFunctionTypeSaegwUserPlane, + NetworkFunctionTypeUPF, + } +} + +// 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 - Provisioning state of the resource +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Resource has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource is getting deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Resource is getting provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Resource is updating + 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, + } +} + +// SKUDefinitions - SKU Definitions +type SKUDefinitions string + +const ( + // SKUDefinitionsAzureLab - Azure Lab SKU + SKUDefinitionsAzureLab SKUDefinitions = "AzureLab" + // SKUDefinitionsAzureProduction - Azure Production SKU + SKUDefinitionsAzureProduction SKUDefinitions = "AzureProduction" + // SKUDefinitionsNexusLab - Nexus Lab SKU + SKUDefinitionsNexusLab SKUDefinitions = "NexusLab" + // SKUDefinitionsNexusProduction - Nexus Production SKU + SKUDefinitionsNexusProduction SKUDefinitions = "NexusProduction" +) + +// PossibleSKUDefinitionsValues returns the possible values for the SKUDefinitions const type. +func PossibleSKUDefinitionsValues() []SKUDefinitions { + return []SKUDefinitions{ + SKUDefinitionsAzureLab, + SKUDefinitionsAzureProduction, + SKUDefinitionsNexusLab, + SKUDefinitionsNexusProduction, + } +} diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/internal.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/mpcnetworkfunction/armmpcnetworkfunction/fake/networkfunctions_server.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/networkfunctions_server.go new file mode 100644 index 000000000000..1c66ff159136 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/networkfunctions_server.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mpcnetworkfunction/armmpcnetworkfunction" + "net/http" + "net/url" + "regexp" +) + +// NetworkFunctionsServer is a fake server for instances of the armmpcnetworkfunction.NetworkFunctionsClient type. +type NetworkFunctionsServer struct { + // BeginCreateOrUpdate is the fake for method NetworkFunctionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, networkFunctionName string, resource armmpcnetworkfunction.NetworkFunctionResource, options *armmpcnetworkfunction.NetworkFunctionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmpcnetworkfunction.NetworkFunctionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method NetworkFunctionsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, networkFunctionName string, options *armmpcnetworkfunction.NetworkFunctionsClientDeleteOptions) (resp azfake.Responder[armmpcnetworkfunction.NetworkFunctionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method NetworkFunctionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, networkFunctionName string, options *armmpcnetworkfunction.NetworkFunctionsClientGetOptions) (resp azfake.Responder[armmpcnetworkfunction.NetworkFunctionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method NetworkFunctionsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armmpcnetworkfunction.NetworkFunctionsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmpcnetworkfunction.NetworkFunctionsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method NetworkFunctionsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armmpcnetworkfunction.NetworkFunctionsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmpcnetworkfunction.NetworkFunctionsClientListBySubscriptionResponse]) + + // UpdateTags is the fake for method NetworkFunctionsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, networkFunctionName string, properties armmpcnetworkfunction.NetworkFunctionResourceTagsUpdate, options *armmpcnetworkfunction.NetworkFunctionsClientUpdateTagsOptions) (resp azfake.Responder[armmpcnetworkfunction.NetworkFunctionsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewNetworkFunctionsServerTransport creates a new instance of NetworkFunctionsServerTransport with the provided implementation. +// The returned NetworkFunctionsServerTransport instance is connected to an instance of armmpcnetworkfunction.NetworkFunctionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewNetworkFunctionsServerTransport(srv *NetworkFunctionsServer) *NetworkFunctionsServerTransport { + return &NetworkFunctionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmpcnetworkfunction.NetworkFunctionsClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmpcnetworkfunction.NetworkFunctionsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmpcnetworkfunction.NetworkFunctionsClientListBySubscriptionResponse]](), + } +} + +// NetworkFunctionsServerTransport connects instances of armmpcnetworkfunction.NetworkFunctionsClient to instances of NetworkFunctionsServer. +// Don't use this type directly, use NewNetworkFunctionsServerTransport instead. +type NetworkFunctionsServerTransport struct { + srv *NetworkFunctionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmpcnetworkfunction.NetworkFunctionsClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armmpcnetworkfunction.NetworkFunctionsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armmpcnetworkfunction.NetworkFunctionsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for NetworkFunctionsServerTransport. +func (n *NetworkFunctionsServerTransport) 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 "NetworkFunctionsClient.BeginCreateOrUpdate": + resp, err = n.dispatchBeginCreateOrUpdate(req) + case "NetworkFunctionsClient.Delete": + resp, err = n.dispatchDelete(req) + case "NetworkFunctionsClient.Get": + resp, err = n.dispatchGet(req) + case "NetworkFunctionsClient.NewListByResourceGroupPager": + resp, err = n.dispatchNewListByResourceGroupPager(req) + case "NetworkFunctionsClient.NewListBySubscriptionPager": + resp, err = n.dispatchNewListBySubscriptionPager(req) + case "NetworkFunctionsClient.UpdateTags": + resp, err = n.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (n *NetworkFunctionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if n.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/networkFunctions/(?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[armmpcnetworkfunction.NetworkFunctionResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + networkFunctionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkFunctionName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, networkFunctionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + n.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) { + n.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) { + n.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (n *NetworkFunctionsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/networkFunctions/(?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 + } + networkFunctionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkFunctionName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.Delete(req.Context(), resourceGroupNameParam, networkFunctionNameParam, 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 (n *NetworkFunctionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/networkFunctions/(?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 + } + networkFunctionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkFunctionName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, networkFunctionNameParam, 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).NetworkFunctionResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (n *NetworkFunctionsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := n.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/networkFunctions` + 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 := n.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + n.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmpcnetworkfunction.NetworkFunctionsClientListByResourceGroupResponse, 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) { + n.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + n.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (n *NetworkFunctionsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := n.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.MobilePacketCore/networkFunctions` + 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 := n.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + n.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmpcnetworkfunction.NetworkFunctionsClientListBySubscriptionResponse, 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) { + n.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + n.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (n *NetworkFunctionsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if n.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\.MobilePacketCore/networkFunctions/(?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[armmpcnetworkfunction.NetworkFunctionResourceTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + networkFunctionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkFunctionName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.UpdateTags(req.Context(), resourceGroupNameParam, networkFunctionNameParam, 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).NetworkFunctionResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/operations_server.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/operations_server.go new file mode 100644 index 000000000000..9a0fa79b986a --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mpcnetworkfunction/armmpcnetworkfunction" + "net/http" +) + +// OperationsServer is a fake server for instances of the armmpcnetworkfunction.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armmpcnetworkfunction.OperationsClientListOptions) (resp azfake.PagerResponder[armmpcnetworkfunction.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armmpcnetworkfunction.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[armmpcnetworkfunction.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armmpcnetworkfunction.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armmpcnetworkfunction.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armmpcnetworkfunction.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 +} diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/server_factory.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/server_factory.go new file mode 100644 index 000000000000..3ae8f7f76c6f --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/server_factory.go @@ -0,0 +1,82 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction.ClientFactory type. +type ServerFactory struct { + NetworkFunctionsServer NetworkFunctionsServer + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armmpcnetworkfunction.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 armmpcnetworkfunction.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trNetworkFunctionsServer *NetworkFunctionsServerTransport + 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 "NetworkFunctionsClient": + initServer(s, &s.trNetworkFunctionsServer, func() *NetworkFunctionsServerTransport { + return NewNetworkFunctionsServerTransport(&s.srv.NetworkFunctionsServer) + }) + resp, err = s.trNetworkFunctionsServer.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/mpcnetworkfunction/armmpcnetworkfunction/fake/time_rfc3339.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/mpcnetworkfunction/armmpcnetworkfunction/go.mod b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/go.mod new file mode 100644 index 000000000000..9c1b4b0f0791 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/go.sum b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/models.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/models.go new file mode 100644 index 000000000000..58a201cf6c1a --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/models.go @@ -0,0 +1,151 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +import "time" + +// NetworkFunctionResource - AO5GC Network Function Resource +type NetworkFunctionResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *NetworkFunctionResourceProperties + + // 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 +} + +// NetworkFunctionResourceListResult - The response of a NetworkFunctionResource list operation. +type NetworkFunctionResourceListResult struct { + // REQUIRED; The NetworkFunctionResource items on this page + Value []*NetworkFunctionResource + + // The link to the next page of items + NextLink *string +} + +// NetworkFunctionResourceProperties - Network Function Properties. +type NetworkFunctionResourceProperties struct { + // REQUIRED; Administrative state of the network function + NetworkFunctionAdministrativeState *NetworkFunctionAdministrativeState + + // REQUIRED; Type of network function + NetworkFunctionType *NetworkFunctionType + + // REQUIRED; Provisioned SKU Value. + SKU *SKUDefinitions + + // Capacity of the network function in units of 10000. This represents the session count or the Simultaneously Attached Users + // (SAU) count as applicable + Capacity *int32 + + // User provided deployment notes. This is used to optionally provide details about the NF deployment + DeploymentNotes *string + + // User provided description + UserDescription *string + + // READ-ONLY; Count of infrastructure elements used by this network function (vCPUs, in units of 8) + InfrastructureElementCount *int32 + + // READ-ONLY; Operational state of the network function + NetworkFunctionOperationalStatus *NetworkFunctionOperationalStatus + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// NetworkFunctionResourceTagsUpdate - The type used for updating tags in NetworkFunctionResource resources. +type NetworkFunctionResourceTagsUpdate 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/mpcnetworkfunction/armmpcnetworkfunction/models_serde.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/models_serde.go new file mode 100644 index 000000000000..2a9aa78c6694 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/models_serde.go @@ -0,0 +1,364 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionResource. +func (n NetworkFunctionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResource. +func (n *NetworkFunctionResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkFunctionResourceListResult. +func (n NetworkFunctionResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResourceListResult. +func (n *NetworkFunctionResourceListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + 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 NetworkFunctionResourceProperties. +func (n NetworkFunctionResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", n.Capacity) + populate(objectMap, "deploymentNotes", n.DeploymentNotes) + populate(objectMap, "infrastructureElementCount", n.InfrastructureElementCount) + populate(objectMap, "networkFunctionAdministrativeState", n.NetworkFunctionAdministrativeState) + populate(objectMap, "networkFunctionOperationalStatus", n.NetworkFunctionOperationalStatus) + populate(objectMap, "networkFunctionType", n.NetworkFunctionType) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "sku", n.SKU) + populate(objectMap, "userDescription", n.UserDescription) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResourceProperties. +func (n *NetworkFunctionResourceProperties) UnmarshalJSON(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 "capacity": + err = unpopulate(val, "Capacity", &n.Capacity) + delete(rawMsg, key) + case "deploymentNotes": + err = unpopulate(val, "DeploymentNotes", &n.DeploymentNotes) + delete(rawMsg, key) + case "infrastructureElementCount": + err = unpopulate(val, "InfrastructureElementCount", &n.InfrastructureElementCount) + delete(rawMsg, key) + case "networkFunctionAdministrativeState": + err = unpopulate(val, "NetworkFunctionAdministrativeState", &n.NetworkFunctionAdministrativeState) + delete(rawMsg, key) + case "networkFunctionOperationalStatus": + err = unpopulate(val, "NetworkFunctionOperationalStatus", &n.NetworkFunctionOperationalStatus) + delete(rawMsg, key) + case "networkFunctionType": + err = unpopulate(val, "NetworkFunctionType", &n.NetworkFunctionType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &n.SKU) + delete(rawMsg, key) + case "userDescription": + err = unpopulate(val, "UserDescription", &n.UserDescription) + 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 NetworkFunctionResourceTagsUpdate. +func (n NetworkFunctionResourceTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkFunctionResourceTagsUpdate. +func (n *NetworkFunctionResourceTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &n.Tags) + 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, "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/mpcnetworkfunction/armmpcnetworkfunction/networkfunctions_client.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/networkfunctions_client.go new file mode 100644 index 000000000000..6873648d3f89 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/networkfunctions_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +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" +) + +// NetworkFunctionsClient contains the methods for the NetworkFunctions group. +// Don't use this type directly, use NewNetworkFunctionsClient() instead. +type NetworkFunctionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkFunctionsClient creates a new instance of NetworkFunctionsClient 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 NewNetworkFunctionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkFunctionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkFunctionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - resource - Resource create parameters. +// - options - NetworkFunctionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkFunctionsClient.BeginCreateOrUpdate +// method. +func (client *NetworkFunctionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkFunctionName string, resource NetworkFunctionResource, options *NetworkFunctionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkFunctionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkFunctionName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkFunctionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NetworkFunctionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +func (client *NetworkFunctionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkFunctionName string, resource NetworkFunctionResource, options *NetworkFunctionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "NetworkFunctionsClient.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, networkFunctionName, 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 *NetworkFunctionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, resource NetworkFunctionResource, options *NetworkFunctionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + 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 networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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-05-15-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 NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - options - NetworkFunctionsClientDeleteOptions contains the optional parameters for the NetworkFunctionsClient.Delete method. +func (client *NetworkFunctionsClient) Delete(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientDeleteOptions) (NetworkFunctionsClientDeleteResponse, error) { + var err error + const operationName = "NetworkFunctionsClient.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, networkFunctionName, options) + if err != nil { + return NetworkFunctionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return NetworkFunctionsClientDeleteResponse{}, err + } + return NetworkFunctionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *NetworkFunctionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + 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 networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - options - NetworkFunctionsClientGetOptions contains the optional parameters for the NetworkFunctionsClient.Get method. +func (client *NetworkFunctionsClient) Get(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientGetOptions) (NetworkFunctionsClientGetResponse, error) { + var err error + const operationName = "NetworkFunctionsClient.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, networkFunctionName, options) + if err != nil { + return NetworkFunctionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkFunctionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkFunctionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, options *NetworkFunctionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + 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 networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkFunctionsClient) getHandleResponse(resp *http.Response) (NetworkFunctionsClientGetResponse, error) { + result := NetworkFunctionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResource); err != nil { + return NetworkFunctionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List NetworkFunctionResource resources by resource group +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - NetworkFunctionsClientListByResourceGroupOptions contains the optional parameters for the NetworkFunctionsClient.NewListByResourceGroupPager +// method. +func (client *NetworkFunctionsClient) NewListByResourceGroupPager(resourceGroupName string, options *NetworkFunctionsClientListByResourceGroupOptions) *runtime.Pager[NetworkFunctionsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkFunctionsClientListByResourceGroupResponse]{ + More: func(page NetworkFunctionsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkFunctionsClientListByResourceGroupResponse) (NetworkFunctionsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NetworkFunctionsClient.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 NetworkFunctionsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *NetworkFunctionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NetworkFunctionsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions" + 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", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *NetworkFunctionsClient) listByResourceGroupHandleResponse(resp *http.Response) (NetworkFunctionsClientListByResourceGroupResponse, error) { + result := NetworkFunctionsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResourceListResult); err != nil { + return NetworkFunctionsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List NetworkFunctionResource resources by subscription ID +// +// Generated from API version 2023-05-15-preview +// - options - NetworkFunctionsClientListBySubscriptionOptions contains the optional parameters for the NetworkFunctionsClient.NewListBySubscriptionPager +// method. +func (client *NetworkFunctionsClient) NewListBySubscriptionPager(options *NetworkFunctionsClientListBySubscriptionOptions) *runtime.Pager[NetworkFunctionsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkFunctionsClientListBySubscriptionResponse]{ + More: func(page NetworkFunctionsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkFunctionsClientListBySubscriptionResponse) (NetworkFunctionsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NetworkFunctionsClient.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 NetworkFunctionsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *NetworkFunctionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *NetworkFunctionsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.MobilePacketCore/networkFunctions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *NetworkFunctionsClient) listBySubscriptionHandleResponse(resp *http.Response) (NetworkFunctionsClientListBySubscriptionResponse, error) { + result := NetworkFunctionsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResourceListResult); err != nil { + return NetworkFunctionsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a NetworkFunctionResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-15-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - networkFunctionName - The name of the network function +// - properties - The resource properties to be updated. +// - options - NetworkFunctionsClientUpdateTagsOptions contains the optional parameters for the NetworkFunctionsClient.UpdateTags +// method. +func (client *NetworkFunctionsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkFunctionName string, properties NetworkFunctionResourceTagsUpdate, options *NetworkFunctionsClientUpdateTagsOptions) (NetworkFunctionsClientUpdateTagsResponse, error) { + var err error + const operationName = "NetworkFunctionsClient.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, networkFunctionName, properties, options) + if err != nil { + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *NetworkFunctionsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkFunctionName string, properties NetworkFunctionResourceTagsUpdate, options *NetworkFunctionsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobilePacketCore/networkFunctions/{networkFunctionName}" + 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 networkFunctionName == "" { + return nil, errors.New("parameter networkFunctionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkFunctionName}", url.PathEscape(networkFunctionName)) + 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-05-15-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 +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *NetworkFunctionsClient) updateTagsHandleResponse(resp *http.Response) (NetworkFunctionsClientUpdateTagsResponse, error) { + result := NetworkFunctionsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFunctionResource); err != nil { + return NetworkFunctionsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/operations_client.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/operations_client.go new file mode 100644 index 000000000000..6f190c680ea3 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +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 2023-05-15-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + 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.MobilePacketCore/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-05-15-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/mpcnetworkfunction/armmpcnetworkfunction/options.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/options.go new file mode 100644 index 000000000000..456a966c1342 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/options.go @@ -0,0 +1,48 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +// NetworkFunctionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkFunctionsClient.BeginCreateOrUpdate +// method. +type NetworkFunctionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkFunctionsClientDeleteOptions contains the optional parameters for the NetworkFunctionsClient.Delete method. +type NetworkFunctionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientGetOptions contains the optional parameters for the NetworkFunctionsClient.Get method. +type NetworkFunctionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientListByResourceGroupOptions contains the optional parameters for the NetworkFunctionsClient.NewListByResourceGroupPager +// method. +type NetworkFunctionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientListBySubscriptionOptions contains the optional parameters for the NetworkFunctionsClient.NewListBySubscriptionPager +// method. +type NetworkFunctionsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// NetworkFunctionsClientUpdateTagsOptions contains the optional parameters for the NetworkFunctionsClient.UpdateTags method. +type NetworkFunctionsClientUpdateTagsOptions 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/mpcnetworkfunction/armmpcnetworkfunction/responses.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/responses.go new file mode 100644 index 000000000000..32b7409f126f --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/responses.go @@ -0,0 +1,50 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +// NetworkFunctionsClientCreateOrUpdateResponse contains the response from method NetworkFunctionsClient.BeginCreateOrUpdate. +type NetworkFunctionsClientCreateOrUpdateResponse struct { + // AO5GC Network Function Resource + NetworkFunctionResource +} + +// NetworkFunctionsClientDeleteResponse contains the response from method NetworkFunctionsClient.Delete. +type NetworkFunctionsClientDeleteResponse struct { + // placeholder for future response values +} + +// NetworkFunctionsClientGetResponse contains the response from method NetworkFunctionsClient.Get. +type NetworkFunctionsClientGetResponse struct { + // AO5GC Network Function Resource + NetworkFunctionResource +} + +// NetworkFunctionsClientListByResourceGroupResponse contains the response from method NetworkFunctionsClient.NewListByResourceGroupPager. +type NetworkFunctionsClientListByResourceGroupResponse struct { + // The response of a NetworkFunctionResource list operation. + NetworkFunctionResourceListResult +} + +// NetworkFunctionsClientListBySubscriptionResponse contains the response from method NetworkFunctionsClient.NewListBySubscriptionPager. +type NetworkFunctionsClientListBySubscriptionResponse struct { + // The response of a NetworkFunctionResource list operation. + NetworkFunctionResourceListResult +} + +// NetworkFunctionsClientUpdateTagsResponse contains the response from method NetworkFunctionsClient.UpdateTags. +type NetworkFunctionsClientUpdateTagsResponse struct { + // AO5GC Network Function Resource + NetworkFunctionResource +} + +// 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/mpcnetworkfunction/armmpcnetworkfunction/time_rfc3339.go b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/time_rfc3339.go new file mode 100644 index 000000000000..cf2a0a1408b9 --- /dev/null +++ b/sdk/resourcemanager/mpcnetworkfunction/armmpcnetworkfunction/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armmpcnetworkfunction + +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/networkanalytics/armnetworkanalytics/CHANGELOG.md b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/CHANGELOG.md index e3a046bf2067..5c0ff01816c4 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/CHANGELOG.md +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-08-09) +### Other Changes + + ## 1.0.0 (2024-01-26) ### Other Changes diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/autorest.md b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/autorest.md index ba8feb90c3a7..e451707572ca 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/autorest.md +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/networkanalytics/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/networkanalytics/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2023-11-15 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/client_factory.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/client_factory.go index 39968accc35e..feda298d8602 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/client_factory.go +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/client_factory.go @@ -17,8 +17,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,36 +26,43 @@ 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 } // NewDataProductsCatalogsClient creates a new instance of DataProductsCatalogsClient. func (c *ClientFactory) NewDataProductsCatalogsClient() *DataProductsCatalogsClient { - subClient, _ := NewDataProductsCatalogsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataProductsCatalogsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDataProductsClient creates a new instance of DataProductsClient. func (c *ClientFactory) NewDataProductsClient() *DataProductsClient { - subClient, _ := NewDataProductsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataProductsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDataTypesClient creates a new instance of DataTypesClient. func (c *ClientFactory) NewDataTypesClient() *DataTypesClient { - subClient, _ := NewDataTypesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DataTypesClient{ + 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, + } } diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/constants.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/constants.go index 23529a788159..6f4934680137 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/constants.go +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/constants.go @@ -10,7 +10,7 @@ package armnetworkanalytics const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkanalytics/armnetworkanalytics" - 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/networkanalytics/armnetworkanalytics/dataproducts_client_example_test.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/dataproducts_client_example_test.go deleted file mode 100644 index cf286589086f..000000000000 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/dataproducts_client_example_test.go +++ /dev/null @@ -1,1115 +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 armnetworkanalytics_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/networkanalytics/armnetworkanalytics" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_ListBySubscription_MaximumSet_Gen.json -func ExampleDataProductsClient_NewListBySubscriptionPager_dataProductsListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsClient().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.DataProductListResult = armnetworkanalytics.DataProductListResult{ - // Value: []*armnetworkanalytics.DataProduct{ - // { - // Name: to.Ptr("dataproduct01"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - // }, - // Identity: &armnetworkanalytics.ManagedServiceIdentity{ - // Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityType("IdentityType")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - // "key8474": &armnetworkanalytics.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armnetworkanalytics.DataProductProperties{ - // AvailableMinorVersions: []*string{ - // to.Ptr("1.0.1"), - // to.Ptr("1.0.2")}, - // ConsumptionEndpoints: &armnetworkanalytics.ConsumptionEndpointsProperties{ - // FileAccessResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // FileAccessURL: to.Ptr("https://operatorinsightsstorageResourceName.blob.core.windows.net"), - // IngestionResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // IngestionURL: to.Ptr("https://aoiingestionstorageResourceName.blob.core.windows.net"), - // QueryResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Kusto/clusters/clusterName"), - // QueryURL: to.Ptr("https://opinsightsclusterName.regionName.kusto.windows.net"), - // }, - // CurrentMinorVersion: to.Ptr("1.0.1"), - // CustomerEncryptionKey: &armnetworkanalytics.EncryptionKeyDetails{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://KeyVault.vault.azure.net"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // CustomerManagedKeyEncryptionEnabled: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Documentation: to.Ptr("https://learn.microsoft.com/"), - // KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - // MajorVersion: to.Ptr("1.0.0"), - // ManagedResourceGroupConfiguration: &armnetworkanalytics.ManagedResourceGroupConfiguration{ - // Name: to.Ptr("managedResourceGroupName"), - // Location: to.Ptr("eastus"), - // }, - // Networkacls: &armnetworkanalytics.DataProductNetworkACLs{ - // AllowedQueryIPRangeList: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.2")}, - // DefaultAction: to.Ptr(armnetworkanalytics.DefaultActionAllow), - // IPRules: []*armnetworkanalytics.IPRules{ - // { - // Action: to.Ptr("Allow"), - // Value: to.Ptr("1.1.1.1"), - // }}, - // VirtualNetworkRule: []*armnetworkanalytics.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/virtualNetworkName/subnets/subnetName"), - // State: to.Ptr("Succeeded"), - // }}, - // }, - // Owners: []*string{ - // to.Ptr("abc@micros.com")}, - // PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // Product: to.Ptr("MCC"), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Publisher: to.Ptr("Microsoft"), - // PurviewAccount: to.Ptr("testpurview"), - // PurviewCollection: to.Ptr("134567890"), - // Redundancy: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_ListBySubscription_MinimumSet_Gen.json -func ExampleDataProductsClient_NewListBySubscriptionPager_dataProductsListBySubscriptionMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsClient().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.DataProductListResult = armnetworkanalytics.DataProductListResult{ - // Value: []*armnetworkanalytics.DataProduct{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_ListByResourceGroup_MaximumSet_Gen.json -func ExampleDataProductsClient_NewListByResourceGroupPager_dataProductsListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsClient().NewListByResourceGroupPager("aoiresourceGroupName", 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.DataProductListResult = armnetworkanalytics.DataProductListResult{ - // Value: []*armnetworkanalytics.DataProduct{ - // { - // Name: to.Ptr("dataproduct01"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - // }, - // Identity: &armnetworkanalytics.ManagedServiceIdentity{ - // Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityType("IdentityType")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - // "key8474": &armnetworkanalytics.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armnetworkanalytics.DataProductProperties{ - // AvailableMinorVersions: []*string{ - // to.Ptr("1.0.1"), - // to.Ptr("1.0.2")}, - // ConsumptionEndpoints: &armnetworkanalytics.ConsumptionEndpointsProperties{ - // FileAccessResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // FileAccessURL: to.Ptr("https://operatorinsightsstorageResourceName.blob.core.windows.net"), - // IngestionResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // IngestionURL: to.Ptr("https://aoiingestionstorageResourceName.blob.core.windows.net"), - // QueryResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Kusto/clusters/clusterName"), - // QueryURL: to.Ptr("https://opinsightsclusterName.regionName.kusto.windows.net"), - // }, - // CurrentMinorVersion: to.Ptr("1.0.1"), - // CustomerEncryptionKey: &armnetworkanalytics.EncryptionKeyDetails{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://KeyVault.vault.azure.net"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // CustomerManagedKeyEncryptionEnabled: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Documentation: to.Ptr("https://learn.microsoft.com/"), - // KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - // MajorVersion: to.Ptr("1.0.0"), - // ManagedResourceGroupConfiguration: &armnetworkanalytics.ManagedResourceGroupConfiguration{ - // Name: to.Ptr("managedResourceGroupName"), - // Location: to.Ptr("eastus"), - // }, - // Networkacls: &armnetworkanalytics.DataProductNetworkACLs{ - // AllowedQueryIPRangeList: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.2")}, - // DefaultAction: to.Ptr(armnetworkanalytics.DefaultActionAllow), - // IPRules: []*armnetworkanalytics.IPRules{ - // { - // Action: to.Ptr("Allow"), - // Value: to.Ptr("1.1.1.1"), - // }}, - // VirtualNetworkRule: []*armnetworkanalytics.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/virtualNetworkName/subnets/subnetName"), - // State: to.Ptr("Succeeded"), - // }}, - // }, - // Owners: []*string{ - // to.Ptr("abc@micros.com")}, - // PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // Product: to.Ptr("MCC"), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Publisher: to.Ptr("Microsoft"), - // PurviewAccount: to.Ptr("testpurview"), - // PurviewCollection: to.Ptr("134567890"), - // Redundancy: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_ListByResourceGroup_MinimumSet_Gen.json -func ExampleDataProductsClient_NewListByResourceGroupPager_dataProductsListByResourceGroupMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsClient().NewListByResourceGroupPager("aoiresourceGroupName", 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.DataProductListResult = armnetworkanalytics.DataProductListResult{ - // Value: []*armnetworkanalytics.DataProduct{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Get_MaximumSet_Gen.json -func ExampleDataProductsClient_Get_dataProductsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().Get(ctx, "aoiresourceGroupName", "dataproduct01", 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.DataProduct = armnetworkanalytics.DataProduct{ - // Name: to.Ptr("dataproduct01"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - // }, - // Identity: &armnetworkanalytics.ManagedServiceIdentity{ - // Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityType("IdentityType")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - // "key8474": &armnetworkanalytics.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armnetworkanalytics.DataProductProperties{ - // AvailableMinorVersions: []*string{ - // to.Ptr("1.0.1"), - // to.Ptr("1.0.2")}, - // ConsumptionEndpoints: &armnetworkanalytics.ConsumptionEndpointsProperties{ - // FileAccessResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // FileAccessURL: to.Ptr("https://operatorinsightsstorageResourceName.blob.core.windows.net"), - // IngestionResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // IngestionURL: to.Ptr("https://aoiingestionstorageResourceName.blob.core.windows.net"), - // QueryResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Kusto/clusters/clusterName"), - // QueryURL: to.Ptr("https://opinsightsclusterName.regionName.kusto.windows.net"), - // }, - // CurrentMinorVersion: to.Ptr("1.0.1"), - // CustomerEncryptionKey: &armnetworkanalytics.EncryptionKeyDetails{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://KeyVault.vault.azure.net"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // CustomerManagedKeyEncryptionEnabled: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Documentation: to.Ptr("https://learn.microsoft.com/"), - // KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - // MajorVersion: to.Ptr("1.0.0"), - // ManagedResourceGroupConfiguration: &armnetworkanalytics.ManagedResourceGroupConfiguration{ - // Name: to.Ptr("managedResourceGroupName"), - // Location: to.Ptr("eastus"), - // }, - // Networkacls: &armnetworkanalytics.DataProductNetworkACLs{ - // AllowedQueryIPRangeList: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.2")}, - // DefaultAction: to.Ptr(armnetworkanalytics.DefaultActionAllow), - // IPRules: []*armnetworkanalytics.IPRules{ - // { - // Action: to.Ptr("Allow"), - // Value: to.Ptr("1.1.1.1"), - // }}, - // VirtualNetworkRule: []*armnetworkanalytics.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/virtualNetworkName/subnets/subnetName"), - // State: to.Ptr("Succeeded"), - // }}, - // }, - // Owners: []*string{ - // to.Ptr("abc@micros.com")}, - // PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // Product: to.Ptr("MCC"), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Publisher: to.Ptr("Microsoft"), - // PurviewAccount: to.Ptr("testpurview"), - // PurviewCollection: to.Ptr("134567890"), - // Redundancy: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Get_MinimumSet_Gen.json -func ExampleDataProductsClient_Get_dataProductsGetMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().Get(ctx, "aoiresourceGroupName", "dataproduct01", 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.DataProduct = armnetworkanalytics.DataProduct{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // Location: to.Ptr("eastus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Create_MaximumSet_Gen.json -func ExampleDataProductsClient_BeginCreate_dataProductsCreateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataProductsClient().BeginCreate(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.DataProduct{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - }, - Identity: &armnetworkanalytics.ManagedServiceIdentity{ - Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - "/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Properties: &armnetworkanalytics.DataProductProperties{ - ConsumptionEndpoints: &armnetworkanalytics.ConsumptionEndpointsProperties{}, - CurrentMinorVersion: to.Ptr("1.0.1"), - CustomerEncryptionKey: &armnetworkanalytics.EncryptionKeyDetails{ - KeyName: to.Ptr("keyName"), - KeyVaultURI: to.Ptr("https://KeyVault.vault.azure.net"), - KeyVersion: to.Ptr("keyVersion"), - }, - CustomerManagedKeyEncryptionEnabled: to.Ptr(armnetworkanalytics.ControlStateEnabled), - MajorVersion: to.Ptr("1.0.0"), - ManagedResourceGroupConfiguration: &armnetworkanalytics.ManagedResourceGroupConfiguration{ - Name: to.Ptr("managedResourceGroupName"), - Location: to.Ptr("eastus"), - }, - Networkacls: &armnetworkanalytics.DataProductNetworkACLs{ - AllowedQueryIPRangeList: []*string{ - to.Ptr("1.1.1.1")}, - DefaultAction: to.Ptr(armnetworkanalytics.DefaultActionAllow), - IPRules: []*armnetworkanalytics.IPRules{ - { - Action: to.Ptr("Allow"), - Value: to.Ptr("1.1.1.1"), - }}, - VirtualNetworkRule: []*armnetworkanalytics.VirtualNetworkRule{ - { - Action: to.Ptr("Allow"), - ID: to.Ptr("/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/virtualNetworkName/subnets/subnetName"), - State: to.Ptr(""), - }}, - }, - Owners: []*string{ - to.Ptr("abc@micros.com")}, - PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - Product: to.Ptr("MCC"), - ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - PublicNetworkAccess: to.Ptr(armnetworkanalytics.ControlStateEnabled), - Publisher: to.Ptr("Microsoft"), - PurviewAccount: to.Ptr("testpurview"), - PurviewCollection: to.Ptr("134567890"), - Redundancy: to.Ptr(armnetworkanalytics.ControlStateDisabled), - }, - }, 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.DataProduct = armnetworkanalytics.DataProduct{ - // Name: to.Ptr("dataproduct01"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - // }, - // Identity: &armnetworkanalytics.ManagedServiceIdentity{ - // Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityType("IdentityType")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - // "key8474": &armnetworkanalytics.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armnetworkanalytics.DataProductProperties{ - // AvailableMinorVersions: []*string{ - // to.Ptr("1.0.1"), - // to.Ptr("1.0.2")}, - // ConsumptionEndpoints: &armnetworkanalytics.ConsumptionEndpointsProperties{ - // FileAccessResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // FileAccessURL: to.Ptr("https://operatorinsightsstorageResourceName.blob.core.windows.net"), - // IngestionResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // IngestionURL: to.Ptr("https://aoiingestionstorageResourceName.blob.core.windows.net"), - // QueryResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Kusto/clusters/clusterName"), - // QueryURL: to.Ptr("https://opinsightsclusterName.regionName.kusto.windows.net"), - // }, - // CurrentMinorVersion: to.Ptr("1.0.1"), - // CustomerEncryptionKey: &armnetworkanalytics.EncryptionKeyDetails{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://KeyVault.vault.azure.net"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // CustomerManagedKeyEncryptionEnabled: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Documentation: to.Ptr("https://learn.microsoft.com/"), - // KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - // MajorVersion: to.Ptr("1.0.0"), - // ManagedResourceGroupConfiguration: &armnetworkanalytics.ManagedResourceGroupConfiguration{ - // Name: to.Ptr("managedResourceGroupName"), - // Location: to.Ptr("eastus"), - // }, - // Networkacls: &armnetworkanalytics.DataProductNetworkACLs{ - // AllowedQueryIPRangeList: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.2")}, - // DefaultAction: to.Ptr(armnetworkanalytics.DefaultActionAllow), - // IPRules: []*armnetworkanalytics.IPRules{ - // { - // Action: to.Ptr("Allow"), - // Value: to.Ptr("1.1.1.1"), - // }}, - // VirtualNetworkRule: []*armnetworkanalytics.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/virtualNetworkName/subnets/subnetName"), - // State: to.Ptr("Succeeded"), - // }}, - // }, - // Owners: []*string{ - // to.Ptr("abc@micros.com")}, - // PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // Product: to.Ptr("MCC"), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Publisher: to.Ptr("Microsoft"), - // PurviewAccount: to.Ptr("testpurview"), - // PurviewCollection: to.Ptr("134567890"), - // Redundancy: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Create_MinimumSet_Gen.json -func ExampleDataProductsClient_BeginCreate_dataProductsCreateMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataProductsClient().BeginCreate(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.DataProduct{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - }, - Properties: &armnetworkanalytics.DataProductProperties{ - MajorVersion: to.Ptr("1.0.0"), - Product: to.Ptr("MCC"), - Publisher: to.Ptr("Microsoft"), - }, - }, 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.DataProduct = armnetworkanalytics.DataProduct{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // Location: to.Ptr("eastus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Update_MaximumSet_Gen.json -func ExampleDataProductsClient_BeginUpdate_dataProductsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataProductsClient().BeginUpdate(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.DataProductUpdate{ - Identity: &armnetworkanalytics.ManagedServiceIdentity{ - Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - "/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Properties: &armnetworkanalytics.DataProductUpdateProperties{ - CurrentMinorVersion: to.Ptr("1.0.1"), - Owners: []*string{ - to.Ptr("abc@micros.com"), - to.Ptr("def@micros.com")}, - PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - PurviewAccount: to.Ptr("testpurview"), - PurviewCollection: to.Ptr("134567890"), - }, - Tags: map[string]*string{ - "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - }, - }, 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.DataProduct = armnetworkanalytics.DataProduct{ - // Name: to.Ptr("dataproduct01"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/DataProducts/dataproduct01"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "userSpecifiedKeyName": to.Ptr("userSpecifiedKeyValue"), - // }, - // Identity: &armnetworkanalytics.ManagedServiceIdentity{ - // Type: to.Ptr(armnetworkanalytics.ManagedServiceIdentityType("IdentityType")), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // UserAssignedIdentities: map[string]*armnetworkanalytics.UserAssignedIdentity{ - // "key8474": &armnetworkanalytics.UserAssignedIdentity{ - // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // }, - // Properties: &armnetworkanalytics.DataProductProperties{ - // AvailableMinorVersions: []*string{ - // to.Ptr("1.0.1"), - // to.Ptr("1.0.2")}, - // ConsumptionEndpoints: &armnetworkanalytics.ConsumptionEndpointsProperties{ - // FileAccessResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // FileAccessURL: to.Ptr("https://operatorinsightsstorageResourceName.blob.core.windows.net"), - // IngestionResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageResourceName"), - // IngestionURL: to.Ptr("https://aoiingestionstorageResourceName.blob.core.windows.net"), - // QueryResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Kusto/clusters/clusterName"), - // QueryURL: to.Ptr("https://opinsightsclusterName.regionName.kusto.windows.net"), - // }, - // CurrentMinorVersion: to.Ptr("1.0.1"), - // CustomerEncryptionKey: &armnetworkanalytics.EncryptionKeyDetails{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://KeyVault.vault.azure.net"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // CustomerManagedKeyEncryptionEnabled: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Documentation: to.Ptr("https://learn.microsoft.com/"), - // KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - // MajorVersion: to.Ptr("1.0.0"), - // ManagedResourceGroupConfiguration: &armnetworkanalytics.ManagedResourceGroupConfiguration{ - // Name: to.Ptr("managedResourceGroupName"), - // Location: to.Ptr("eastus"), - // }, - // Networkacls: &armnetworkanalytics.DataProductNetworkACLs{ - // AllowedQueryIPRangeList: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.2")}, - // DefaultAction: to.Ptr(armnetworkanalytics.DefaultActionAllow), - // IPRules: []*armnetworkanalytics.IPRules{ - // { - // Action: to.Ptr("Allow"), - // Value: to.Ptr("1.1.1.1"), - // }}, - // VirtualNetworkRule: []*armnetworkanalytics.VirtualNetworkRule{ - // { - // Action: to.Ptr("Allow"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/virtualNetworkName/subnets/subnetName"), - // State: to.Ptr("Succeeded"), - // }}, - // }, - // Owners: []*string{ - // to.Ptr("abc@micros.com"), - // to.Ptr("def@micros.com")}, - // PrivateLinksEnabled: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // Product: to.Ptr("MCC"), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armnetworkanalytics.ControlStateEnabled), - // Publisher: to.Ptr("Microsoft"), - // PurviewAccount: to.Ptr("testpurview"), - // PurviewCollection: to.Ptr("134567890"), - // Redundancy: to.Ptr(armnetworkanalytics.ControlStateDisabled), - // ResourceGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Update_MinimumSet_Gen.json -func ExampleDataProductsClient_BeginUpdate_dataProductsUpdateMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataProductsClient().BeginUpdate(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.DataProductUpdate{}, 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.DataProduct = armnetworkanalytics.DataProduct{ - // Location: to.Ptr("jwlerdaudgxff"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Delete_MaximumSet_Gen.json -func ExampleDataProductsClient_BeginDelete_dataProductsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataProductsClient().BeginDelete(ctx, "aoiresourceGroupName", "dataproduct01", 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_Delete_MinimumSet_Gen.json -func ExampleDataProductsClient_BeginDelete_dataProductsDeleteMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataProductsClient().BeginDelete(ctx, "aoiresourceGroupName", "dataproduct01", 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_AddUserRole_MaximumSet_Gen.json -func ExampleDataProductsClient_AddUserRole_dataProductsAddUserRoleMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().AddUserRole(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.RoleAssignmentCommonProperties{ - DataTypeScope: []*string{ - to.Ptr("scope")}, - PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - PrincipalType: to.Ptr("User"), - Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - UserName: to.Ptr("UserName"), - }, 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.RoleAssignmentDetail = armnetworkanalytics.RoleAssignmentDetail{ - // DataTypeScope: []*string{ - // to.Ptr("scope")}, - // PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // PrincipalType: to.Ptr("User"), - // Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - // RoleAssignmentID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // UserName: to.Ptr("UserName"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_AddUserRole_MinimumSet_Gen.json -func ExampleDataProductsClient_AddUserRole_dataProductsAddUserRoleMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().AddUserRole(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.RoleAssignmentCommonProperties{ - DataTypeScope: []*string{ - to.Ptr("scope")}, - PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - PrincipalType: to.Ptr("User"), - Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - UserName: to.Ptr("userName"), - }, 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.RoleAssignmentDetail = armnetworkanalytics.RoleAssignmentDetail{ - // DataTypeScope: []*string{ - // to.Ptr("scope")}, - // PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // PrincipalType: to.Ptr("User"), - // Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - // RoleAssignmentID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // UserName: to.Ptr("userName"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_GenerateStorageAccountSasToken_MaximumSet_Gen.json -func ExampleDataProductsClient_GenerateStorageAccountSasToken_dataProductsGenerateStorageAccountSasTokenMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().GenerateStorageAccountSasToken(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.AccountSas{ - ExpiryTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:34:58.151Z"); return t }()), - IPAddress: to.Ptr("1.1.1.1"), - StartTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:34:58.151Z"); return 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.AccountSasToken = armnetworkanalytics.AccountSasToken{ - // StorageAccountSasToken: to.Ptr("storageAccountSasToken"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_GenerateStorageAccountSasToken_MinimumSet_Gen.json -func ExampleDataProductsClient_GenerateStorageAccountSasToken_dataProductsGenerateStorageAccountSasTokenMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().GenerateStorageAccountSasToken(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.AccountSas{ - ExpiryTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:35:17.051Z"); return t }()), - IPAddress: to.Ptr("1.1.1.1"), - StartTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:35:17.051Z"); return 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.AccountSasToken = armnetworkanalytics.AccountSasToken{ - // StorageAccountSasToken: to.Ptr("storageAccountSasToken"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_ListRolesAssignments_MaximumSet_Gen.json -func ExampleDataProductsClient_ListRolesAssignments_dataProductsListRolesAssignmentsMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().ListRolesAssignments(ctx, "aoiresourceGroupName", "dataproduct01", map[string]any{}, 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.ListRoleAssignments = armnetworkanalytics.ListRoleAssignments{ - // Count: to.Ptr[int32](1), - // RoleAssignmentResponse: []*armnetworkanalytics.RoleAssignmentDetail{ - // { - // DataTypeScope: []*string{ - // to.Ptr("scope")}, - // PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // PrincipalType: to.Ptr("User"), - // Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - // RoleAssignmentID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // UserName: to.Ptr("UserName"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_ListRolesAssignments_MinimumSet_Gen.json -func ExampleDataProductsClient_ListRolesAssignments_dataProductsListRolesAssignmentsMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsClient().ListRolesAssignments(ctx, "aoiresourceGroupName", "dataproduct01", map[string]any{}, 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.ListRoleAssignments = armnetworkanalytics.ListRoleAssignments{ - // Count: to.Ptr[int32](1), - // RoleAssignmentResponse: []*armnetworkanalytics.RoleAssignmentDetail{ - // { - // DataTypeScope: []*string{ - // to.Ptr("scope")}, - // PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // PrincipalType: to.Ptr("User"), - // Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - // RoleAssignmentID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - // UserName: to.Ptr("UserName"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_RemoveUserRole_MaximumSet_Gen.json -func ExampleDataProductsClient_RemoveUserRole_dataProductsRemoveUserRoleMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataProductsClient().RemoveUserRole(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.RoleAssignmentDetail{ - DataTypeScope: []*string{ - to.Ptr("scope")}, - PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - PrincipalType: to.Ptr("User"), - Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - RoleAssignmentID: to.Ptr("00000000-0000-0000-0000-00000000000"), - RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - UserName: to.Ptr("UserName"), - }, 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_RemoveUserRole_MinimumSet_Gen.json -func ExampleDataProductsClient_RemoveUserRole_dataProductsRemoveUserRoleMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataProductsClient().RemoveUserRole(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.RoleAssignmentDetail{ - DataTypeScope: []*string{ - to.Ptr("scope")}, - PrincipalID: to.Ptr("00000000-0000-0000-0000-00000000000"), - PrincipalType: to.Ptr("User"), - Role: to.Ptr(armnetworkanalytics.DataProductUserRoleReader), - RoleAssignmentID: to.Ptr("00000000-0000-0000-0000-00000000000"), - RoleID: to.Ptr("00000000-0000-0000-0000-00000000000"), - UserName: to.Ptr("UserName"), - }, 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_RotateKey_MaximumSet_Gen.json -func ExampleDataProductsClient_RotateKey_dataProductsRotateKeyMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataProductsClient().RotateKey(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.KeyVaultInfo{ - KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - }, 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProducts_RotateKey_MinimumSet_Gen.json -func ExampleDataProductsClient_RotateKey_dataProductsRotateKeyMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataProductsClient().RotateKey(ctx, "aoiresourceGroupName", "dataproduct01", armnetworkanalytics.KeyVaultInfo{ - KeyVaultURL: to.Ptr("https://myKeyVault.vault.azure.net"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/dataproductscatalogs_client_example_test.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/dataproductscatalogs_client_example_test.go deleted file mode 100644 index 011ad4b61e9b..000000000000 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/dataproductscatalogs_client_example_test.go +++ /dev/null @@ -1,266 +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 armnetworkanalytics_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkanalytics/armnetworkanalytics" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProductsCatalogs_ListBySubscription_MaximumSet_Gen.json -func ExampleDataProductsCatalogsClient_NewListBySubscriptionPager_dataProductsCatalogsListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsCatalogsClient().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.DataProductsCatalogListResult = armnetworkanalytics.DataProductsCatalogListResult{ - // Value: []*armnetworkanalytics.DataProductsCatalog{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/dataProductsCatalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataProductsCatalogProperties{ - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // Publishers: []*armnetworkanalytics.PublisherInformation{ - // { - // DataProducts: []*armnetworkanalytics.DataProductInformation{ - // { - // Description: to.Ptr("Official data product for Mobile Content Cloud."), - // DataProductName: to.Ptr("MCC"), - // DataProductVersions: []*armnetworkanalytics.DataProductVersion{ - // { - // Version: to.Ptr("1.0.0"), - // }}, - // }}, - // PublisherName: to.Ptr("Microsoft"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProductsCatalogs_ListBySubscription_MinimumSet_Gen.json -func ExampleDataProductsCatalogsClient_NewListBySubscriptionPager_dataProductsCatalogsListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsCatalogsClient().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.DataProductsCatalogListResult = armnetworkanalytics.DataProductsCatalogListResult{ - // Value: []*armnetworkanalytics.DataProductsCatalog{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProductsCatalogs_ListByResourceGroup_MaximumSet_Gen.json -func ExampleDataProductsCatalogsClient_NewListByResourceGroupPager_dataProductsCatalogsListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsCatalogsClient().NewListByResourceGroupPager("aoiresourceGroupName", 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.DataProductsCatalogListResult = armnetworkanalytics.DataProductsCatalogListResult{ - // Value: []*armnetworkanalytics.DataProductsCatalog{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/dataProductsCatalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataProductsCatalogProperties{ - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // Publishers: []*armnetworkanalytics.PublisherInformation{ - // { - // DataProducts: []*armnetworkanalytics.DataProductInformation{ - // { - // Description: to.Ptr("Official data product for Mobile Content Cloud."), - // DataProductName: to.Ptr("MCC"), - // DataProductVersions: []*armnetworkanalytics.DataProductVersion{ - // { - // Version: to.Ptr("1.0.0"), - // }}, - // }}, - // PublisherName: to.Ptr("Microsoft"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProductsCatalogs_ListByResourceGroup_MinimumSet_Gen.json -func ExampleDataProductsCatalogsClient_NewListByResourceGroupPager_dataProductsCatalogsListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataProductsCatalogsClient().NewListByResourceGroupPager("aoiresourceGroupName", 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.DataProductsCatalogListResult = armnetworkanalytics.DataProductsCatalogListResult{ - // Value: []*armnetworkanalytics.DataProductsCatalog{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProductsCatalogs_Get_MaximumSet_Gen.json -func ExampleDataProductsCatalogsClient_Get_dataProductsCatalogsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsCatalogsClient().Get(ctx, "aoiresourceGroupName", 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.DataProductsCatalog = armnetworkanalytics.DataProductsCatalog{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/dataProductsCatalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataProductsCatalogProperties{ - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // Publishers: []*armnetworkanalytics.PublisherInformation{ - // { - // DataProducts: []*armnetworkanalytics.DataProductInformation{ - // { - // Description: to.Ptr("Official data product for Mobile Content Cloud."), - // DataProductName: to.Ptr("MCC"), - // DataProductVersions: []*armnetworkanalytics.DataProductVersion{ - // { - // Version: to.Ptr("1.0.0"), - // }}, - // }}, - // PublisherName: to.Ptr("Microsoft"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataProductsCatalogs_Get_MinimumSet_Gen.json -func ExampleDataProductsCatalogsClient_Get_dataProductsCatalogsGetMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataProductsCatalogsClient().Get(ctx, "aoiresourceGroupName", 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.DataProductsCatalog = armnetworkanalytics.DataProductsCatalog{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"), - // } -} diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/datatypes_client_example_test.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/datatypes_client_example_test.go deleted file mode 100644 index 2df503e3bff1..000000000000 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/datatypes_client_example_test.go +++ /dev/null @@ -1,464 +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 armnetworkanalytics_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/networkanalytics/armnetworkanalytics" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_ListByDataProduct_MaximumSet_Gen.json -func ExampleDataTypesClient_NewListByDataProductPager_dataTypesListByDataProductMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataTypesClient().NewListByDataProductPager("aoiresourceGroupName", "dataproduct01", 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.DataTypeListResult = armnetworkanalytics.DataTypeListResult{ - // Value: []*armnetworkanalytics.DataType{ - // { - // Name: to.Ptr("datatypename"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts/DataTypes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProducts/dataproduct01/dataTypes/datatypename"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataTypeProperties{ - // DatabaseCacheRetention: to.Ptr[int32](23), - // DatabaseRetention: to.Ptr[int32](6), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // State: to.Ptr(armnetworkanalytics.DataTypeState("STARTED")), - // StateReason: to.Ptr("state Reason"), - // StorageOutputRetention: to.Ptr[int32](27), - // VisualizationURL: to.Ptr("visualizationUrl"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_ListByDataProduct_MinimumSet_Gen.json -func ExampleDataTypesClient_NewListByDataProductPager_dataTypesListByDataProductMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataTypesClient().NewListByDataProductPager("aoiresourceGroupName", "dataproduct01", 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.DataTypeListResult = armnetworkanalytics.DataTypeListResult{ - // Value: []*armnetworkanalytics.DataType{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProducts/dataproduct01/dataTypes/datatypename"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Get_MaximumSet_Gen.json -func ExampleDataTypesClient_Get_dataTypesGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataTypesClient().Get(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", 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.DataType = armnetworkanalytics.DataType{ - // Name: to.Ptr("datatypename"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts/DataTypes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProducts/dataproduct01/dataTypes/datatypename"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataTypeProperties{ - // DatabaseCacheRetention: to.Ptr[int32](23), - // DatabaseRetention: to.Ptr[int32](6), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // State: to.Ptr(armnetworkanalytics.DataTypeState("STARTED")), - // StateReason: to.Ptr("state Reason"), - // StorageOutputRetention: to.Ptr[int32](27), - // VisualizationURL: to.Ptr("visualizationUrl"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Get_MinimumSet_Gen.json -func ExampleDataTypesClient_Get_dataTypesGetMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataTypesClient().Get(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", 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.DataType = armnetworkanalytics.DataType{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProducts/dataproduct01/dataTypes/datatypename"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Create_MaximumSet_Gen.json -func ExampleDataTypesClient_BeginCreate_dataTypesCreateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginCreate(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", armnetworkanalytics.DataType{ - Properties: &armnetworkanalytics.DataTypeProperties{ - DatabaseCacheRetention: to.Ptr[int32](23), - DatabaseRetention: to.Ptr[int32](6), - ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - State: to.Ptr(armnetworkanalytics.DataTypeState("STARTED")), - StorageOutputRetention: to.Ptr[int32](27), - }, - }, 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.DataType = armnetworkanalytics.DataType{ - // Name: to.Ptr("datatypeName"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts/DataTypes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProducts/dataproduct01/dataTypes/datatypename"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataTypeProperties{ - // DatabaseCacheRetention: to.Ptr[int32](23), - // DatabaseRetention: to.Ptr[int32](6), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // State: to.Ptr(armnetworkanalytics.DataTypeState("STARTED")), - // StateReason: to.Ptr("State Reason"), - // StorageOutputRetention: to.Ptr[int32](27), - // VisualizationURL: to.Ptr("visualizationUrl"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Create_MinimumSet_Gen.json -func ExampleDataTypesClient_BeginCreate_dataTypesCreateMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginCreate(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", armnetworkanalytics.DataType{}, 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.DataType = armnetworkanalytics.DataType{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Update_MaximumSet_Gen.json -func ExampleDataTypesClient_BeginUpdate_dataTypesUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginUpdate(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", armnetworkanalytics.DataTypeUpdate{ - Properties: &armnetworkanalytics.DataTypeUpdateProperties{ - DatabaseCacheRetention: to.Ptr[int32](16), - DatabaseRetention: to.Ptr[int32](9), - State: to.Ptr(armnetworkanalytics.DataTypeState("STARTED")), - StorageOutputRetention: to.Ptr[int32](30), - }, - }, 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.DataType = armnetworkanalytics.DataType{ - // Name: to.Ptr("datatypename"), - // Type: to.Ptr("Microsoft.NetworkAnalytics/DataProducts/DataTypes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/aoiresourceGroupName/providers/Microsoft.NetworkAnalytics/dataProducts/dataproduct01/dataTypes/datatypename"), - // SystemData: &armnetworkanalytics.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // CreatedBy: to.Ptr("abc@micros.com"), - // CreatedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T08:26:27.150Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@micros.com"), - // LastModifiedByType: to.Ptr(armnetworkanalytics.CreatedByTypeUser), - // }, - // Properties: &armnetworkanalytics.DataTypeProperties{ - // DatabaseCacheRetention: to.Ptr[int32](16), - // DatabaseRetention: to.Ptr[int32](9), - // ProvisioningState: to.Ptr(armnetworkanalytics.ProvisioningStateSucceeded), - // State: to.Ptr(armnetworkanalytics.DataTypeState("STARTED")), - // StateReason: to.Ptr("State Reason"), - // StorageOutputRetention: to.Ptr[int32](30), - // VisualizationURL: to.Ptr("visualizationUrl"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Update_MinimumSet_Gen.json -func ExampleDataTypesClient_BeginUpdate_dataTypesUpdateMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginUpdate(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", armnetworkanalytics.DataTypeUpdate{}, 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.DataType = armnetworkanalytics.DataType{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Delete_MaximumSet_Gen.json -func ExampleDataTypesClient_BeginDelete_dataTypesDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginDelete(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_Delete_MinimumSet_Gen.json -func ExampleDataTypesClient_BeginDelete_dataTypesDeleteMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginDelete(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_DeleteData_MaximumSet_Gen.json -func ExampleDataTypesClient_BeginDeleteData_dataTypesDeleteDataMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginDeleteData(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", map[string]any{}, 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_DeleteData_MinimumSet_Gen.json -func ExampleDataTypesClient_BeginDeleteData_dataTypesDeleteDataMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataTypesClient().BeginDeleteData(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", map[string]any{}, 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/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_GenerateStorageContainerSasToken_MaximumSet_Gen.json -func ExampleDataTypesClient_GenerateStorageContainerSasToken_dataTypesGenerateStorageContainerSasTokenMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataTypesClient().GenerateStorageContainerSasToken(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", armnetworkanalytics.ContainerSaS{ - ExpiryTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:34:58.039Z"); return t }()), - IPAddress: to.Ptr("1.1.1.1"), - StartTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:34:58.039Z"); return 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.ContainerSasToken = armnetworkanalytics.ContainerSasToken{ - // StorageContainerSasToken: to.Ptr("storageContainerSasToken"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/DataTypes_GenerateStorageContainerSasToken_MinimumSet_Gen.json -func ExampleDataTypesClient_GenerateStorageContainerSasToken_dataTypesGenerateStorageContainerSasTokenMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataTypesClient().GenerateStorageContainerSasToken(ctx, "aoiresourceGroupName", "dataproduct01", "datatypename", armnetworkanalytics.ContainerSaS{ - ExpiryTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:35:16.887Z"); return t }()), - IPAddress: to.Ptr("1.1.1.1"), - StartTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T05:35:16.887Z"); return 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.ContainerSasToken = armnetworkanalytics.ContainerSasToken{ - // StorageContainerSasToken: to.Ptr("storageContainerSasToken"), - // } -} diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/fake/time_rfc3339.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/fake/time_rfc3339.go +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/fake/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/networkanalytics/armnetworkanalytics/go.mod b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.mod index 28e0873dbe18..8ca851d04c63 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.mod +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkanalytics/ar go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.sum b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.sum +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models.go index 48a4869d8ec2..b3783801d6ad 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models.go +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models.go @@ -198,7 +198,7 @@ type DataProductUpdate struct { // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // The updatable properties of the DataProduct. + // The resource-specific properties for this resource. Properties *DataProductUpdateProperties // Resource tags. @@ -318,7 +318,7 @@ type DataTypeProperties struct { // DataTypeUpdate - The type used for update operations of the DataType. type DataTypeUpdate struct { - // The updatable properties of the DataType. + // The resource-specific properties for this resource. Properties *DataTypeUpdateProperties } diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models_serde.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models_serde.go index c9f2b7da320b..a2ec95104eec 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models_serde.go +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/models_serde.go @@ -1410,7 +1410,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/networkanalytics/armnetworkanalytics/operations_client_example_test.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/operations_client_example_test.go deleted file mode 100644 index 7d3a45828080..000000000000 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/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 armnetworkanalytics_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/networkanalytics/armnetworkanalytics" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.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 = armnetworkanalytics.OperationListResult{ - // Value: []*armnetworkanalytics.Operation{ - // { - // Name: to.Ptr("Microsoft.NetworkAnalytics/resourceName/operationName"), - // ActionType: to.Ptr(armnetworkanalytics.ActionTypeInternal), - // Display: &armnetworkanalytics.OperationDisplay{ - // Description: to.Ptr("Description of the operation"), - // Operation: to.Ptr("OperationName"), - // Provider: to.Ptr("Microsoft.NetworkAnalytics"), - // Resource: to.Ptr("ResourceName"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armnetworkanalytics.OriginUser), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/21a8d55d74e4425e96d76e5835f52cfc9eb95a22/specification/networkanalytics/resource-manager/Microsoft.NetworkAnalytics/stable/2023-11-15/examples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMinimumSetRuleMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armnetworkanalytics.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 = armnetworkanalytics.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/response_types.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/responses.go similarity index 100% rename from sdk/resourcemanager/networkanalytics/armnetworkanalytics/response_types.go rename to sdk/resourcemanager/networkanalytics/armnetworkanalytics/responses.go diff --git a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/time_rfc3339.go b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/time_rfc3339.go index 1a4afc9adfe0..044b7085d9af 100644 --- a/sdk/resourcemanager/networkanalytics/armnetworkanalytics/time_rfc3339.go +++ b/sdk/resourcemanager/networkanalytics/armnetworkanalytics/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/oracledatabase/armoracledatabase/CHANGELOG.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md index 075358ad45d9..fd96542776fa 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## 1.1.0 (2024-08-09) +### Features Added + +- New enum type `AddSubscriptionOperationState` with values `AddSubscriptionOperationStateFailed`, `AddSubscriptionOperationStateSucceeded`, `AddSubscriptionOperationStateUpdating` +- New function `*OracleSubscriptionsClient.BeginAddAzureSubscriptions(context.Context, AzureSubscriptions, *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*runtime.Poller[OracleSubscriptionsClientAddAzureSubscriptionsResponse], error)` +- New struct `AzureSubscriptions` +- New field `AddSubscriptionOperationState`, `AzureSubscriptionIDs`, `LastOperationStatusDetail` in struct `OracleSubscriptionProperties` + + ## 1.0.0 (2024-06-28) ### Other Changes diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go index d58cf43d6ebc..722005b99e0e 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go @@ -46,7 +46,7 @@ func NewAutonomousDatabaseBackupsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Create a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -74,7 +74,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Create a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabaseBackupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabaseBackupsClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -132,7 +132,7 @@ func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx c // BeginDelete - Delete a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -159,7 +159,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginDelete(ctx context.Context, // Delete - Delete a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabaseBackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabaseBackupsClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.C // Get - Get a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -266,7 +266,7 @@ func (client *AutonomousDatabaseBackupsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *AutonomousDatabaseBackupsClient) getHandleResponse(resp *http.Resp // NewListByAutonomousDatabasePager - List AutonomousDatabaseBackup resources by AutonomousDatabase // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager @@ -331,7 +331,7 @@ func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseHandleRes // BeginUpdate - Update a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -377,7 +377,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginUpdate(ctx context.Context, // Update - Update a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabaseBackupsClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabaseBackupsClient.BeginUpdate" @@ -423,7 +423,7 @@ func (client *AutonomousDatabaseBackupsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") 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/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.go deleted file mode 100644 index 75398af87322..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_listByParent.json -func ExampleAutonomousDatabaseBackupsClient_NewListByAutonomousDatabasePager_autonomousDatabaseBackupsListByAutonomousDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseBackupsClient().NewListByAutonomousDatabasePager("rg000", "databasedb1", 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.AutonomousDatabaseBackupListResult = armoracledatabase.AutonomousDatabaseBackupListResult{ - // Value: []*armoracledatabase.AutonomousDatabaseBackup{ - // { - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup completed successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](365), - // SizeInTbs: to.Ptr[float64](2), - // TimeAvailableTil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-09T20:44:09.466Z"); return t}()), - // TimeEnded: to.Ptr("2024-01-09T20:44:09.466Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_get.json -func ExampleAutonomousDatabaseBackupsClient_Get_autonomousDatabaseBackupsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseBackupsClient().Get(ctx, "rg000", "databasedb1", "1711644130", 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.AutonomousDatabaseBackup = armoracledatabase.AutonomousDatabaseBackup{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup completed successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](365), - // SizeInTbs: to.Ptr[float64](2), - // TimeAvailableTil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-09T20:44:09.466Z"); return t}()), - // TimeEnded: to.Ptr("2024-01-09T20:44:09.466Z"), - // TimeStarted: to.Ptr("2024-01-09T19:44:09.466Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_create.json -func ExampleAutonomousDatabaseBackupsClient_BeginCreateOrUpdate_autonomousDatabaseBackupsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginCreateOrUpdate(ctx, "rg000", "databasedb1", "1711644130", armoracledatabase.AutonomousDatabaseBackup{ - Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - DisplayName: to.Ptr("Nightly Backup"), - RetentionPeriodInDays: to.Ptr[int32](365), - }, - }, 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.AutonomousDatabaseBackup = armoracledatabase.AutonomousDatabaseBackup{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup completed successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](365), - // SizeInTbs: to.Ptr[float64](2), - // TimeAvailableTil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-09T20:44:09.466Z"); return t}()), - // TimeEnded: to.Ptr("2024-01-09T20:44:09.466Z"), - // TimeStarted: to.Ptr("2024-01-09T19:44:09.466Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_patch.json -func ExampleAutonomousDatabaseBackupsClient_BeginUpdate_autonomousDatabaseBackupsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginUpdate(ctx, "rg000", "databasedb1", "1711644130", armoracledatabase.AutonomousDatabaseBackupUpdate{}, 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.AutonomousDatabaseBackup = armoracledatabase.AutonomousDatabaseBackup{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup updated successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](400), - // SizeInTbs: to.Ptr[float64](2), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_delete.json -func ExampleAutonomousDatabaseBackupsClient_BeginDelete_autonomousDatabaseBackupsDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginDelete(ctx, "rg000", "databasedb1", "1711644130", 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/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go index 702e11648ed2..42c7871b2ce4 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go @@ -46,7 +46,7 @@ func NewAutonomousDatabaseCharacterSetsClient(subscriptionID string, credential // Get - Get a AutonomousDatabaseCharacterSet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - adbscharsetname - AutonomousDatabaseCharacterSet name // - options - AutonomousDatabaseCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.Get @@ -93,7 +93,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +110,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) getHandleResponse(resp *htt // NewListByLocationPager - List AutonomousDatabaseCharacterSet resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - AutonomousDatabaseCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.NewListByLocationPager // method. @@ -153,7 +153,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) listByLocationCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go deleted file mode 100644 index 585ac7c2378b..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go +++ /dev/null @@ -1,87 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseCharacterSet_listByLocation.json -func ExampleAutonomousDatabaseCharacterSetsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseCharacterSetsClient().NewListByLocationPager("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.AutonomousDatabaseCharacterSetListResult = armoracledatabase.AutonomousDatabaseCharacterSetListResult{ - // Value: []*armoracledatabase.AutonomousDatabaseCharacterSet{ - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseCharacterSets/DATABASE"), - // Properties: &armoracledatabase.AutonomousDatabaseCharacterSetProperties{ - // CharacterSet: to.Ptr("AL32UTF8"), - // }, - // }, - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseCharacterSets/DATABASE"), - // Properties: &armoracledatabase.AutonomousDatabaseCharacterSetProperties{ - // CharacterSet: to.Ptr("UTF8"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseCharacterSet_get.json -func ExampleAutonomousDatabaseCharacterSetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseCharacterSetsClient().Get(ctx, "eastus", "DATABASE", 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.AutonomousDatabaseCharacterSet = armoracledatabase.AutonomousDatabaseCharacterSet{ - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseCharacterSets/DATABASE"), - // Properties: &armoracledatabase.AutonomousDatabaseCharacterSetProperties{ - // CharacterSet: to.Ptr("AL32UTF8"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go index 9b5a8455510d..b57590e8292a 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go @@ -46,7 +46,7 @@ func NewAutonomousDatabaseNationalCharacterSetsClient(subscriptionID string, cre // Get - Get a AutonomousDatabaseNationalCharacterSet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - adbsncharsetname - AutonomousDatabaseNationalCharacterSets name // - options - AutonomousDatabaseNationalCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.Get @@ -93,7 +93,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +110,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) getHandleResponse(r // NewListByLocationPager - List AutonomousDatabaseNationalCharacterSet resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager // method. @@ -153,7 +153,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) listByLocationCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client_example_test.go deleted file mode 100644 index 19a978249b59..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseNationalCharacterSet_listByLocation.json -func ExampleAutonomousDatabaseNationalCharacterSetsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseNationalCharacterSetsClient().NewListByLocationPager("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.AutonomousDatabaseNationalCharacterSetListResult = armoracledatabase.AutonomousDatabaseNationalCharacterSetListResult{ - // Value: []*armoracledatabase.AutonomousDatabaseNationalCharacterSet{ - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseNationalCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseNationalCharacterSets/NATIONAL"), - // Properties: &armoracledatabase.AutonomousDatabaseNationalCharacterSetProperties{ - // CharacterSet: to.Ptr("AL16UTF16"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseNationalCharacterSet_get.json -func ExampleAutonomousDatabaseNationalCharacterSetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseNationalCharacterSetsClient().Get(ctx, "eastus", "NATIONAL", 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.AutonomousDatabaseNationalCharacterSet = armoracledatabase.AutonomousDatabaseNationalCharacterSet{ - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseNationalCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseNationalCharacterSets/NATIONAL"), - // Properties: &armoracledatabase.AutonomousDatabaseNationalCharacterSetProperties{ - // CharacterSet: to.Ptr("AL16UTF16"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go index 63903cb2797c..4bde04183f3e 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go @@ -46,7 +46,7 @@ func NewAutonomousDatabasesClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Create a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - resource - Resource create parameters. @@ -73,7 +73,7 @@ func (client *AutonomousDatabasesClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, options *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,7 @@ func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabasesClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabasesClient.BeginDelete @@ -153,7 +153,7 @@ func (client *AutonomousDatabasesClient) BeginDelete(ctx context.Context, resour // Delete - Delete a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginDelete" @@ -195,7 +195,7 @@ func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +204,7 @@ func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context // BeginFailover - Perform failover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -231,7 +231,7 @@ func (client *AutonomousDatabasesClient) BeginFailover(ctx context.Context, reso // Failover - Perform failover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) failover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginFailoverOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginFailover" @@ -273,7 +273,7 @@ func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -285,7 +285,7 @@ func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Conte // GenerateWallet - Generate wallet action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -333,7 +333,7 @@ func (client *AutonomousDatabasesClient) generateWalletCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -354,7 +354,7 @@ func (client *AutonomousDatabasesClient) generateWalletHandleResponse(resp *http // Get - Get a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabasesClientGetOptions contains the optional parameters for the AutonomousDatabasesClient.Get method. @@ -400,7 +400,7 @@ func (client *AutonomousDatabasesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -417,7 +417,7 @@ func (client *AutonomousDatabasesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - List AutonomousDatabase resources by resource group // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AutonomousDatabasesClientListByResourceGroupOptions contains the optional parameters for the AutonomousDatabasesClient.NewListByResourceGroupPager // method. @@ -460,7 +460,7 @@ func (client *AutonomousDatabasesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +477,7 @@ func (client *AutonomousDatabasesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - List AutonomousDatabase resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - AutonomousDatabasesClientListBySubscriptionOptions contains the optional parameters for the AutonomousDatabasesClient.NewListBySubscriptionPager // method. func (client *AutonomousDatabasesClient) NewListBySubscriptionPager(options *AutonomousDatabasesClientListBySubscriptionOptions) *runtime.Pager[AutonomousDatabasesClientListBySubscriptionResponse] { @@ -515,7 +515,7 @@ func (client *AutonomousDatabasesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -533,7 +533,7 @@ func (client *AutonomousDatabasesClient) listBySubscriptionHandleResponse(resp * // BeginRestore - Restores an Autonomous Database based on the provided request parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -560,7 +560,7 @@ func (client *AutonomousDatabasesClient) BeginRestore(ctx context.Context, resou // Restore - Restores an Autonomous Database based on the provided request parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) restore(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body RestoreAutonomousDatabaseDetails, options *AutonomousDatabasesClientBeginRestoreOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginRestore" @@ -602,7 +602,7 @@ func (client *AutonomousDatabasesClient) restoreCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -614,7 +614,7 @@ func (client *AutonomousDatabasesClient) restoreCreateRequest(ctx context.Contex // BeginShrink - This operation shrinks the current allocated storage down to the current actual used data storage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabasesClientBeginShrinkOptions contains the optional parameters for the AutonomousDatabasesClient.BeginShrink @@ -640,7 +640,7 @@ func (client *AutonomousDatabasesClient) BeginShrink(ctx context.Context, resour // Shrink - This operation shrinks the current allocated storage down to the current actual used data storage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) shrink(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginShrinkOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginShrink" @@ -682,7 +682,7 @@ func (client *AutonomousDatabasesClient) shrinkCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -691,7 +691,7 @@ func (client *AutonomousDatabasesClient) shrinkCreateRequest(ctx context.Context // BeginSwitchover - Perform switchover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -718,7 +718,7 @@ func (client *AutonomousDatabasesClient) BeginSwitchover(ctx context.Context, re // Switchover - Perform switchover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) switchover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginSwitchoverOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginSwitchover" @@ -760,7 +760,7 @@ func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -772,7 +772,7 @@ func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Con // BeginUpdate - Update a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - properties - The resource properties to be updated. @@ -799,7 +799,7 @@ func (client *AutonomousDatabasesClient) BeginUpdate(ctx context.Context, resour // Update - Update a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *AutonomousDatabasesClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, options *AutonomousDatabasesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginUpdate" @@ -841,7 +841,7 @@ func (client *AutonomousDatabasesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") 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/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go deleted file mode 100644 index 46bb0e233563..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go +++ /dev/null @@ -1,783 +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 armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_listBySubscription.json -func ExampleAutonomousDatabasesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabasesClient().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.AutonomousDatabaseListResult = armoracledatabase.AutonomousDatabaseListResult{ - // Value: []*armoracledatabase.AutonomousDatabase{ - // { - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_listByResourceGroup.json -func ExampleAutonomousDatabasesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabasesClient().NewListByResourceGroupPager("rg000", 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.AutonomousDatabaseListResult = armoracledatabase.AutonomousDatabaseListResult{ - // Value: []*armoracledatabase.AutonomousDatabase{ - // { - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_get.json -func ExampleAutonomousDatabasesClient_Get_autonomousDatabasesGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabasesClient().Get(ctx, "rg000", "databasedb1", 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_create.json -func ExampleAutonomousDatabasesClient_BeginCreateOrUpdate_autonomousDatabasesCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginCreateOrUpdate(ctx, "rg000", "databasedb1", armoracledatabase.AutonomousDatabase{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.AutonomousDatabaseProperties{ - AdminPassword: to.Ptr("********"), - CharacterSet: to.Ptr("AL32UTF8"), - ComputeCount: to.Ptr[float32](2), - ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - DataStorageSizeInTbs: to.Ptr[int32](1), - DbVersion: to.Ptr("18.4.0.0"), - DisplayName: to.Ptr("example_autonomous_databasedb1"), - NcharacterSet: to.Ptr("AL16UTF16"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - }, - }, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseClone_create.json -func ExampleAutonomousDatabasesClient_BeginCreateOrUpdate_autonomousDatabasesCreateOrUpdateClone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginCreateOrUpdate(ctx, "rg000", "databasedb1", armoracledatabase.AutonomousDatabase{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.AutonomousDatabaseCloneProperties{ - AdminPassword: to.Ptr("********"), - CharacterSet: to.Ptr("AL32UTF8"), - ComputeCount: to.Ptr[float32](2), - ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeClone), - DataStorageSizeInTbs: to.Ptr[int32](1), - DisplayName: to.Ptr("example_autonomous_databasedb1_clone"), - NcharacterSet: to.Ptr("AL16UTF16"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - CloneType: to.Ptr(armoracledatabase.CloneTypeFull), - SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - }, - }, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseCloneProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1Clone"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeClone), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // CloneType: to.Ptr(armoracledatabase.CloneTypeFull), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_patch.json -func ExampleAutonomousDatabasesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginUpdate(ctx, "rg000", "databasedb1", armoracledatabase.AutonomousDatabaseUpdate{}, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_delete.json -func ExampleAutonomousDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginDelete(ctx, "rg000", "databasedb1", 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_failover.json -func ExampleAutonomousDatabasesClient_BeginFailover_autonomousDatabasesFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginFailover(ctx, "rg000", "databasedb1", armoracledatabase.PeerDbDetails{ - PeerDbID: to.Ptr("peerDbId"), - }, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(true), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), - // LocalAdgAutoFailoverMaxDataLossLimit: to.Ptr[int32](300), - // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeAdg), - // LocalStandbyDb: &armoracledatabase.AutonomousDatabaseStandbySummary{ - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRoleChangeInProgress), - // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Role: to.Ptr(armoracledatabase.RoleTypePrimary), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // TimeLocalDataGuardEnabled: to.Ptr("2024-02-28T19:03:43.714Z"), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_generateWallet.json -func ExampleAutonomousDatabasesClient_GenerateWallet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabasesClient().GenerateWallet(ctx, "rg000", "databasedb1", armoracledatabase.GenerateAutonomousDatabaseWalletDetails{ - GenerateType: to.Ptr(armoracledatabase.GenerateTypeSingle), - IsRegional: to.Ptr(false), - Password: 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.AutonomousDatabaseWalletFile = armoracledatabase.AutonomousDatabaseWalletFile{ - // WalletFiles: to.Ptr("testEncodedFiles"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_restore.json -func ExampleAutonomousDatabasesClient_BeginRestore_autonomousDatabasesRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginRestore(ctx, "rg000", "databasedb1", armoracledatabase.RestoreAutonomousDatabaseDetails{ - Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-23T00:00:00.000Z"); return t }()), - }, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // BackupRetentionPeriodInDays: to.Ptr[int32](60), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr(""), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRestoreInProgress), - // LongTermBackupSchedule: &armoracledatabase.LongTermBackUpScheduleDetails{ - // RepeatCadence: to.Ptr(armoracledatabase.RepeatCadenceTypeWeekly), - // RetentionPeriodInDays: to.Ptr[int32](365), - // TimeOfBackup: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-21T21:03:41.309Z"); return t}()), - // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // NextLongTermBackupTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-24T21:03:41.000Z"); return t}()), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_shrink.json -func ExampleAutonomousDatabasesClient_BeginShrink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginShrink(ctx, "rg000", "databasedb1", 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // BackupRetentionPeriodInDays: to.Ptr[int32](90), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr(""), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateScaleInProgress), - // LongTermBackupSchedule: &armoracledatabase.LongTermBackUpScheduleDetails{ - // RepeatCadence: to.Ptr(armoracledatabase.RepeatCadenceTypeWeekly), - // RetentionPeriodInDays: to.Ptr[int32](365), - // TimeOfBackup: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-21T21:03:41.309Z"); return t}()), - // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // NextLongTermBackupTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-24T21:03:41.000Z"); return t}()), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_switchover.json -func ExampleAutonomousDatabasesClient_BeginSwitchover_autonomousDatabasesSwitchover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginSwitchover(ctx, "rg000", "databasedb1", armoracledatabase.PeerDbDetails{ - PeerDbID: to.Ptr("peerDbId"), - }, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), - // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeBackupBased), - // LocalStandbyDb: &armoracledatabase.AutonomousDatabaseStandbySummary{ - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRoleChangeInProgress), - // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Role: to.Ptr(armoracledatabase.RoleTypePrimary), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // TimeOfLastSwitchover: to.Ptr("2024-02-27T18:37:08.069Z"), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go index f0a5ec4d4ac7..6add6c424b99 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go @@ -46,7 +46,7 @@ func NewAutonomousDatabaseVersionsClient(subscriptionID string, credential azcor // Get - Get a AutonomousDbVersion // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - autonomousdbversionsname - AutonomousDbVersion name // - options - AutonomousDatabaseVersionsClientGetOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.Get @@ -93,7 +93,7 @@ func (client *AutonomousDatabaseVersionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +110,7 @@ func (client *AutonomousDatabaseVersionsClient) getHandleResponse(resp *http.Res // NewListByLocationPager - List AutonomousDbVersion resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - AutonomousDatabaseVersionsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.NewListByLocationPager // method. @@ -153,7 +153,7 @@ func (client *AutonomousDatabaseVersionsClient) listByLocationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client_example_test.go deleted file mode 100644 index b1fecf02bc8f..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseVersion_listByLocation.json -func ExampleAutonomousDatabaseVersionsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseVersionsClient().NewListByLocationPager("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.AutonomousDbVersionListResult = armoracledatabase.AutonomousDbVersionListResult{ - // Value: []*armoracledatabase.AutonomousDbVersion{ - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDbVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDbVersions/18.4.0.0"), - // Properties: &armoracledatabase.AutonomousDbVersionProperties{ - // Version: to.Ptr("18.4.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseVersion_get.json -func ExampleAutonomousDatabaseVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseVersionsClient().Get(ctx, "eastus", "18.4.0.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.AutonomousDbVersion = armoracledatabase.AutonomousDbVersion{ - // Type: to.Ptr("Oracle.Database/locations/autonomousDbVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDbVersions/18.4.0.0"), - // Properties: &armoracledatabase.AutonomousDbVersionProperties{ - // Version: to.Ptr("18.4.0.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md index ed61e73ab132..ef495c1d628f 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/oracle/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/oracle/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2023-09-01 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go index 0360d1e588a8..dd88c0bbe15b 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go @@ -46,7 +46,7 @@ func NewCloudExadataInfrastructuresClient(subscriptionID string, credential azco // BeginAddStorageCapacity - Perform add storage capacity on exadata infra // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginAddStorageCapacity @@ -72,7 +72,7 @@ func (client *CloudExadataInfrastructuresClient) BeginAddStorageCapacity(ctx con // AddStorageCapacity - Perform add storage capacity on exadata infra // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudExadataInfrastructuresClient) addStorageCapacity(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginAddStorageCapacity" @@ -114,7 +114,7 @@ func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,7 @@ func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest // BeginCreateOrUpdate - Create a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - resource - Resource create parameters. @@ -150,7 +150,7 @@ func (client *CloudExadataInfrastructuresClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Create a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudExadataInfrastructuresClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, options *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginCreateOrUpdate" @@ -192,7 +192,7 @@ func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -204,7 +204,7 @@ func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - CloudExadataInfrastructuresClientBeginDeleteOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginDelete @@ -230,7 +230,7 @@ func (client *CloudExadataInfrastructuresClient) BeginDelete(ctx context.Context // Delete - Delete a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudExadataInfrastructuresClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginDelete" @@ -272,7 +272,7 @@ func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context // Get - Get a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - CloudExadataInfrastructuresClientGetOptions contains the optional parameters for the CloudExadataInfrastructuresClient.Get @@ -328,7 +328,7 @@ func (client *CloudExadataInfrastructuresClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,7 +345,7 @@ func (client *CloudExadataInfrastructuresClient) getHandleResponse(resp *http.Re // NewListByResourceGroupPager - List CloudExadataInfrastructure resources by resource group // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudExadataInfrastructuresClientListByResourceGroupOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListByResourceGroupPager // method. @@ -388,7 +388,7 @@ func (client *CloudExadataInfrastructuresClient) listByResourceGroupCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -405,7 +405,7 @@ func (client *CloudExadataInfrastructuresClient) listByResourceGroupHandleRespon // NewListBySubscriptionPager - List CloudExadataInfrastructure resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - CloudExadataInfrastructuresClientListBySubscriptionOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListBySubscriptionPager // method. func (client *CloudExadataInfrastructuresClient) NewListBySubscriptionPager(options *CloudExadataInfrastructuresClientListBySubscriptionOptions) *runtime.Pager[CloudExadataInfrastructuresClientListBySubscriptionResponse] { @@ -443,7 +443,7 @@ func (client *CloudExadataInfrastructuresClient) listBySubscriptionCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,7 +461,7 @@ func (client *CloudExadataInfrastructuresClient) listBySubscriptionHandleRespons // BeginUpdate - Update a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - properties - The resource properties to be updated. @@ -488,7 +488,7 @@ func (client *CloudExadataInfrastructuresClient) BeginUpdate(ctx context.Context // Update - Update a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudExadataInfrastructuresClient) update(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, options *CloudExadataInfrastructuresClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginUpdate" @@ -530,7 +530,7 @@ func (client *CloudExadataInfrastructuresClient) updateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") 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/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go deleted file mode 100644 index 1e2370003e56..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go +++ /dev/null @@ -1,615 +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 armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_listBySubscription.json -func ExampleCloudExadataInfrastructuresClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudExadataInfrastructuresClient().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.CloudExadataInfrastructureListResult = armoracledatabase.CloudExadataInfrastructureListResult{ - // Value: []*armoracledatabase.CloudExadataInfrastructure{ - // { - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_listByResourceGroup.json -func ExampleCloudExadataInfrastructuresClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudExadataInfrastructuresClient().NewListByResourceGroupPager("rg000", 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.CloudExadataInfrastructureListResult = armoracledatabase.CloudExadataInfrastructureListResult{ - // Value: []*armoracledatabase.CloudExadataInfrastructure{ - // { - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_get.json -func ExampleCloudExadataInfrastructuresClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudExadataInfrastructuresClient().Get(ctx, "rg000", "infra1", 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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_create.json -func ExampleCloudExadataInfrastructuresClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginCreateOrUpdate(ctx, "rg000", "infra1", armoracledatabase.CloudExadataInfrastructure{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - ComputeCount: to.Ptr[int32](100), - DisplayName: to.Ptr("infra 1"), - Shape: to.Ptr("EXADATA.X9M"), - StorageCount: to.Ptr[int32](10), - }, - Zones: []*string{ - to.Ptr("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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_patch.json -func ExampleCloudExadataInfrastructuresClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginUpdate(ctx, "rg000", "infra1", armoracledatabase.CloudExadataInfrastructureUpdate{}, 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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_delete.json -func ExampleCloudExadataInfrastructuresClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginDelete(ctx, "rg000", "infra1", 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_addStorageCapacity.json -func ExampleCloudExadataInfrastructuresClient_BeginAddStorageCapacity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginAddStorageCapacity(ctx, "rg000", "infra1", 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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go index cfa066618eca..326731d873f8 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go @@ -46,7 +46,7 @@ func NewCloudVMClustersClient(subscriptionID string, credential azcore.TokenCred // BeginAddVMs - Add VMs to the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - body - The content of the action request @@ -73,7 +73,7 @@ func (client *CloudVMClustersClient) BeginAddVMs(ctx context.Context, resourceGr // AddVMs - Add VMs to the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudVMClustersClient) addVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginAddVMsOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginAddVMs" @@ -115,7 +115,7 @@ func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -127,7 +127,7 @@ func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, re // BeginCreateOrUpdate - Create a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - resource - Resource create parameters. @@ -154,7 +154,7 @@ func (client *CloudVMClustersClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Create a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudVMClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, options *CloudVMClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginCreateOrUpdate" @@ -196,7 +196,7 @@ func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -208,7 +208,7 @@ func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Delete a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - options - CloudVMClustersClientBeginDeleteOptions contains the optional parameters for the CloudVMClustersClient.BeginDelete @@ -234,7 +234,7 @@ func (client *CloudVMClustersClient) BeginDelete(ctx context.Context, resourceGr // Delete - Delete a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudVMClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginDelete" @@ -276,7 +276,7 @@ func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,7 +285,7 @@ func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, re // Get - Get a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - options - CloudVMClustersClientGetOptions contains the optional parameters for the CloudVMClustersClient.Get method. @@ -331,7 +331,7 @@ func (client *CloudVMClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +348,7 @@ func (client *CloudVMClustersClient) getHandleResponse(resp *http.Response) (Clo // NewListByResourceGroupPager - List CloudVmCluster resources by resource group // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudVMClustersClientListByResourceGroupOptions contains the optional parameters for the CloudVMClustersClient.NewListByResourceGroupPager // method. @@ -391,7 +391,7 @@ func (client *CloudVMClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -408,7 +408,7 @@ func (client *CloudVMClustersClient) listByResourceGroupHandleResponse(resp *htt // NewListBySubscriptionPager - List CloudVmCluster resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - CloudVMClustersClientListBySubscriptionOptions contains the optional parameters for the CloudVMClustersClient.NewListBySubscriptionPager // method. func (client *CloudVMClustersClient) NewListBySubscriptionPager(options *CloudVMClustersClientListBySubscriptionOptions) *runtime.Pager[CloudVMClustersClientListBySubscriptionResponse] { @@ -446,7 +446,7 @@ func (client *CloudVMClustersClient) listBySubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -464,7 +464,7 @@ func (client *CloudVMClustersClient) listBySubscriptionHandleResponse(resp *http // ListPrivateIPAddresses - List Private IP Addresses by the provided filter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - body - The content of the action request @@ -512,7 +512,7 @@ func (client *CloudVMClustersClient) listPrivateIPAddressesCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -533,7 +533,7 @@ func (client *CloudVMClustersClient) listPrivateIPAddressesHandleResponse(resp * // BeginRemoveVMs - Remove VMs from the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - body - The content of the action request @@ -560,7 +560,7 @@ func (client *CloudVMClustersClient) BeginRemoveVMs(ctx context.Context, resourc // RemoveVMs - Remove VMs from the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudVMClustersClient) removeVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginRemoveVMsOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginRemoveVMs" @@ -602,7 +602,7 @@ func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -614,7 +614,7 @@ func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, // BeginUpdate - Update a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - properties - The resource properties to be updated. @@ -641,7 +641,7 @@ func (client *CloudVMClustersClient) BeginUpdate(ctx context.Context, resourceGr // Update - Update a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *CloudVMClustersClient) update(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, options *CloudVMClustersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginUpdate" @@ -683,7 +683,7 @@ func (client *CloudVMClustersClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") 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/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go deleted file mode 100644 index 14feee604fc9..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go +++ /dev/null @@ -1,813 +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 armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_listBySubscription.json -func ExampleCloudVMClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudVMClustersClient().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.CloudVMClusterListResult = armoracledatabase.CloudVMClusterListResult{ - // Value: []*armoracledatabase.CloudVMCluster{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_listByResourceGroup.json -func ExampleCloudVMClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudVMClustersClient().NewListByResourceGroupPager("rg000", 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.CloudVMClusterListResult = armoracledatabase.CloudVMClusterListResult{ - // Value: []*armoracledatabase.CloudVMCluster{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_get.json -func ExampleCloudVMClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudVMClustersClient().Get(ctx, "rg000", "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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // NsgCidrs: []*armoracledatabase.NsgCidr{ - // { - // DestinationPortRange: &armoracledatabase.PortRange{ - // Max: to.Ptr[int32](1522), - // Min: to.Ptr[int32](1520), - // }, - // Source: to.Ptr("10.0.0.0/16"), - // }, - // { - // Source: to.Ptr("10.10.0.0/24"), - // }}, - // NsgURL: to.Ptr("https://fake"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_create.json -func ExampleCloudVMClustersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginCreateOrUpdate(ctx, "rg000", "cluster1", armoracledatabase.CloudVMCluster{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.CloudVMClusterProperties{ - BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - ClusterName: to.Ptr("cluster1"), - CPUCoreCount: to.Ptr[int32](2), - DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - IsDiagnosticsEventsEnabled: to.Ptr(false), - IsHealthMonitoringEnabled: to.Ptr(false), - IsIncidentLogsEnabled: to.Ptr(false), - }, - DataStoragePercentage: to.Ptr[int32](100), - DataStorageSizeInTbs: to.Ptr[float64](1000), - DbNodeStorageSizeInGbs: to.Ptr[int32](1000), - DbServers: []*string{ - to.Ptr("ocid1..aaaa")}, - DisplayName: to.Ptr("cluster 1"), - Domain: to.Ptr("domain1"), - GiVersion: to.Ptr("19.0.0.0"), - Hostname: to.Ptr("hostname1"), - IsLocalBackupEnabled: to.Ptr(false), - IsSparseDiskgroupEnabled: to.Ptr(false), - LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - MemorySizeInGbs: to.Ptr[int32](1000), - NsgCidrs: []*armoracledatabase.NsgCidr{ - { - DestinationPortRange: &armoracledatabase.PortRange{ - Max: to.Ptr[int32](1522), - Min: to.Ptr[int32](1520), - }, - Source: to.Ptr("10.0.0.0/16"), - }, - { - Source: to.Ptr("10.10.0.0/24"), - }}, - OcpuCount: to.Ptr[float32](3), - ScanListenerPortTCP: to.Ptr[int32](1050), - ScanListenerPortTCPSSL: to.Ptr[int32](1025), - SSHPublicKeys: []*string{ - to.Ptr("ssh-key 1")}, - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - TimeZone: to.Ptr("UTC"), - VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - }, - }, 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_patch.json -func ExampleCloudVMClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginUpdate(ctx, "rg000", "cluster1", armoracledatabase.CloudVMClusterUpdate{}, 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_delete.json -func ExampleCloudVMClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginDelete(ctx, "rg000", "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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_addVms.json -func ExampleCloudVMClustersClient_BeginAddVMs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginAddVMs(ctx, "rg000", "cluster1", armoracledatabase.AddRemoveDbNode{ - DbServers: []*string{ - to.Ptr("ocid1..aaaa"), - to.Ptr("ocid1..aaaaaa")}, - }, 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_listPrivateIpAddresses.json -func ExampleCloudVMClustersClient_ListPrivateIPAddresses() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudVMClustersClient().ListPrivateIPAddresses(ctx, "rg000", "cluster1", armoracledatabase.PrivateIPAddressesFilter{ - SubnetID: to.Ptr("ocid1..aaaaaa"), - VnicID: to.Ptr("ocid1..aaaaa"), - }, 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.PrivateIPAddressPropertiesArray = []*armoracledatabase.PrivateIPAddressProperties{ - // { - // DisplayName: to.Ptr("ip1"), - // HostnameLabel: to.Ptr("hostname1"), - // IPAddress: to.Ptr("192.168.0.1"), - // Ocid: to.Ptr("ocid1..aaaa"), - // SubnetID: to.Ptr("ocid1..aaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_removeVms.json -func ExampleCloudVMClustersClient_BeginRemoveVMs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginRemoveVMs(ctx, "rg000", "cluster1", armoracledatabase.AddRemoveDbNode{ - DbServers: []*string{ - to.Ptr("ocid1..aaaa")}, - }, 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go index 8e9e5855b1b4..c9e9b15729a6 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go @@ -10,7 +10,7 @@ package armoracledatabase const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,6 +27,27 @@ func PossibleActionTypeValues() []ActionType { } } +// AddSubscriptionOperationState - Add Subscription Operation state enum +type AddSubscriptionOperationState string + +const ( + // AddSubscriptionOperationStateFailed - Failed - State when Add Subscription operation failed + AddSubscriptionOperationStateFailed AddSubscriptionOperationState = "Failed" + // AddSubscriptionOperationStateSucceeded - Succeeded - State when Add Subscription operation succeeded + AddSubscriptionOperationStateSucceeded AddSubscriptionOperationState = "Succeeded" + // AddSubscriptionOperationStateUpdating - Updating - State when Add Subscription operation is being Updated + AddSubscriptionOperationStateUpdating AddSubscriptionOperationState = "Updating" +) + +// PossibleAddSubscriptionOperationStateValues returns the possible values for the AddSubscriptionOperationState const type. +func PossibleAddSubscriptionOperationStateValues() []AddSubscriptionOperationState { + return []AddSubscriptionOperationState{ + AddSubscriptionOperationStateFailed, + AddSubscriptionOperationStateSucceeded, + AddSubscriptionOperationStateUpdating, + } +} + // AutonomousDatabaseBackupLifecycleState - Autonomous database backup lifecycle state enum type AutonomousDatabaseBackupLifecycleState string diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go index 02bca6f50b8b..301b4dbeed32 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go @@ -46,7 +46,7 @@ func NewDbNodesClient(subscriptionID string, credential azcore.TokenCredential, // BeginAction - VM actions on DbNode of VM Cluster by the provided filter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - dbnodeocid - DbNode OCID. @@ -73,7 +73,7 @@ func (client *DbNodesClient) BeginAction(ctx context.Context, resourceGroupName // Action - VM actions on DbNode of VM Cluster by the provided filter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *DbNodesClient) action(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, options *DbNodesClientBeginActionOptions) (*http.Response, error) { var err error const operationName = "DbNodesClient.BeginAction" @@ -119,7 +119,7 @@ func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -131,7 +131,7 @@ func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGr // Get - Get a DbNode // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - dbnodeocid - DbNode OCID. @@ -182,7 +182,7 @@ func (client *DbNodesClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,7 @@ func (client *DbNodesClient) getHandleResponse(resp *http.Response) (DbNodesClie // NewListByCloudVMClusterPager - List DbNode resources by CloudVmCluster // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - options - DbNodesClientListByCloudVMClusterOptions contains the optional parameters for the DbNodesClient.NewListByCloudVMClusterPager @@ -247,7 +247,7 @@ func (client *DbNodesClient) listByCloudVMClusterCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go deleted file mode 100644 index 13651e994932..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go +++ /dev/null @@ -1,171 +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 armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbNodes_listByParent.json -func ExampleDbNodesClient_NewListByCloudVMClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDbNodesClient().NewListByCloudVMClusterPager("rg000", "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.DbNodeListResult = armoracledatabase.DbNodeListResult{ - // Value: []*armoracledatabase.DbNode{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), - // Properties: &armoracledatabase.DbNodeProperties{ - // BackupIPID: to.Ptr("id1"), - // BackupVnic2ID: to.Ptr("id1"), - // BackupVnicID: to.Ptr("id1"), - // CPUCoreCount: to.Ptr[int32](1000), - // DbNodeStorageSizeInGbs: to.Ptr[int32](500), - // DbServerID: to.Ptr("dbserver1"), - // DbSystemID: to.Ptr("db1"), - // FaultDomain: to.Ptr("domain1"), - // HostIPID: to.Ptr("10.0.0.0"), - // Hostname: to.Ptr("host1"), - // LifecycleState: to.Ptr(armoracledatabase.DbNodeProvisioningStateAvailable), - // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), - // MemorySizeInGbs: to.Ptr[int32](100), - // Ocid: to.Ptr("ocid.dbNodes.1"), - // SoftwareStorageSizeInGb: to.Ptr[int32](1000), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // Vnic2ID: to.Ptr("ocid.vnic.id2"), - // VnicID: to.Ptr("ocid.vnic.id1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbNodes_get.json -func ExampleDbNodesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDbNodesClient().Get(ctx, "rg000", "cluster1", "ocid1....aaaaaa", 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.DbNode = armoracledatabase.DbNode{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), - // Properties: &armoracledatabase.DbNodeProperties{ - // BackupIPID: to.Ptr("id1"), - // BackupVnic2ID: to.Ptr("id1"), - // BackupVnicID: to.Ptr("id1"), - // CPUCoreCount: to.Ptr[int32](1000), - // DbNodeStorageSizeInGbs: to.Ptr[int32](500), - // DbServerID: to.Ptr("dbserver1"), - // DbSystemID: to.Ptr("db1"), - // FaultDomain: to.Ptr("domain1"), - // HostIPID: to.Ptr("10.0.0.0"), - // Hostname: to.Ptr("host1"), - // LifecycleState: to.Ptr(armoracledatabase.DbNodeProvisioningStateAvailable), - // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), - // MemorySizeInGbs: to.Ptr[int32](100), - // Ocid: to.Ptr("ocid.dbNodes.1"), - // SoftwareStorageSizeInGb: to.Ptr[int32](1000), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // Vnic2ID: to.Ptr("ocid.vnic.id2"), - // VnicID: to.Ptr("ocid.vnic.id1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbNodes_action.json -func ExampleDbNodesClient_BeginAction_dbNodesAction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDbNodesClient().BeginAction(ctx, "rg000", "cluster1", "ocid1....aaaaaa", armoracledatabase.DbNodeAction{ - Action: to.Ptr(armoracledatabase.DbNodeActionEnumStart), - }, 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.DbNode = armoracledatabase.DbNode{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), - // Properties: &armoracledatabase.DbNodeProperties{ - // BackupIPID: to.Ptr("id1"), - // BackupVnic2ID: to.Ptr("id1"), - // BackupVnicID: to.Ptr("id1"), - // CPUCoreCount: to.Ptr[int32](1000), - // DbNodeStorageSizeInGbs: to.Ptr[int32](500), - // DbServerID: to.Ptr("dbserver1"), - // DbSystemID: to.Ptr("db1"), - // FaultDomain: to.Ptr("domain1"), - // HostIPID: to.Ptr("10.0.0.0"), - // Hostname: to.Ptr("host1"), - // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), - // MemorySizeInGbs: to.Ptr[int32](100), - // Ocid: to.Ptr("ocid.dbNodes.1"), - // ProvisioningState: to.Ptr(armoracledatabase.ResourceProvisioningStateSucceeded), - // SoftwareStorageSizeInGb: to.Ptr[int32](1000), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // Vnic2ID: to.Ptr("ocid.vnic.id2"), - // VnicID: to.Ptr("ocid.vnic.id1"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go index 34bc828e0228..1b16fbf2629c 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go @@ -46,7 +46,7 @@ func NewDbServersClient(subscriptionID string, credential azcore.TokenCredential // Get - Get a DbServer // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - dbserverocid - DbServer OCID. @@ -97,7 +97,7 @@ func (client *DbServersClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,7 @@ func (client *DbServersClient) getHandleResponse(resp *http.Response) (DbServers // NewListByCloudExadataInfrastructurePager - List DbServer resources by CloudExadataInfrastructure // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - DbServersClientListByCloudExadataInfrastructureOptions contains the optional parameters for the DbServersClient.NewListByCloudExadataInfrastructurePager @@ -162,7 +162,7 @@ func (client *DbServersClient) listByCloudExadataInfrastructureCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go deleted file mode 100644 index 12f1139bea15..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go +++ /dev/null @@ -1,112 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbServers_listByParent.json -func ExampleDbServersClient_NewListByCloudExadataInfrastructurePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDbServersClient().NewListByCloudExadataInfrastructurePager("rg000", "infra1", 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.DbServerListResult = armoracledatabase.DbServerListResult{ - // Value: []*armoracledatabase.DbServer{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbServers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1/dbServers/ocid1"), - // Properties: &armoracledatabase.DbServerProperties{ - // AutonomousVirtualMachineIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // AutonomousVMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // CompartmentID: to.Ptr("ocid1....aaaa"), - // CPUCoreCount: to.Ptr[int32](100), - // DbNodeIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // DbNodeStorageSizeInGbs: to.Ptr[int32](150), - // DisplayName: to.Ptr("dbserver1"), - // ExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // LifecycleState: to.Ptr(armoracledatabase.DbServerProvisioningStateAvailable), - // MaxCPUCount: to.Ptr[int32](1000), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // Ocid: to.Ptr("ocid1"), - // VMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbServers_get.json -func ExampleDbServersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDbServersClient().Get(ctx, "rg000", "infra1", "ocid1....aaaaaa", 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.DbServer = armoracledatabase.DbServer{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbServers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1/dbServers/ocid1"), - // Properties: &armoracledatabase.DbServerProperties{ - // AutonomousVirtualMachineIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // AutonomousVMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // CompartmentID: to.Ptr("ocid1....aaaa"), - // CPUCoreCount: to.Ptr[int32](100), - // DbNodeIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // DbNodeStorageSizeInGbs: to.Ptr[int32](150), - // DisplayName: to.Ptr("dbserver1"), - // ExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // LifecycleState: to.Ptr(armoracledatabase.DbServerProvisioningStateAvailable), - // MaxCPUCount: to.Ptr[int32](1000), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // Ocid: to.Ptr("ocid1"), - // VMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go index 64a1709916e8..9a4ff7e9955a 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go @@ -46,7 +46,7 @@ func NewDbSystemShapesClient(subscriptionID string, credential azcore.TokenCrede // Get - Get a DbSystemShape // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - dbsystemshapename - DbSystemShape name // - options - DbSystemShapesClientGetOptions contains the optional parameters for the DbSystemShapesClient.Get method. @@ -92,7 +92,7 @@ func (client *DbSystemShapesClient) getCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *DbSystemShapesClient) getHandleResponse(resp *http.Response) (DbSy // NewListByLocationPager - List DbSystemShape resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - DbSystemShapesClientListByLocationOptions contains the optional parameters for the DbSystemShapesClient.NewListByLocationPager // method. @@ -152,7 +152,7 @@ func (client *DbSystemShapesClient) listByLocationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client_example_test.go deleted file mode 100644 index 63e720f7e41f..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbSystemShapes_listByLocation.json -func ExampleDbSystemShapesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDbSystemShapesClient().NewListByLocationPager("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.DbSystemShapeListResult = armoracledatabase.DbSystemShapeListResult{ - // Value: []*armoracledatabase.DbSystemShape{ - // { - // Type: to.Ptr("Oracle.Database/locations/dbSystemShapes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dbSystemShapes/EXADATA.X9M"), - // Properties: &armoracledatabase.DbSystemShapeProperties{ - // AvailableCoreCount: to.Ptr[int32](100), - // AvailableCoreCountPerNode: to.Ptr[int32](1000), - // AvailableDataStorageInTbs: to.Ptr[int32](10), - // AvailableDataStoragePerServerInTbs: to.Ptr[float64](100), - // AvailableDbNodePerNodeInGbs: to.Ptr[int32](10), - // AvailableDbNodeStorageInGbs: to.Ptr[int32](10), - // AvailableMemoryInGbs: to.Ptr[int32](10), - // AvailableMemoryPerNodeInGbs: to.Ptr[int32](10), - // CoreCountIncrement: to.Ptr[int32](1), - // MaxStorageCount: to.Ptr[int32](100), - // MaximumNodeCount: to.Ptr[int32](1000), - // MinCoreCountPerNode: to.Ptr[int32](0), - // MinDataStorageInTbs: to.Ptr[int32](0), - // MinDbNodeStoragePerNodeInGbs: to.Ptr[int32](0), - // MinMemoryPerNodeInGbs: to.Ptr[int32](0), - // MinStorageCount: to.Ptr[int32](0), - // MinimumCoreCount: to.Ptr[int32](1), - // MinimumNodeCount: to.Ptr[int32](0), - // RuntimeMinimumCoreCount: to.Ptr[int32](1), - // ShapeFamily: to.Ptr("EXADATA"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbSystemShapes_get.json -func ExampleDbSystemShapesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDbSystemShapesClient().Get(ctx, "eastus", "EXADATA.X9M", 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.DbSystemShape = armoracledatabase.DbSystemShape{ - // Type: to.Ptr("Oracle.Database/locations/dbSystemShapes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dbSystemShapes/EXADATA.X9M"), - // Properties: &armoracledatabase.DbSystemShapeProperties{ - // AvailableCoreCount: to.Ptr[int32](100), - // AvailableCoreCountPerNode: to.Ptr[int32](1000), - // AvailableDataStorageInTbs: to.Ptr[int32](10), - // AvailableDataStoragePerServerInTbs: to.Ptr[float64](100), - // AvailableDbNodePerNodeInGbs: to.Ptr[int32](10), - // AvailableDbNodeStorageInGbs: to.Ptr[int32](10), - // AvailableMemoryInGbs: to.Ptr[int32](10), - // AvailableMemoryPerNodeInGbs: to.Ptr[int32](10), - // CoreCountIncrement: to.Ptr[int32](1), - // MaxStorageCount: to.Ptr[int32](100), - // MaximumNodeCount: to.Ptr[int32](1000), - // MinCoreCountPerNode: to.Ptr[int32](0), - // MinDataStorageInTbs: to.Ptr[int32](0), - // MinDbNodeStoragePerNodeInGbs: to.Ptr[int32](0), - // MinMemoryPerNodeInGbs: to.Ptr[int32](0), - // MinStorageCount: to.Ptr[int32](0), - // MinimumCoreCount: to.Ptr[int32](1), - // MinimumNodeCount: to.Ptr[int32](0), - // RuntimeMinimumCoreCount: to.Ptr[int32](1), - // ShapeFamily: to.Ptr("EXADATA"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go index 0a36f1bbd684..1ac046466583 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go @@ -46,7 +46,7 @@ func NewDNSPrivateViewsClient(subscriptionID string, credential azcore.TokenCred // Get - Get a DnsPrivateView // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - dnsprivateviewocid - DnsPrivateView OCID // - options - DNSPrivateViewsClientGetOptions contains the optional parameters for the DNSPrivateViewsClient.Get method. @@ -92,7 +92,7 @@ func (client *DNSPrivateViewsClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *DNSPrivateViewsClient) getHandleResponse(resp *http.Response) (DNS // NewListByLocationPager - List DnsPrivateView resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - DNSPrivateViewsClientListByLocationOptions contains the optional parameters for the DNSPrivateViewsClient.NewListByLocationPager // method. @@ -152,7 +152,7 @@ func (client *DNSPrivateViewsClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client_example_test.go deleted file mode 100644 index 4987b77cd99c..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateViews_listByLocation.json -func ExampleDNSPrivateViewsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDNSPrivateViewsClient().NewListByLocationPager("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.DNSPrivateViewListResult = armoracledatabase.DNSPrivateViewListResult{ - // Value: []*armoracledatabase.DNSPrivateView{ - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateViews"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateViews/ocid1....aaaaaa"), - // Properties: &armoracledatabase.DNSPrivateViewProperties{ - // DisplayName: to.Ptr("example-dns-private-view1"), - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateViewsLifecycleStateActive), - // Ocid: to.Ptr("ocid1....aaaaaa"), - // Self: to.Ptr("https://api.example.com/view1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // TimeUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T14:00:00.000Z"); return t}()), - // }, - // }, - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateViews"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateViews/ocid1....aaaaab"), - // Properties: &armoracledatabase.DNSPrivateViewProperties{ - // DisplayName: to.Ptr("example-dns-private-view2"), - // IsProtected: to.Ptr(true), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateViewsLifecycleState("Creating")), - // Ocid: to.Ptr("ocid1....aaaaab"), - // Self: to.Ptr("https://api.example.com/view2"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-27T09:45:00.000Z"); return t}()), - // TimeUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-27T10:30:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateViews_get.json -func ExampleDNSPrivateViewsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDNSPrivateViewsClient().Get(ctx, "eastus", "ocid1....aaaaaa", 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.DNSPrivateView = armoracledatabase.DNSPrivateView{ - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateViews"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateViews/ocid1....aaaaaa"), - // Properties: &armoracledatabase.DNSPrivateViewProperties{ - // DisplayName: to.Ptr("example-dns-private-view"), - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateViewsLifecycleStateActive), - // Ocid: to.Ptr("ocid1....aaaaaa"), - // Self: to.Ptr("https://api.example.com/your-dns-private-view"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // TimeUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T14:00:00.000Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go index 15733949a0c4..ecf9197e63b8 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go @@ -46,7 +46,7 @@ func NewDNSPrivateZonesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a DnsPrivateZone // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - dnsprivatezonename - DnsPrivateZone name // - options - DNSPrivateZonesClientGetOptions contains the optional parameters for the DNSPrivateZonesClient.Get method. @@ -92,7 +92,7 @@ func (client *DNSPrivateZonesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *DNSPrivateZonesClient) getHandleResponse(resp *http.Response) (DNS // NewListByLocationPager - List DnsPrivateZone resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - DNSPrivateZonesClientListByLocationOptions contains the optional parameters for the DNSPrivateZonesClient.NewListByLocationPager // method. @@ -152,7 +152,7 @@ func (client *DNSPrivateZonesClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client_example_test.go deleted file mode 100644 index b15f526f959e..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateZones_listByLocation.json -func ExampleDNSPrivateZonesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDNSPrivateZonesClient().NewListByLocationPager("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.DNSPrivateZoneListResult = armoracledatabase.DNSPrivateZoneListResult{ - // Value: []*armoracledatabase.DNSPrivateZone{ - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateZones/zone1"), - // Properties: &armoracledatabase.DNSPrivateZoneProperties{ - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateZonesLifecycleStateActive), - // Ocid: to.Ptr("zone-id-1"), - // Self: to.Ptr("https://api.example.com/zone1"), - // Serial: to.Ptr[int32](12345), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // Version: to.Ptr("1.0.0.0"), - // ViewID: to.Ptr("view-id-1"), - // ZoneType: to.Ptr(armoracledatabase.ZoneTypePrimary), - // }, - // }, - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateZones/zone2"), - // Properties: &armoracledatabase.DNSPrivateZoneProperties{ - // IsProtected: to.Ptr(true), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateZonesLifecycleStateCreating), - // Ocid: to.Ptr("zone-id-2"), - // Self: to.Ptr("https://api.example.com/zone2"), - // Serial: to.Ptr[int32](54321), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-27T09:45:00.000Z"); return t}()), - // Version: to.Ptr("2.0.0.0"), - // ViewID: to.Ptr("view-id-2"), - // ZoneType: to.Ptr(armoracledatabase.ZoneTypeSecondary), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateZones_get.json -func ExampleDNSPrivateZonesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDNSPrivateZonesClient().Get(ctx, "eastus", "example-dns-private-zone", 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.DNSPrivateZone = armoracledatabase.DNSPrivateZone{ - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateZones/example-dns-private-zone"), - // Properties: &armoracledatabase.DNSPrivateZoneProperties{ - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateZonesLifecycleStateActive), - // Ocid: to.Ptr("your-zone-id"), - // Self: to.Ptr("https://api.example.com/your-dns-private-zone"), - // Serial: to.Ptr[int32](12345), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // Version: to.Ptr("1.0.0.0"), - // ViewID: to.Ptr("your-view-id"), - // ZoneType: to.Ptr(armoracledatabase.ZoneTypePrimary), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go index 712077d00f40..629028d52fff 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go @@ -23,6 +23,10 @@ import ( // OracleSubscriptionsServer is a fake server for instances of the armoracledatabase.OracleSubscriptionsClient type. type OracleSubscriptionsServer struct { + // BeginAddAzureSubscriptions is the fake for method OracleSubscriptionsClient.BeginAddAzureSubscriptions + // HTTP status codes to indicate success: http.StatusAccepted + BeginAddAzureSubscriptions func(ctx context.Context, body armoracledatabase.AzureSubscriptions, options *armoracledatabase.OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientAddAzureSubscriptionsResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method OracleSubscriptionsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resource armoracledatabase.OracleSubscription, options *armoracledatabase.OracleSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) @@ -62,6 +66,7 @@ type OracleSubscriptionsServer struct { func NewOracleSubscriptionsServerTransport(srv *OracleSubscriptionsServer) *OracleSubscriptionsServerTransport { return &OracleSubscriptionsServerTransport{ srv: srv, + beginAddAzureSubscriptions: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientAddAzureSubscriptionsResponse]](), beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse]](), beginListActivationLinks: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse]](), @@ -76,6 +81,7 @@ func NewOracleSubscriptionsServerTransport(srv *OracleSubscriptionsServer) *Orac // Don't use this type directly, use NewOracleSubscriptionsServerTransport instead. type OracleSubscriptionsServerTransport struct { srv *OracleSubscriptionsServer + beginAddAzureSubscriptions *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientAddAzureSubscriptionsResponse]] beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse]] beginDelete *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse]] beginListActivationLinks *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse]] @@ -97,6 +103,8 @@ func (o *OracleSubscriptionsServerTransport) Do(req *http.Request) (*http.Respon var err error switch method { + case "OracleSubscriptionsClient.BeginAddAzureSubscriptions": + resp, err = o.dispatchBeginAddAzureSubscriptions(req) case "OracleSubscriptionsClient.BeginCreateOrUpdate": resp, err = o.dispatchBeginCreateOrUpdate(req) case "OracleSubscriptionsClient.BeginDelete": @@ -124,6 +132,46 @@ func (o *OracleSubscriptionsServerTransport) Do(req *http.Request) (*http.Respon return resp, nil } +func (o *OracleSubscriptionsServerTransport) dispatchBeginAddAzureSubscriptions(req *http.Request) (*http.Response, error) { + if o.srv.BeginAddAzureSubscriptions == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAddAzureSubscriptions not implemented")} + } + beginAddAzureSubscriptions := o.beginAddAzureSubscriptions.get(req) + if beginAddAzureSubscriptions == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/addAzureSubscriptions` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AzureSubscriptions](req) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginAddAzureSubscriptions(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAddAzureSubscriptions = &respr + o.beginAddAzureSubscriptions.add(req, beginAddAzureSubscriptions) + } + + resp, err := server.PollerResponderNext(beginAddAzureSubscriptions, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + o.beginAddAzureSubscriptions.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAddAzureSubscriptions) { + o.beginAddAzureSubscriptions.remove(req) + } + + return resp, nil +} + func (o *OracleSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { if o.srv.BeginCreateOrUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go index 1a3b95f94727..22b7a4a9b142 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go @@ -46,7 +46,7 @@ func NewGiVersionsClient(subscriptionID string, credential azcore.TokenCredentia // Get - Get a GiVersion // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - giversionname - GiVersion name // - options - GiVersionsClientGetOptions contains the optional parameters for the GiVersionsClient.Get method. @@ -92,7 +92,7 @@ func (client *GiVersionsClient) getCreateRequest(ctx context.Context, location s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *GiVersionsClient) getHandleResponse(resp *http.Response) (GiVersio // NewListByLocationPager - List GiVersion resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - GiVersionsClientListByLocationOptions contains the optional parameters for the GiVersionsClient.NewListByLocationPager // method. @@ -152,7 +152,7 @@ func (client *GiVersionsClient) listByLocationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client_example_test.go deleted file mode 100644 index f9115c0f888b..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/giVersions_listByLocation.json -func ExampleGiVersionsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGiVersionsClient().NewListByLocationPager("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.GiVersionListResult = armoracledatabase.GiVersionListResult{ - // Value: []*armoracledatabase.GiVersion{ - // { - // Type: to.Ptr("Oracle.Database/locations/giVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0"), - // Properties: &armoracledatabase.GiVersionProperties{ - // Version: to.Ptr("19.0.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/giVersions_get.json -func ExampleGiVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGiVersionsClient().Get(ctx, "eastus", "19.0.0.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.GiVersion = armoracledatabase.GiVersion{ - // Type: to.Ptr("Oracle.Database/locations/giVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0"), - // Properties: &armoracledatabase.GiVersionProperties{ - // Version: to.Ptr("19.0.0.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod index 8486742bd945..6bae9df30279 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armo go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go index 49ee984711d8..baeba56ec065 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go @@ -154,7 +154,7 @@ type AutonomousDatabaseBackupProperties struct { // AutonomousDatabaseBackupUpdate - The type used for update operations of the AutonomousDatabaseBackup. type AutonomousDatabaseBackupUpdate struct { - // The updatable properties of the AutonomousDatabaseBackup. + // The resource-specific properties for this resource. Properties *AutonomousDatabaseBackupUpdateProperties } @@ -1172,7 +1172,7 @@ type AutonomousDatabaseStandbySummary struct { // AutonomousDatabaseUpdate - The type used for update operations of the AutonomousDatabase. type AutonomousDatabaseUpdate struct { - // The updatable properties of the AutonomousDatabase. + // The resource-specific properties for this resource. Properties *AutonomousDatabaseUpdateProperties // Resource tags. @@ -1289,9 +1289,6 @@ type AutonomousDbVersionListResult struct { // AutonomousDbVersionProperties - AutonomousDbVersion resource model type AutonomousDbVersionProperties struct { - // READ-ONLY; Supported Autonomous Db versions. - Version *string - // READ-ONLY; The Autonomous Database workload type DbWorkload *WorkloadType @@ -1306,6 +1303,15 @@ type AutonomousDbVersionProperties struct { // READ-ONLY; True if this version of the Oracle Database software has payments enabled. IsPaidEnabled *bool + + // READ-ONLY; Supported Autonomous Db versions. + Version *string +} + +// AzureSubscriptions - Azure Subscriptions model +type AzureSubscriptions struct { + // REQUIRED; Azure Subscription Ids to be updated + AzureSubscriptionIDs []*string } // CloudAccountDetails - Cloud Account Details model @@ -1456,7 +1462,7 @@ type CloudExadataInfrastructureProperties struct { // CloudExadataInfrastructureUpdate - The type used for update operations of the CloudExadataInfrastructure. type CloudExadataInfrastructureUpdate struct { - // The updatable properties of the CloudExadataInfrastructure. + // The resource-specific properties for this resource. Properties *CloudExadataInfrastructureUpdateProperties // Resource tags. @@ -1683,7 +1689,7 @@ type CloudVMClusterProperties struct { // CloudVMClusterUpdate - The type used for update operations of the CloudVmCluster. type CloudVMClusterUpdate struct { - // The updatable properties of the CloudVmCluster. + // The resource-specific properties for this resource. Properties *CloudVMClusterUpdateProperties // Resource tags. @@ -1812,12 +1818,21 @@ type DNSPrivateViewListResult struct { // DNSPrivateViewProperties - Views resource model type DNSPrivateViewProperties struct { + // READ-ONLY; The display name of the view resource + DisplayName *string + // READ-ONLY; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. IsProtected *bool + // READ-ONLY; Views lifecycleState + LifecycleState *DNSPrivateViewsLifecycleState + // READ-ONLY; The OCID of the view Ocid *string + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState + // READ-ONLY; The canonical absolute URL of the resource. Self *string @@ -1826,15 +1841,6 @@ type DNSPrivateViewProperties struct { // READ-ONLY; views timeCreated TimeUpdated *time.Time - - // READ-ONLY; The display name of the view resource - DisplayName *string - - // READ-ONLY; Views lifecycleState - LifecycleState *DNSPrivateViewsLifecycleState - - // READ-ONLY; Azure resource provisioning state. - ProvisioningState *ResourceProvisioningState } // DNSPrivateZone - DnsPrivateZone resource definition @@ -1869,9 +1875,15 @@ type DNSPrivateZoneProperties struct { // READ-ONLY; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. IsProtected *bool + // READ-ONLY; Zones lifecycleState + LifecycleState *DNSPrivateZonesLifecycleState + // READ-ONLY; The OCID of the Zone Ocid *string + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState + // READ-ONLY; The canonical absolute URL of the resource. Self *string @@ -1885,18 +1897,12 @@ type DNSPrivateZoneProperties struct { // SOA record is derived. Version *string - // READ-ONLY; The type of the zone. Must be either PRIMARY or SECONDARY. SECONDARY is only supported for GLOBAL zones. - ZoneType *ZoneType - - // READ-ONLY; Zones lifecycleState - LifecycleState *DNSPrivateZonesLifecycleState - - // READ-ONLY; Azure resource provisioning state. - ProvisioningState *ResourceProvisioningState - // READ-ONLY; The OCID of the private view containing the zone. This value will be null for zones in the global DNS, which // are publicly resolvable and not part of a private view. ViewID *string + + // READ-ONLY; The type of the zone. Must be either PRIMARY or SECONDARY. SECONDARY is only supported for GLOBAL zones. + ZoneType *ZoneType } // DataCollectionOptions resource properties @@ -1970,12 +1976,6 @@ type DbNodeListResult struct { // DbNodeProperties - The properties of DbNodeResource type DbNodeProperties struct { - // READ-ONLY; The OCID of the DB system. - DbSystemID *string - - // READ-ONLY; DbNode OCID - Ocid *string - // READ-ONLY; Additional information about the planned maintenance. AdditionalDetails *string @@ -1997,6 +1997,9 @@ type DbNodeProperties struct { // READ-ONLY; The OCID of the Exacc Db server associated with the database node. DbServerID *string + // READ-ONLY; The OCID of the DB system. + DbSystemID *string + // READ-ONLY; The name of the Fault Domain the instance is contained in. FaultDomain *string @@ -2018,6 +2021,9 @@ type DbNodeProperties struct { // READ-ONLY; The allocated memory in GBs on the Db node. MemorySizeInGbs *int32 + // READ-ONLY; DbNode OCID + Ocid *string + // READ-ONLY; Azure resource provisioning state. ProvisioningState *ResourceProvisioningState @@ -2478,12 +2484,21 @@ type OracleSubscriptionProperties struct { // Term Unit. P1Y, P3Y, etc, see Durations https://en.wikipedia.org/wiki/ISO_8601 TermUnit *string + // READ-ONLY; State of the add Azure subscription operation on Oracle subscription + AddSubscriptionOperationState *AddSubscriptionOperationState + + // READ-ONLY; Azure subscriptions associated with this OracleSubscription + AzureSubscriptionIDs []*string + // READ-ONLY; Cloud Account Id CloudAccountID *string // READ-ONLY; Cloud Account provisioning state. CloudAccountState *CloudAccountProvisioningState + // READ-ONLY; Status details of the last operation on Oracle subscription + LastOperationStatusDetail *string + // READ-ONLY; OracleSubscriptionProvisioningState provisioning state ProvisioningState *OracleSubscriptionProvisioningState @@ -2496,7 +2511,7 @@ type OracleSubscriptionUpdate struct { // Details of the resource plan. Plan *PlanUpdate - // The updatable properties of the OracleSubscription. + // The resource-specific properties for this resource. Properties *OracleSubscriptionUpdateProperties } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go index 3c239e9ac5d9..2b9df813b87c 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go @@ -1976,6 +1976,33 @@ func (a *AutonomousDbVersionProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureSubscriptions. +func (a AzureSubscriptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureSubscriptionIds", a.AzureSubscriptionIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSubscriptions. +func (a *AzureSubscriptions) UnmarshalJSON(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 "azureSubscriptionIds": + err = unpopulate(val, "AzureSubscriptionIDs", &a.AzureSubscriptionIDs) + 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 CloudAccountDetails. func (c CloudAccountDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4405,9 +4432,12 @@ func (o *OracleSubscriptionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OracleSubscriptionProperties. func (o OracleSubscriptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "addSubscriptionOperationState", o.AddSubscriptionOperationState) + populate(objectMap, "azureSubscriptionIds", o.AzureSubscriptionIDs) populate(objectMap, "cloudAccountId", o.CloudAccountID) populate(objectMap, "cloudAccountState", o.CloudAccountState) populate(objectMap, "intent", o.Intent) + populate(objectMap, "lastOperationStatusDetail", o.LastOperationStatusDetail) populate(objectMap, "productCode", o.ProductCode) populate(objectMap, "provisioningState", o.ProvisioningState) populate(objectMap, "saasSubscriptionId", o.SaasSubscriptionID) @@ -4424,6 +4454,12 @@ func (o *OracleSubscriptionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "addSubscriptionOperationState": + err = unpopulate(val, "AddSubscriptionOperationState", &o.AddSubscriptionOperationState) + delete(rawMsg, key) + case "azureSubscriptionIds": + err = unpopulate(val, "AzureSubscriptionIDs", &o.AzureSubscriptionIDs) + delete(rawMsg, key) case "cloudAccountId": err = unpopulate(val, "CloudAccountID", &o.CloudAccountID) delete(rawMsg, key) @@ -4433,6 +4469,9 @@ func (o *OracleSubscriptionProperties) UnmarshalJSON(data []byte) error { case "intent": err = unpopulate(val, "Intent", &o.Intent) delete(rawMsg, key) + case "lastOperationStatusDetail": + err = unpopulate(val, "LastOperationStatusDetail", &o.LastOperationStatusDetail) + delete(rawMsg, key) case "productCode": err = unpopulate(val, "ProductCode", &o.ProductCode) delete(rawMsg, key) diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go index 3afa79d96e07..56d66fa3e6b4 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client_example_test.go deleted file mode 100644 index fc5cc5ef79a8..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/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 := armoracledatabase.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 = armoracledatabase.OperationListResult{ - // Value: []*armoracledatabase.Operation{ - // { - // Name: to.Ptr("Oracle.Database/cloudExadataInfrastructures/Read"), - // Display: &armoracledatabase.OperationDisplay{ - // Description: to.Ptr("Reads Exadata Infrastructure"), - // Operation: to.Ptr("Get/list Exadata Infrastructure resources"), - // Provider: to.Ptr("Oracle.Database"), - // Resource: to.Ptr("cloudExadataInfrastructures"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go index 3ff90a3ca86e..55f7c8ce0e30 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go @@ -327,6 +327,13 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginAddAzureSubscriptions +// method. +type OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // OracleSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginCreateOrUpdate // method. type OracleSubscriptionsClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go index 9b251202d11f..60b88d85241d 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go @@ -43,10 +43,81 @@ func NewOracleSubscriptionsClient(subscriptionID string, credential azcore.Token return client, nil } +// BeginAddAzureSubscriptions - Add Azure Subscriptions +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01 +// - body - The content of the action request +// - options - OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginAddAzureSubscriptions +// method. +func (client *OracleSubscriptionsClient) BeginAddAzureSubscriptions(ctx context.Context, body AzureSubscriptions, options *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*runtime.Poller[OracleSubscriptionsClientAddAzureSubscriptionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.addAzureSubscriptions(ctx, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientAddAzureSubscriptionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientAddAzureSubscriptionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AddAzureSubscriptions - Add Azure Subscriptions +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01 +func (client *OracleSubscriptionsClient) addAzureSubscriptions(ctx context.Context, body AzureSubscriptions, options *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginAddAzureSubscriptions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.addAzureSubscriptionsCreateRequest(ctx, 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 +} + +// addAzureSubscriptionsCreateRequest creates the AddAzureSubscriptions request. +func (client *OracleSubscriptionsClient) addAzureSubscriptionsCreateRequest(ctx context.Context, body AzureSubscriptions, options *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/addAzureSubscriptions" + 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", "2024-06-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 +} + // BeginCreateOrUpdate - Create a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resource - Resource create parameters. // - options - OracleSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginCreateOrUpdate // method. @@ -71,7 +142,7 @@ func (client *OracleSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *OracleSubscriptionsClient) createOrUpdate(ctx context.Context, resource OracleSubscription, options *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginCreateOrUpdate" @@ -105,7 +176,7 @@ func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -117,7 +188,7 @@ func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - OracleSubscriptionsClientBeginDeleteOptions contains the optional parameters for the OracleSubscriptionsClient.BeginDelete // method. func (client *OracleSubscriptionsClient) BeginDelete(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*runtime.Poller[OracleSubscriptionsClientDeleteResponse], error) { @@ -141,7 +212,7 @@ func (client *OracleSubscriptionsClient) BeginDelete(ctx context.Context, option // Delete - Delete a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *OracleSubscriptionsClient) deleteOperation(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginDelete" @@ -175,7 +246,7 @@ func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +255,7 @@ func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context // Get - Get a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - OracleSubscriptionsClientGetOptions contains the optional parameters for the OracleSubscriptionsClient.Get method. func (client *OracleSubscriptionsClient) Get(ctx context.Context, options *OracleSubscriptionsClientGetOptions) (OracleSubscriptionsClientGetResponse, error) { var err error @@ -220,7 +291,7 @@ func (client *OracleSubscriptionsClient) getCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,7 +309,7 @@ func (client *OracleSubscriptionsClient) getHandleResponse(resp *http.Response) // BeginListActivationLinks - List Activation Links // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - OracleSubscriptionsClientBeginListActivationLinksOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListActivationLinks // method. func (client *OracleSubscriptionsClient) BeginListActivationLinks(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*runtime.Poller[OracleSubscriptionsClientListActivationLinksResponse], error) { @@ -262,7 +333,7 @@ func (client *OracleSubscriptionsClient) BeginListActivationLinks(ctx context.Co // ListActivationLinks - List Activation Links // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *OracleSubscriptionsClient) listActivationLinks(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginListActivationLinks" @@ -296,7 +367,7 @@ func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -304,7 +375,7 @@ func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx co // NewListBySubscriptionPager - List OracleSubscription resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - OracleSubscriptionsClientListBySubscriptionOptions contains the optional parameters for the OracleSubscriptionsClient.NewListBySubscriptionPager // method. func (client *OracleSubscriptionsClient) NewListBySubscriptionPager(options *OracleSubscriptionsClientListBySubscriptionOptions) *runtime.Pager[OracleSubscriptionsClientListBySubscriptionResponse] { @@ -342,7 +413,7 @@ func (client *OracleSubscriptionsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,7 +431,7 @@ func (client *OracleSubscriptionsClient) listBySubscriptionHandleResponse(resp * // BeginListCloudAccountDetails - List Cloud Account Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - OracleSubscriptionsClientBeginListCloudAccountDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListCloudAccountDetails // method. func (client *OracleSubscriptionsClient) BeginListCloudAccountDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*runtime.Poller[OracleSubscriptionsClientListCloudAccountDetailsResponse], error) { @@ -384,7 +455,7 @@ func (client *OracleSubscriptionsClient) BeginListCloudAccountDetails(ctx contex // ListCloudAccountDetails - List Cloud Account Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *OracleSubscriptionsClient) listCloudAccountDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginListCloudAccountDetails" @@ -418,7 +489,7 @@ func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -427,7 +498,7 @@ func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ct // BeginListSaasSubscriptionDetails - List Saas Subscription Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - options - OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListSaasSubscriptionDetails // method. func (client *OracleSubscriptionsClient) BeginListSaasSubscriptionDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*runtime.Poller[OracleSubscriptionsClientListSaasSubscriptionDetailsResponse], error) { @@ -451,7 +522,7 @@ func (client *OracleSubscriptionsClient) BeginListSaasSubscriptionDetails(ctx co // ListSaasSubscriptionDetails - List Saas Subscription Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *OracleSubscriptionsClient) listSaasSubscriptionDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginListSaasSubscriptionDetails" @@ -485,7 +556,7 @@ func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -494,7 +565,7 @@ func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateReques // BeginUpdate - Update a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - properties - The resource properties to be updated. // - options - OracleSubscriptionsClientBeginUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginUpdate // method. @@ -519,7 +590,7 @@ func (client *OracleSubscriptionsClient) BeginUpdate(ctx context.Context, proper // Update - Update a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *OracleSubscriptionsClient) update(ctx context.Context, properties OracleSubscriptionUpdate, options *OracleSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginUpdate" @@ -553,7 +624,7 @@ func (client *OracleSubscriptionsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") 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/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.go deleted file mode 100644 index 4c37f167fdbc..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listBySubscription.json -func ExampleOracleSubscriptionsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOracleSubscriptionsClient().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.OracleSubscriptionListResult = armoracledatabase.OracleSubscriptionListResult{ - // Value: []*armoracledatabase.OracleSubscription{ - // { - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_get.json -func ExampleOracleSubscriptionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOracleSubscriptionsClient().Get(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.OracleSubscription = armoracledatabase.OracleSubscription{ - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_create.json -func ExampleOracleSubscriptionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginCreateOrUpdate(ctx, armoracledatabase.OracleSubscription{ - Plan: &armoracledatabase.Plan{ - Name: to.Ptr("plan1"), - Product: to.Ptr("product1"), - PromotionCode: to.Ptr("none"), - Publisher: to.Ptr("publisher1"), - Version: to.Ptr("alpha"), - }, - Properties: &armoracledatabase.OracleSubscriptionProperties{}, - }, 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.OracleSubscription = armoracledatabase.OracleSubscription{ - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_patch.json -func ExampleOracleSubscriptionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginUpdate(ctx, armoracledatabase.OracleSubscriptionUpdate{}, 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.OracleSubscription = armoracledatabase.OracleSubscription{ - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_delete.json -func ExampleOracleSubscriptionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginDelete(ctx, 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listActivationLinks.json -func ExampleOracleSubscriptionsClient_BeginListActivationLinks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListActivationLinks(ctx, 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.ActivationLinks = armoracledatabase.ActivationLinks{ - // ExistingCloudAccountActivationLink: to.Ptr("https://existing-tenancy-activation-link"), - // NewCloudAccountActivationLink: to.Ptr("https://new-tenancy-activation-link"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listCloudAccountDetails.json -func ExampleOracleSubscriptionsClient_BeginListCloudAccountDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListCloudAccountDetails(ctx, 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.CloudAccountDetails = armoracledatabase.CloudAccountDetails{ - // CloudAccountHomeRegion: to.Ptr("East US"), - // CloudAccountName: to.Ptr("Cloud Account"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listSaasSubscriptionDetails.json -func ExampleOracleSubscriptionsClient_BeginListSaasSubscriptionDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListSaasSubscriptionDetails(ctx, 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.SaasSubscriptionDetails = armoracledatabase.SaasSubscriptionDetails{ - // ID: to.Ptr("1234567890"), - // IsAutoRenew: to.Ptr(true), - // IsFreeTrial: to.Ptr(false), - // OfferID: to.Ptr("offer1"), - // PlanID: to.Ptr("silver"), - // PublisherID: to.Ptr("Oracle"), - // PurchaserEmailID: to.Ptr("test@test.com"), - // PurchaserTenantID: to.Ptr("1234567890"), - // SaasSubscriptionStatus: to.Ptr("PendingFulfillmentStart"), - // SubscriptionName: to.Ptr("Oracle"), - // TermUnit: to.Ptr("P1M"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-07T00:00:00.000Z"); return t}()), - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go index f34e50a6e231..842021dfdf9a 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go @@ -316,6 +316,11 @@ type OperationsClientListResponse struct { OperationListResult } +// OracleSubscriptionsClientAddAzureSubscriptionsResponse contains the response from method OracleSubscriptionsClient.BeginAddAzureSubscriptions. +type OracleSubscriptionsClientAddAzureSubscriptionsResponse struct { + // placeholder for future response values +} + // OracleSubscriptionsClientCreateOrUpdateResponse contains the response from method OracleSubscriptionsClient.BeginCreateOrUpdate. type OracleSubscriptionsClientCreateOrUpdateResponse struct { // OracleSubscription resource definition diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go index 9cd4a0226b2e..fcd6593861fb 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go @@ -46,7 +46,7 @@ func NewSystemVersionsClient(subscriptionID string, credential azcore.TokenCrede // Get - Get a SystemVersion // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - systemversionname - SystemVersion name // - options - SystemVersionsClientGetOptions contains the optional parameters for the SystemVersionsClient.Get method. @@ -92,7 +92,7 @@ func (client *SystemVersionsClient) getCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *SystemVersionsClient) getHandleResponse(resp *http.Response) (Syst // NewListByLocationPager - List SystemVersion resources by Location // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - location - The name of the Azure region. // - options - SystemVersionsClientListByLocationOptions contains the optional parameters for the SystemVersionsClient.NewListByLocationPager // method. @@ -152,7 +152,7 @@ func (client *SystemVersionsClient) listByLocationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go deleted file mode 100644 index 5a6d1aa80dad..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go +++ /dev/null @@ -1,78 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/systemVersions_listByLocation.json -func ExampleSystemVersionsClient_NewListByLocationPager_listExadataSystemVersionsByTheProvidedFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSystemVersionsClient().NewListByLocationPager("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.SystemVersionListResult = armoracledatabase.SystemVersionListResult{ - // Value: []*armoracledatabase.SystemVersion{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/systemVersion/22.1.7.0.0.230113"), - // Properties: &armoracledatabase.SystemVersionProperties{ - // SystemVersion: to.Ptr("22.1.7.0.0.230113"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/systemVersions_get.json -func ExampleSystemVersionsClient_Get_getExadataSystemVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSystemVersionsClient().Get(ctx, "eastus", "22.x", 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.SystemVersion = armoracledatabase.SystemVersion{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/systemVersion/22.1.7.0.0.230113"), - // Properties: &armoracledatabase.SystemVersionProperties{ - // SystemVersion: to.Ptr("22.1.7.0.0.230113"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go index a807d9ae6281..99c535fbcc80 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go @@ -46,7 +46,7 @@ func NewVirtualNetworkAddressesClient(subscriptionID string, credential azcore.T // BeginCreateOrUpdate - Create a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - virtualnetworkaddressname - Virtual IP address hostname. @@ -74,7 +74,7 @@ func (client *VirtualNetworkAddressesClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Create a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *VirtualNetworkAddressesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, options *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworkAddressesClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -132,7 +132,7 @@ func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx con // BeginDelete - Delete a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - virtualnetworkaddressname - Virtual IP address hostname. @@ -159,7 +159,7 @@ func (client *VirtualNetworkAddressesClient) BeginDelete(ctx context.Context, re // Delete - Delete a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 func (client *VirtualNetworkAddressesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworkAddressesClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Con // Get - Get a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - virtualnetworkaddressname - Virtual IP address hostname. @@ -266,7 +266,7 @@ func (client *VirtualNetworkAddressesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *VirtualNetworkAddressesClient) getHandleResponse(resp *http.Respon // NewListByCloudVMClusterPager - List VirtualNetworkAddress resources by CloudVmCluster // -// Generated from API version 2023-09-01 +// Generated from API version 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - options - VirtualNetworkAddressesClientListByCloudVMClusterOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByCloudVMClusterPager @@ -331,7 +331,7 @@ func (client *VirtualNetworkAddressesClient) listByCloudVMClusterCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go deleted file mode 100644 index 890f38a5f662..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go +++ /dev/null @@ -1,159 +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 armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_listByParent.json -func ExampleVirtualNetworkAddressesClient_NewListByCloudVMClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkAddressesClient().NewListByCloudVMClusterPager("rg000", "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.VirtualNetworkAddressListResult = armoracledatabase.VirtualNetworkAddressListResult{ - // Value: []*armoracledatabase.VirtualNetworkAddress{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters/virtualNetworkAddresses"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/virtualNetworkAddresses/hostname1"), - // Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - // Domain: to.Ptr("domain1"), - // IPAddress: to.Ptr("192.168.0.1"), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.VirtualNetworkAddressLifecycleStateAvailable), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // TimeAssigned: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T00:27:02.119Z"); return t}()), - // VMOcid: to.Ptr("ocid1..aaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_get.json -func ExampleVirtualNetworkAddressesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkAddressesClient().Get(ctx, "rg000", "cluster1", "hostname1", 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.VirtualNetworkAddress = armoracledatabase.VirtualNetworkAddress{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/virtualNetworkAddresses"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/virtualNetworkAddresses/hostname1"), - // Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - // Domain: to.Ptr("domain1"), - // IPAddress: to.Ptr("192.168.0.1"), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.VirtualNetworkAddressLifecycleStateAvailable), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // TimeAssigned: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T00:27:02.119Z"); return t}()), - // VMOcid: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_create.json -func ExampleVirtualNetworkAddressesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkAddressesClient().BeginCreateOrUpdate(ctx, "rg000", "cluster1", "hostname1", armoracledatabase.VirtualNetworkAddress{ - Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - IPAddress: to.Ptr("192.168.0.1"), - VMOcid: to.Ptr("ocid1..aaaa"), - }, - }, 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.VirtualNetworkAddress = armoracledatabase.VirtualNetworkAddress{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/virtualNetworkAddresses"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/virtualNetworkAddresses/hostname1"), - // Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - // Domain: to.Ptr("domain1"), - // IPAddress: to.Ptr("192.168.0.1"), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.VirtualNetworkAddressLifecycleStateAvailable), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // TimeAssigned: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T00:27:02.119Z"); return t}()), - // VMOcid: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_delete.json -func ExampleVirtualNetworkAddressesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkAddressesClient().BeginDelete(ctx, "rg000", "cluster1", "hostname1", 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/CHANGELOG.md b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md index f380709213f7..89b695733bbf 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 0.3.0 (2024-08-09) +### Breaking Changes + +- Field `AllocatedValue`, `CreatedAt`, `ExpiryAt`, `PercentageUsed`, `UsedValue` of struct `FreeTrialProperties` has been removed + +### Features Added + +- New value `FreeTrialStateNotEligible`, `FreeTrialStateNotRegistered` added to enum type `FreeTrialState` +- New value `ProvisioningStateCreating` added to enum type `ProvisioningState` +- New enum type `CheckNameAvailabilityReason` with values `CheckNameAvailabilityReasonAlreadyExists`, `CheckNameAvailabilityReasonInvalid` +- New function `NewAccountQuotasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccountQuotasClient, error)` +- New function `*AccountQuotasClient.Get(context.Context, string, string, QuotaNames, *AccountQuotasClientGetOptions) (AccountQuotasClientGetResponse, error)` +- New function `*AccountQuotasClient.NewListByAccountPager(string, string, *AccountQuotasClientListByAccountOptions) *runtime.Pager[AccountQuotasClientListByAccountResponse]` +- New function `*AccountsClient.CheckNameAvailability(context.Context, CheckNameAvailabilityRequest, *AccountsClientCheckNameAvailabilityOptions) (AccountsClientCheckNameAvailabilityResponse, error)` +- New function `*ClientFactory.NewAccountQuotasClient() *AccountQuotasClient` +- New struct `AccountFreeTrialProperties` +- New struct `AccountQuota` +- New struct `AccountQuotaListResult` +- New struct `AccountQuotaProperties` +- New struct `CheckNameAvailabilityRequest` +- New struct `CheckNameAvailabilityResponse` + + ## 0.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/README.md b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/README.md index 62671d53d9db..c55b54704976 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/README.md +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/README.md @@ -57,7 +57,7 @@ clientFactory, err := armplaywrighttesting.NewClientFactory(, c 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.NewQuotasClient() +client := clientFactory.NewAccountQuotasClient() ``` ## Fakes diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client.go new file mode 100644 index 000000000000..19c37edfb994 --- /dev/null +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armplaywrighttesting + +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" +) + +// AccountQuotasClient contains the methods for the AccountQuotas group. +// Don't use this type directly, use NewAccountQuotasClient() instead. +type AccountQuotasClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccountQuotasClient creates a new instance of AccountQuotasClient 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 NewAccountQuotasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountQuotasClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccountQuotasClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get quota by name for an account. +// 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. +// - accountName - Name of account. +// - quotaName - The Playwright service account quota name. +// - options - AccountQuotasClientGetOptions contains the optional parameters for the AccountQuotasClient.Get method. +func (client *AccountQuotasClient) Get(ctx context.Context, resourceGroupName string, accountName string, quotaName QuotaNames, options *AccountQuotasClientGetOptions) (AccountQuotasClientGetResponse, error) { + var err error + const operationName = "AccountQuotasClient.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, accountName, quotaName, options) + if err != nil { + return AccountQuotasClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountQuotasClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountQuotasClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AccountQuotasClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, quotaName QuotaNames, options *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") + } + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if quotaName == "" { + return nil, errors.New("parameter quotaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{quotaName}", url.PathEscape(string(quotaName))) + 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 *AccountQuotasClient) getHandleResponse(resp *http.Response) (AccountQuotasClientGetResponse, error) { + result := AccountQuotasClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountQuota); err != nil { + return AccountQuotasClientGetResponse{}, err + } + return result, nil +} + +// NewListByAccountPager - List quotas for a given account. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Name of account. +// - options - AccountQuotasClientListByAccountOptions contains the optional parameters for the AccountQuotasClient.NewListByAccountPager +// method. +func (client *AccountQuotasClient) NewListByAccountPager(resourceGroupName string, accountName string, options *AccountQuotasClientListByAccountOptions) *runtime.Pager[AccountQuotasClientListByAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[AccountQuotasClientListByAccountResponse]{ + More: func(page AccountQuotasClientListByAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccountQuotasClientListByAccountResponse) (AccountQuotasClientListByAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountQuotasClient.NewListByAccountPager") + 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.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return AccountQuotasClientListByAccountResponse{}, err + } + return client.listByAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByAccountCreateRequest creates the ListByAccount request. +func (client *AccountQuotasClient) listByAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *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") + } + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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 +} + +// listByAccountHandleResponse handles the ListByAccount response. +func (client *AccountQuotasClient) listByAccountHandleResponse(resp *http.Response) (AccountQuotasClientListByAccountResponse, error) { + result := AccountQuotasClientListByAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountQuotaListResult); err != nil { + return AccountQuotasClientListByAccountResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go index 4cc48490df7d..c7fdba85e044 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go @@ -28,7 +28,7 @@ type AccountsClient struct { } // NewAccountsClient creates a new instance of AccountsClient 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 NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { @@ -43,18 +43,78 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } +// CheckNameAvailability - Adds check global name availability operation, normally used if a resource name must be globally +// unique. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - body - The CheckAvailability request +// - options - AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability +// method. +func (client *AccountsClient) CheckNameAvailability(ctx context.Context, body CheckNameAvailabilityRequest, options *AccountsClientCheckNameAvailabilityOptions) (AccountsClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "AccountsClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, body, options) + if err != nil { + return AccountsClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailabilityRequest, options *AccountsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability" + 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", "2024-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 +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AccountsClientCheckNameAvailabilityResponse, error) { + result := AccountsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return AccountsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + // BeginCreateOrUpdate - Create a Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - name - Name of account +// - accountName - Name of account. // - resource - Resource create parameters. // - options - AccountsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccountsClient.BeginCreateOrUpdate // method. -func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, name string, resource Account, options *AccountsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AccountsClientCreateOrUpdateResponse], error) { +func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, resource Account, options *AccountsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AccountsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, name, resource, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, resource, options) if err != nil { return nil, err } @@ -73,14 +133,14 @@ func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create a Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, name string, resource Account, options *AccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-02-01-preview +func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, resource Account, options *AccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.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, name, resource, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, resource, options) if err != nil { return nil, err } @@ -96,8 +156,8 @@ func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, name string, resource Account, options *AccountsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" +func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, resource Account, options *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") } @@ -106,16 +166,16 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) 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-10-01-preview") + 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 { @@ -127,13 +187,13 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - name - Name of account +// - accountName - Name of account. // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. -func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, name string, options *AccountsClientBeginDeleteOptions) (*runtime.Poller[AccountsClientDeleteResponse], error) { +func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*runtime.Poller[AccountsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, name, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, options) if err != nil { return nil, err } @@ -152,14 +212,14 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, name string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-02-01-preview +func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.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, name, options) + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return nil, err } @@ -175,8 +235,8 @@ func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, name string, options *AccountsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" +func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *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") } @@ -185,16 +245,16 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) 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-10-01-preview") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,17 +263,17 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - name - Name of account +// - accountName - Name of account. // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. -func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, name string, options *AccountsClientGetOptions) (AccountsClientGetResponse, error) { +func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetOptions) (AccountsClientGetResponse, error) { var err error const operationName = "AccountsClient.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, name, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientGetResponse{}, err } @@ -230,8 +290,8 @@ func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, name string, options *AccountsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" +func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *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") } @@ -240,16 +300,16 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) 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-01-preview") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +326,7 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl // NewListByResourceGroupPager - List Account resources by resource group // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. @@ -309,7 +369,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +386,7 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - List Account resources by subscription ID // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager // method. func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { @@ -364,7 +424,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,18 +442,18 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Update a Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - name - Name of account +// - accountName - Name of account. // - properties - The resource properties to be updated. // - options - AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method. -func (client *AccountsClient) Update(ctx context.Context, resourceGroupName string, name string, properties AccountUpdate, options *AccountsClientUpdateOptions) (AccountsClientUpdateResponse, error) { +func (client *AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, properties AccountUpdate, options *AccountsClientUpdateOptions) (AccountsClientUpdateResponse, error) { var err error const operationName = "AccountsClient.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, name, properties, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, properties, options) if err != nil { return AccountsClientUpdateResponse{}, err } @@ -410,8 +470,8 @@ func (client *AccountsClient) Update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, name string, properties AccountUpdate, options *AccountsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}" +func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, properties AccountUpdate, options *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") } @@ -420,16 +480,16 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) 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-10-01-preview") + 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 { 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 13ff1de1ab40..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client_example_test.go +++ /dev/null @@ -1,296 +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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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 9d7b7e3857ba..c432c01ad74c 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/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: 0.2.0 -tag: package-2023-10-01-preview +module-version: 0.3.0 ``` \ 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 70b8c8f192bc..8f5324dba41a 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/client_factory.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/client_factory.go @@ -17,40 +17,52 @@ 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 } +// NewAccountQuotasClient creates a new instance of AccountQuotasClient. +func (c *ClientFactory) NewAccountQuotasClient() *AccountQuotasClient { + return &AccountQuotasClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewAccountsClient creates a new instance of AccountsClient. func (c *ClientFactory) NewAccountsClient() *AccountsClient { - subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AccountsClient{ + 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/playwrighttesting/armplaywrighttesting/constants.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/constants.go index e22e04306660..5fe80869cdc3 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/constants.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/constants.go @@ -10,7 +10,7 @@ package armplaywrighttesting const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/playwrighttesting/armplaywrighttesting" - moduleVersion = "v0.2.0" + moduleVersion = "v0.3.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,6 +27,22 @@ func PossibleActionTypeValues() []ActionType { } } +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -47,7 +63,9 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// EnablementStatus - The enablement status of a feature. +// EnablementStatus - This property sets the connection region for Playwright client workers to cloud-hosted browsers. If +// enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If +// disabled, workers connect to browsers in the Azure region in which the workspace was initially created. type EnablementStatus string const ( @@ -73,6 +91,10 @@ const ( FreeTrialStateActive FreeTrialState = "Active" // FreeTrialStateExpired - The free-trial is Expired. FreeTrialStateExpired FreeTrialState = "Expired" + // FreeTrialStateNotEligible - The free-trial is Not Eligible. + FreeTrialStateNotEligible FreeTrialState = "NotEligible" + // FreeTrialStateNotRegistered - The free-trial is Not Registered. + FreeTrialStateNotRegistered FreeTrialState = "NotRegistered" ) // PossibleFreeTrialStateValues returns the possible values for the FreeTrialState const type. @@ -80,6 +102,8 @@ func PossibleFreeTrialStateValues() []FreeTrialState { return []FreeTrialState{ FreeTrialStateActive, FreeTrialStateExpired, + FreeTrialStateNotEligible, + FreeTrialStateNotRegistered, } } @@ -106,11 +130,13 @@ func PossibleOriginValues() []Origin { type ProvisioningState string const ( - // ProvisioningStateAccepted - Change accepted for processing + // ProvisioningStateAccepted - Change accepted for processing.. ProvisioningStateAccepted ProvisioningState = "Accepted" // ProvisioningStateCanceled - Resource creation was canceled. ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateDeleting - Deletion in progress + // ProvisioningStateCreating - Creation in progress.. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - Deletion in progress.. ProvisioningStateDeleting ProvisioningState = "Deleting" // ProvisioningStateFailed - Resource creation failed. ProvisioningStateFailed ProvisioningState = "Failed" @@ -123,6 +149,7 @@ func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ ProvisioningStateAccepted, ProvisioningStateCanceled, + ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_server.go new file mode 100644 index 000000000000..aaeeb23aa185 --- /dev/null +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_server.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/playwrighttesting/armplaywrighttesting" + "net/http" + "net/url" + "regexp" +) + +// AccountQuotasServer is a fake server for instances of the armplaywrighttesting.AccountQuotasClient type. +type AccountQuotasServer struct { + // Get is the fake for method AccountQuotasClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, quotaName armplaywrighttesting.QuotaNames, options *armplaywrighttesting.AccountQuotasClientGetOptions) (resp azfake.Responder[armplaywrighttesting.AccountQuotasClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByAccountPager is the fake for method AccountQuotasClient.NewListByAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByAccountPager func(resourceGroupName string, accountName string, options *armplaywrighttesting.AccountQuotasClientListByAccountOptions) (resp azfake.PagerResponder[armplaywrighttesting.AccountQuotasClientListByAccountResponse]) +} + +// NewAccountQuotasServerTransport creates a new instance of AccountQuotasServerTransport with the provided implementation. +// The returned AccountQuotasServerTransport instance is connected to an instance of armplaywrighttesting.AccountQuotasClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAccountQuotasServerTransport(srv *AccountQuotasServer) *AccountQuotasServerTransport { + return &AccountQuotasServerTransport{ + srv: srv, + newListByAccountPager: newTracker[azfake.PagerResponder[armplaywrighttesting.AccountQuotasClientListByAccountResponse]](), + } +} + +// AccountQuotasServerTransport connects instances of armplaywrighttesting.AccountQuotasClient to instances of AccountQuotasServer. +// Don't use this type directly, use NewAccountQuotasServerTransport instead. +type AccountQuotasServerTransport struct { + srv *AccountQuotasServer + newListByAccountPager *tracker[azfake.PagerResponder[armplaywrighttesting.AccountQuotasClientListByAccountResponse]] +} + +// Do implements the policy.Transporter interface for AccountQuotasServerTransport. +func (a *AccountQuotasServerTransport) 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 "AccountQuotasClient.Get": + resp, err = a.dispatchGet(req) + case "AccountQuotasClient.NewListByAccountPager": + resp, err = a.dispatchNewListByAccountPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AccountQuotasServerTransport) 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\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotas/(?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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + quotaNameParam, err := parseWithCast(matches[regex.SubexpIndex("quotaName")], func(v string) (armplaywrighttesting.QuotaNames, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armplaywrighttesting.QuotaNames(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, quotaNameParam, 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).AccountQuota, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AccountQuotasServerTransport) dispatchNewListByAccountPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByAccountPager not implemented")} + } + newListByAccountPager := a.newListByAccountPager.get(req) + if newListByAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotas` + 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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByAccountPager(resourceGroupNameParam, accountNameParam, nil) + newListByAccountPager = &resp + a.newListByAccountPager.add(req, newListByAccountPager) + server.PagerResponderInjectNextLinks(newListByAccountPager, req, func(page *armplaywrighttesting.AccountQuotasClientListByAccountResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByAccountPager) { + a.newListByAccountPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_server.go index 5bea17a7df82..6e29aa50bb41 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_server.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_server.go @@ -24,17 +24,21 @@ import ( // AccountsServer is a fake server for instances of the armplaywrighttesting.AccountsClient type. type AccountsServer struct { + // CheckNameAvailability is the fake for method AccountsClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, body armplaywrighttesting.CheckNameAvailabilityRequest, options *armplaywrighttesting.AccountsClientCheckNameAvailabilityOptions) (resp azfake.Responder[armplaywrighttesting.AccountsClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method AccountsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, name string, resource armplaywrighttesting.Account, options *armplaywrighttesting.AccountsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armplaywrighttesting.AccountsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + 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.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, name string, options *armplaywrighttesting.AccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armplaywrighttesting.AccountsClientDeleteResponse], errResp azfake.ErrorResponder) + 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 // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, name string, options *armplaywrighttesting.AccountsClientGetOptions) (resp azfake.Responder[armplaywrighttesting.AccountsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, accountName string, options *armplaywrighttesting.AccountsClientGetOptions) (resp azfake.Responder[armplaywrighttesting.AccountsClientGetResponse], errResp azfake.ErrorResponder) // NewListByResourceGroupPager is the fake for method AccountsClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK @@ -46,7 +50,7 @@ type AccountsServer struct { // Update is the fake for method AccountsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, name string, properties armplaywrighttesting.AccountUpdate, options *armplaywrighttesting.AccountsClientUpdateOptions) (resp azfake.Responder[armplaywrighttesting.AccountsClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, accountName string, properties armplaywrighttesting.AccountUpdate, options *armplaywrighttesting.AccountsClientUpdateOptions) (resp azfake.Responder[armplaywrighttesting.AccountsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewAccountsServerTransport creates a new instance of AccountsServerTransport with the provided implementation. @@ -84,6 +88,8 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) var err error switch method { + case "AccountsClient.CheckNameAvailability": + resp, err = a.dispatchCheckNameAvailability(req) case "AccountsClient.BeginCreateOrUpdate": resp, err = a.dispatchBeginCreateOrUpdate(req) case "AccountsClient.BeginDelete": @@ -107,13 +113,42 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) return resp, nil } +func (a *AccountsServerTransport) 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\.AzurePlaywrightService/checkNameAvailability` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armplaywrighttesting.CheckNameAvailabilityRequest](req) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CheckNameAvailability(req.Context(), 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).CheckNameAvailabilityResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (a *AccountsServerTransport) 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\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -127,11 +162,11 @@ func (a *AccountsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) if err != nil { return nil, err } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) if err != nil { return nil, err } - respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, nameParam, body, nil) + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -161,7 +196,7 @@ func (a *AccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http. } beginDelete := a.beginDelete.get(req) if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -171,11 +206,11 @@ func (a *AccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http. if err != nil { return nil, err } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) if err != nil { return nil, err } - respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, nameParam, nil) + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -203,7 +238,7 @@ func (a *AccountsServerTransport) dispatchGet(req *http.Request) (*http.Response 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\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -213,11 +248,11 @@ func (a *AccountsServerTransport) dispatchGet(req *http.Request) (*http.Response if err != nil { return nil, err } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) if err != nil { return nil, err } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, nameParam, nil) + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -306,7 +341,7 @@ func (a *AccountsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo 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\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -320,11 +355,11 @@ func (a *AccountsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo if err != nil { return nil, err } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) if err != nil { return nil, err } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, nameParam, body, nil) + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/quotas_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/quotas_server.go index d8ead07224bb..d21966504bf1 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/quotas_server.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/quotas_server.go @@ -26,7 +26,7 @@ import ( type QuotasServer struct { // Get is the fake for method QuotasClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, location string, name armplaywrighttesting.QuotaNames, options *armplaywrighttesting.QuotasClientGetOptions) (resp azfake.Responder[armplaywrighttesting.QuotasClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, quotaName armplaywrighttesting.QuotaNames, options *armplaywrighttesting.QuotasClientGetOptions) (resp azfake.Responder[armplaywrighttesting.QuotasClientGetResponse], errResp azfake.ErrorResponder) // NewListBySubscriptionPager is the fake for method QuotasClient.NewListBySubscriptionPager // HTTP status codes to indicate success: http.StatusOK @@ -81,7 +81,7 @@ func (q *QuotasServerTransport) dispatchGet(req *http.Request) (*http.Response, if q.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzurePlaywrightService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -91,7 +91,7 @@ func (q *QuotasServerTransport) dispatchGet(req *http.Request) (*http.Response, if err != nil { return nil, err } - nameParam, err := parseWithCast(matches[regex.SubexpIndex("name")], func(v string) (armplaywrighttesting.QuotaNames, error) { + quotaNameParam, err := parseWithCast(matches[regex.SubexpIndex("quotaName")], func(v string) (armplaywrighttesting.QuotaNames, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { return "", unescapeErr @@ -101,7 +101,7 @@ func (q *QuotasServerTransport) dispatchGet(req *http.Request) (*http.Response, if err != nil { return nil, err } - respr, errRespr := q.srv.Get(req.Context(), locationParam, nameParam, nil) + respr, errRespr := q.srv.Get(req.Context(), locationParam, quotaNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/server_factory.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/server_factory.go index 82fe881c4aee..cbfc3bbc6cd1 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/server_factory.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/server_factory.go @@ -19,9 +19,10 @@ import ( // ServerFactory is a fake server for instances of the armplaywrighttesting.ClientFactory type. type ServerFactory struct { - AccountsServer AccountsServer - OperationsServer OperationsServer - QuotasServer QuotasServer + AccountQuotasServer AccountQuotasServer + AccountsServer AccountsServer + OperationsServer OperationsServer + QuotasServer QuotasServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -36,11 +37,12 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armplaywrighttesting.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAccountsServer *AccountsServerTransport - trOperationsServer *OperationsServerTransport - trQuotasServer *QuotasServerTransport + srv *ServerFactory + trMu sync.Mutex + trAccountQuotasServer *AccountQuotasServerTransport + trAccountsServer *AccountsServerTransport + trOperationsServer *OperationsServerTransport + trQuotasServer *QuotasServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -56,6 +58,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AccountQuotasClient": + initServer(s, &s.trAccountQuotasServer, func() *AccountQuotasServerTransport { + return NewAccountQuotasServerTransport(&s.srv.AccountQuotasServer) + }) + resp, err = s.trAccountQuotasServer.Do(req) case "AccountsClient": initServer(s, &s.trAccountsServer, func() *AccountsServerTransport { return NewAccountsServerTransport(&s.srv.AccountsServer) }) resp, err = s.trAccountsServer.Do(req) diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/playwrighttesting/armplaywrighttesting/go.mod b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.mod index 977d18be0a72..57023246b343 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= 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 1b0bfe8a05e6..eb0c53420b88 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models.go @@ -10,7 +10,7 @@ package armplaywrighttesting import "time" -// Account - An account resource +// Account - A Playwright service account resource. type Account struct { // REQUIRED; The geo-location where the resource lives Location *string @@ -21,7 +21,7 @@ type Account 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 @@ -34,6 +34,24 @@ type Account struct { Type *string } +// AccountFreeTrialProperties - The Playwright service account quota resource free-trial properties. +type AccountFreeTrialProperties struct { + // READ-ONLY; The free-trial allocated limit value eg. allocated free minutes. + AllocatedValue *int32 + + // READ-ONLY; The free-trial createdAt utcDateTime. + CreatedAt *time.Time + + // READ-ONLY; The free-trial expiryAt utcDateTime. + ExpiryAt *time.Time + + // READ-ONLY; The free-trial percentage used. + PercentageUsed *float32 + + // READ-ONLY; The free-trial used value eg. used free minutes. + UsedValue *int32 +} + // AccountListResult - The response of a Account list operation. type AccountListResult struct { // REQUIRED; The Account items on this page @@ -43,7 +61,7 @@ type AccountListResult struct { NextLink *string } -// AccountProperties - Account properties +// AccountProperties - Account resource properties. type AccountProperties struct { // This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect // to browsers in the closest Azure region, ensuring lower latency. If @@ -66,9 +84,45 @@ type AccountProperties struct { ProvisioningState *ProvisioningState } +// AccountQuota - A quota resource for a Playwright service account. +type AccountQuota struct { + // The resource-specific properties for this resource. + Properties *AccountQuotaProperties + + // 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 +} + +// AccountQuotaListResult - The response of a AccountQuota list operation. +type AccountQuotaListResult struct { + // REQUIRED; The AccountQuota items on this page + Value []*AccountQuota + + // The link to the next page of items + NextLink *string +} + +// AccountQuotaProperties - The Playwright service account quota resource properties. +type AccountQuotaProperties struct { + // The Playwright service account quota resource free-trial properties. + FreeTrial *AccountFreeTrialProperties + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + // AccountUpdate - The type used for update operations of the Account. type AccountUpdate struct { - // The updatable properties of the Account. + // The resource-specific properties for this resource. Properties *AccountUpdateProperties // Resource tags. @@ -92,28 +146,34 @@ type AccountUpdateProperties struct { ScalableExecution *EnablementStatus } -// FreeTrialProperties - The free-trial properties -type FreeTrialProperties struct { - // READ-ONLY; The playwright account id. - AccountID *string +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string - // READ-ONLY; The free-trial allocated limit value eg. allocated free minutes. - AllocatedValue *int32 + // The resource type. + Type *string +} - // READ-ONLY; The free-trial createdAt utcDateTime. - CreatedAt *time.Time +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string - // READ-ONLY; The free-trial expiryAt utcDateTime. - ExpiryAt *time.Time + // Indicates if the resource name is available. + NameAvailable *bool - // READ-ONLY; The free-trial percentage used. - PercentageUsed *float64 + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason +} + +// FreeTrialProperties - The subscription quota resource free-trial properties. +type FreeTrialProperties struct { + // READ-ONLY; The Playwright service account id. + AccountID *string // READ-ONLY; The free-trial state. State *FreeTrialState - - // READ-ONLY; The free-trial used value eg. used free minutes. - UsedValue *int32 } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API @@ -165,12 +225,12 @@ type OperationListResult struct { Value []*Operation } -// Quota - A quota resource +// Quota - A subscription quota resource. type Quota struct { // The resource-specific properties for this resource. Properties *QuotaProperties - // 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 @@ -192,9 +252,9 @@ type QuotaListResult struct { NextLink *string } -// QuotaProperties - Quota properties +// QuotaProperties - The subscription quota resource properties. type QuotaProperties struct { - // The free-trial quota. + // The subscription quota resource free-trial properties. FreeTrial *FreeTrialProperties // READ-ONLY; The status of the last operation. diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go index 9a4988b764c5..29cf053ed521 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go @@ -66,6 +66,49 @@ func (a *Account) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountFreeTrialProperties. +func (a AccountFreeTrialProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedValue", a.AllocatedValue) + populateDateTimeRFC3339(objectMap, "createdAt", a.CreatedAt) + populateDateTimeRFC3339(objectMap, "expiryAt", a.ExpiryAt) + populate(objectMap, "percentageUsed", a.PercentageUsed) + populate(objectMap, "usedValue", a.UsedValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountFreeTrialProperties. +func (a *AccountFreeTrialProperties) UnmarshalJSON(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 "allocatedValue": + err = unpopulate(val, "AllocatedValue", &a.AllocatedValue) + delete(rawMsg, key) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &a.CreatedAt) + delete(rawMsg, key) + case "expiryAt": + err = unpopulateDateTimeRFC3339(val, "ExpiryAt", &a.ExpiryAt) + delete(rawMsg, key) + case "percentageUsed": + err = unpopulate(val, "PercentageUsed", &a.PercentageUsed) + delete(rawMsg, key) + case "usedValue": + err = unpopulate(val, "UsedValue", &a.UsedValue) + 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 AccountListResult. func (a AccountListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -140,6 +183,111 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountQuota. +func (a AccountQuota) 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 AccountQuota. +func (a *AccountQuota) UnmarshalJSON(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 AccountQuotaListResult. +func (a AccountQuotaListResult) 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 AccountQuotaListResult. +func (a *AccountQuotaListResult) UnmarshalJSON(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 AccountQuotaProperties. +func (a AccountQuotaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "freeTrial", a.FreeTrial) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountQuotaProperties. +func (a *AccountQuotaProperties) UnmarshalJSON(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 "freeTrial": + err = unpopulate(val, "FreeTrial", &a.FreeTrial) + 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 AccountUpdate. func (a AccountUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -206,16 +354,77 @@ func (a *AccountUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) 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 CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) UnmarshalJSON(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 CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse. +func (c *CheckNameAvailabilityResponse) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 FreeTrialProperties. func (f FreeTrialProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accountId", f.AccountID) - populate(objectMap, "allocatedValue", f.AllocatedValue) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populateDateTimeRFC3339(objectMap, "expiryAt", f.ExpiryAt) - populate(objectMap, "percentageUsed", f.PercentageUsed) populate(objectMap, "state", f.State) - populate(objectMap, "usedValue", f.UsedValue) return json.Marshal(objectMap) } @@ -231,24 +440,9 @@ func (f *FreeTrialProperties) UnmarshalJSON(data []byte) error { case "accountId": err = unpopulate(val, "AccountID", &f.AccountID) delete(rawMsg, key) - case "allocatedValue": - err = unpopulate(val, "AllocatedValue", &f.AllocatedValue) - delete(rawMsg, key) - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "expiryAt": - err = unpopulateDateTimeRFC3339(val, "ExpiryAt", &f.ExpiryAt) - delete(rawMsg, key) - case "percentageUsed": - err = unpopulate(val, "PercentageUsed", &f.PercentageUsed) - delete(rawMsg, key) case "state": err = unpopulate(val, "State", &f.State) delete(rawMsg, key) - case "usedValue": - err = unpopulate(val, "UsedValue", &f.UsedValue) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -533,7 +727,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/playwrighttesting/armplaywrighttesting/operations_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client.go index 9fd90a013fb9..ae896087f505 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-10-01-preview +// 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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + 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/playwrighttesting/armplaywrighttesting/operations_client_example_test.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client_example_test.go deleted file mode 100644 index 67476c07edf5..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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-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 := 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 7bbd42677d27..44020bef05cb 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/options.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/options.go @@ -8,6 +8,17 @@ package armplaywrighttesting +// AccountQuotasClientGetOptions contains the optional parameters for the AccountQuotasClient.Get method. +type AccountQuotasClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccountQuotasClientListByAccountOptions contains the optional parameters for the AccountQuotasClient.NewListByAccountPager +// method. +type AccountQuotasClientListByAccountOptions struct { + // placeholder for future optional parameters +} + // AccountsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccountsClient.BeginCreateOrUpdate method. type AccountsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. @@ -20,6 +31,12 @@ type AccountsClientBeginDeleteOptions struct { ResumeToken string } +// AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability +// method. +type AccountsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + // AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. type AccountsClientGetOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go index 0386179ca411..5c5a7b7b46a8 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go @@ -28,7 +28,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) { @@ -43,20 +43,20 @@ func NewQuotasClient(subscriptionID string, credential azcore.TokenCredential, o return client, nil } -// Get - Get quota by name. +// Get - Get subscription quota by name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - location - The location of quota in ARM Normalized format like eastus, southeastasia etc. -// - name - The quota name. +// - quotaName - The quota name. // - options - QuotasClientGetOptions contains the optional parameters for the QuotasClient.Get method. -func (client *QuotasClient) Get(ctx context.Context, location string, name QuotaNames, options *QuotasClientGetOptions) (QuotasClientGetResponse, error) { +func (client *QuotasClient) Get(ctx context.Context, location string, quotaName QuotaNames, options *QuotasClientGetOptions) (QuotasClientGetResponse, error) { var err error const operationName = "QuotasClient.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, name, options) + req, err := client.getCreateRequest(ctx, location, quotaName, options) if err != nil { return QuotasClientGetResponse{}, err } @@ -73,8 +73,8 @@ func (client *QuotasClient) Get(ctx context.Context, location string, name Quota } // getCreateRequest creates the Get request. -func (client *QuotasClient) getCreateRequest(ctx context.Context, location string, name QuotaNames, options *QuotasClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}" +func (client *QuotasClient) getCreateRequest(ctx context.Context, location string, quotaName QuotaNames, options *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") } @@ -83,16 +83,16 @@ func (client *QuotasClient) getCreateRequest(ctx context.Context, location strin return nil, errors.New("parameter location cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") + if quotaName == "" { + return nil, errors.New("parameter quotaName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(string(name))) + urlPath = strings.ReplaceAll(urlPath, "{quotaName}", url.PathEscape(string(quotaName))) 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-01-preview") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *QuotasClient) getHandleResponse(resp *http.Response) (QuotasClient // NewListBySubscriptionPager - List quotas for a given subscription Id. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-02-01-preview // - location - The location of quota in ARM Normalized format like eastus, southeastasia etc. // - options - QuotasClientListBySubscriptionOptions contains the optional parameters for the QuotasClient.NewListBySubscriptionPager // method. @@ -152,7 +152,7 @@ func (client *QuotasClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + 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/playwrighttesting/armplaywrighttesting/quotas_client_example_test.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client_example_test.go deleted file mode 100644 index a4258393d89c..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_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 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/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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[float64](100), - // State: to.Ptr(armplaywrighttesting.FreeTrialStateActive), - // UsedValue: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/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"), - // 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[float64](100), - // State: to.Ptr(armplaywrighttesting.FreeTrialStateActive), - // UsedValue: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/response_types.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/responses.go similarity index 71% rename from sdk/resourcemanager/playwrighttesting/armplaywrighttesting/response_types.go rename to sdk/resourcemanager/playwrighttesting/armplaywrighttesting/responses.go index 648af84beb18..66f882cdd186 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/response_types.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/responses.go @@ -8,9 +8,27 @@ package armplaywrighttesting +// AccountQuotasClientGetResponse contains the response from method AccountQuotasClient.Get. +type AccountQuotasClientGetResponse struct { + // A quota resource for a Playwright service account. + AccountQuota +} + +// AccountQuotasClientListByAccountResponse contains the response from method AccountQuotasClient.NewListByAccountPager. +type AccountQuotasClientListByAccountResponse struct { + // The response of a AccountQuota list operation. + AccountQuotaListResult +} + +// AccountsClientCheckNameAvailabilityResponse contains the response from method AccountsClient.CheckNameAvailability. +type AccountsClientCheckNameAvailabilityResponse struct { + // The check availability result. + CheckNameAvailabilityResponse +} + // AccountsClientCreateOrUpdateResponse contains the response from method AccountsClient.BeginCreateOrUpdate. type AccountsClientCreateOrUpdateResponse struct { - // An account resource + // A Playwright service account resource. Account } @@ -21,7 +39,7 @@ type AccountsClientDeleteResponse struct { // AccountsClientGetResponse contains the response from method AccountsClient.Get. type AccountsClientGetResponse struct { - // An account resource + // A Playwright service account resource. Account } @@ -39,7 +57,7 @@ type AccountsClientListBySubscriptionResponse struct { // AccountsClientUpdateResponse contains the response from method AccountsClient.Update. type AccountsClientUpdateResponse struct { - // An account resource + // A Playwright service account resource. Account } @@ -51,7 +69,7 @@ type OperationsClientListResponse struct { // QuotasClientGetResponse contains the response from method QuotasClient.Get. type QuotasClientGetResponse struct { - // A quota resource + // A subscription quota resource. Quota } diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go index 5d2bdbbbc83c..8b01a8334f23 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/portal/armportal/CHANGELOG.md b/sdk/resourcemanager/portal/armportal/CHANGELOG.md index fd3d8aefbb26..00ea1a578edd 100644 --- a/sdk/resourcemanager/portal/armportal/CHANGELOG.md +++ b/sdk/resourcemanager/portal/armportal/CHANGELOG.md @@ -1,5 +1,54 @@ # Release History +## 0.8.0 (2024-08-09) +### Breaking Changes + +- Function `*TenantConfigurationsClient.Create` parameter(s) have been changed from `(context.Context, ConfigurationName, Configuration, *TenantConfigurationsClientCreateOptions)` to `(context.Context, string, Configuration, *TenantConfigurationsClientCreateOptions)` +- Function `*TenantConfigurationsClient.Delete` parameter(s) have been changed from `(context.Context, ConfigurationName, *TenantConfigurationsClientDeleteOptions)` to `(context.Context, string, *TenantConfigurationsClientDeleteOptions)` +- Function `*TenantConfigurationsClient.Get` parameter(s) have been changed from `(context.Context, ConfigurationName, *TenantConfigurationsClientGetOptions)` to `(context.Context, string, *TenantConfigurationsClientGetOptions)` +- Type of `Dashboard.Properties` has been changed from `*DashboardProperties` to `*DashboardPropertiesWithProvisioningState` +- Type of `DashboardPartMetadata.Type` has been changed from `*string` to `*DashboardPartMetadataType` +- Type of `ErrorResponse.Error` has been changed from `*ErrorDefinition` to `*ErrorDetail` +- Type of `MarkdownPartMetadata.Type` has been changed from `*string` to `*DashboardPartMetadataType` +- Enum `ConfigurationName` has been removed +- Struct `ConfigurationList` has been removed +- Struct `ErrorDefinition` has been removed +- Struct `ResourceProviderOperation` has been removed +- Struct `ResourceProviderOperationDisplay` has been removed +- Struct `ResourceProviderOperationList` has been removed +- Field `AdditionalProperties` of struct `DashboardPartMetadata` has been removed +- Field `AdditionalProperties` of struct `MarkdownPartMetadata` has been removed +- Field `ResourceProviderOperationList` of struct `OperationsClientListResponse` has been removed +- Field `ConfigurationList` of struct `TenantConfigurationsClientListResponse` has been removed + +### Features Added + +- Type of `DashboardLens.Metadata` has been changed from `map[string]any` to `any` +- Type of `DashboardPartsPosition.Metadata` has been changed from `map[string]any` to `any` +- Type of `DashboardProperties.Metadata` has been changed from `map[string]any` to `any` +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `DashboardPartMetadataType` with values `DashboardPartMetadataTypeMarkdown` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `ResourceProvisioningState` with values `ResourceProvisioningStateCanceled`, `ResourceProvisioningStateFailed`, `ResourceProvisioningStateSucceeded` +- New struct `ConfigurationListResult` +- New struct `DashboardPropertiesWithProvisioningState` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `SystemData` +- New struct `TrackedResource` +- New field `SystemData` in struct `Configuration` +- New field `ProvisioningState` in struct `ConfigurationProperties` +- New field `SystemData` in struct `Dashboard` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New anonymous field `ConfigurationListResult` in struct `TenantConfigurationsClientListResponse` + + ## 0.7.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/portal/armportal/autorest.md b/sdk/resourcemanager/portal/armportal/autorest.md index 2b608d557b35..a0e6d26cfebd 100644 --- a/sdk/resourcemanager/portal/armportal/autorest.md +++ b/sdk/resourcemanager/portal/armportal/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/portal/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/portal/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 +module-version: 0.8.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/portal/armportal/client_factory.go b/sdk/resourcemanager/portal/armportal/client_factory.go index 535bca560988..24bcebeb848b 100644 --- a/sdk/resourcemanager/portal/armportal/client_factory.go +++ b/sdk/resourcemanager/portal/armportal/client_factory.go @@ -17,46 +17,50 @@ 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// - 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 } // NewDashboardsClient creates a new instance of DashboardsClient. func (c *ClientFactory) NewDashboardsClient() *DashboardsClient { - subClient, _ := NewDashboardsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DashboardsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewListTenantConfigurationViolationsClient creates a new instance of ListTenantConfigurationViolationsClient. func (c *ClientFactory) NewListTenantConfigurationViolationsClient() *ListTenantConfigurationViolationsClient { - subClient, _ := NewListTenantConfigurationViolationsClient(c.credential, c.options) - return subClient + return &ListTenantConfigurationViolationsClient{ + 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, + } } // NewTenantConfigurationsClient creates a new instance of TenantConfigurationsClient. func (c *ClientFactory) NewTenantConfigurationsClient() *TenantConfigurationsClient { - subClient, _ := NewTenantConfigurationsClient(c.credential, c.options) - return subClient + return &TenantConfigurationsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/portal/armportal/constants.go b/sdk/resourcemanager/portal/armportal/constants.go index 5db91be60e6d..d056e5e7aa70 100644 --- a/sdk/resourcemanager/portal/armportal/constants.go +++ b/sdk/resourcemanager/portal/armportal/constants.go @@ -10,18 +10,94 @@ package armportal const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/portal/armportal" - moduleVersion = "v0.7.0" + moduleVersion = "v0.8.0" ) -type ConfigurationName string +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string const ( - ConfigurationNameDefault ConfigurationName = "default" + ActionTypeInternal ActionType = "Internal" ) -// PossibleConfigurationNameValues returns the possible values for the ConfigurationName const type. -func PossibleConfigurationNameValues() []ConfigurationName { - return []ConfigurationName{ - ConfigurationNameDefault, +// 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, + } +} + +// DashboardPartMetadataType - The dashboard part metadata type. +type DashboardPartMetadataType string + +const ( + // DashboardPartMetadataTypeMarkdown - The markdown part type. + DashboardPartMetadataTypeMarkdown DashboardPartMetadataType = "Extension/HubsExtension/PartType/MarkdownPart" +) + +// PossibleDashboardPartMetadataTypeValues returns the possible values for the DashboardPartMetadataType const type. +func PossibleDashboardPartMetadataTypeValues() []DashboardPartMetadataType { + return []DashboardPartMetadataType{ + DashboardPartMetadataTypeMarkdown, + } +} + +// 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, + } +} + +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, } } diff --git a/sdk/resourcemanager/portal/armportal/dashboards_client.go b/sdk/resourcemanager/portal/armportal/dashboards_client.go index 21ef6a2d0198..f6fc09c83100 100644 --- a/sdk/resourcemanager/portal/armportal/dashboards_client.go +++ b/sdk/resourcemanager/portal/armportal/dashboards_client.go @@ -28,7 +28,7 @@ type DashboardsClient struct { } // NewDashboardsClient creates a new instance of DashboardsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) +// - 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 NewDashboardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DashboardsClient, error) { @@ -47,18 +47,18 @@ func NewDashboardsClient(subscriptionID string, credential azcore.TokenCredentia // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - dashboardName - The name of the dashboard. -// - dashboard - The parameters required to create or update a dashboard. +// - resource - The parameters required to create or update a dashboard. // - options - DashboardsClientCreateOrUpdateOptions contains the optional parameters for the DashboardsClient.CreateOrUpdate // method. -func (client *DashboardsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dashboardName string, dashboard Dashboard, options *DashboardsClientCreateOrUpdateOptions) (DashboardsClientCreateOrUpdateResponse, error) { +func (client *DashboardsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dashboardName string, resource Dashboard, options *DashboardsClientCreateOrUpdateOptions) (DashboardsClientCreateOrUpdateResponse, error) { var err error const operationName = "DashboardsClient.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, dashboardName, dashboard, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dashboardName, resource, options) if err != nil { return DashboardsClientCreateOrUpdateResponse{}, err } @@ -75,7 +75,7 @@ func (client *DashboardsClient) CreateOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DashboardsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dashboardName string, dashboard Dashboard, options *DashboardsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DashboardsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dashboardName string, resource Dashboard, options *DashboardsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +97,7 @@ func (client *DashboardsClient) createOrUpdateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2020-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, dashboard); err != nil { + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -116,7 +116,7 @@ func (client *DashboardsClient) createOrUpdateHandleResponse(resp *http.Response // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - dashboardName - The name of the dashboard. // - options - DashboardsClientDeleteOptions contains the optional parameters for the DashboardsClient.Delete method. func (client *DashboardsClient) Delete(ctx context.Context, resourceGroupName string, dashboardName string, options *DashboardsClientDeleteOptions) (DashboardsClientDeleteResponse, error) { @@ -170,7 +170,7 @@ func (client *DashboardsClient) deleteCreateRequest(ctx context.Context, resourc // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - dashboardName - The name of the dashboard. // - options - DashboardsClientGetOptions contains the optional parameters for the DashboardsClient.Get method. func (client *DashboardsClient) Get(ctx context.Context, resourceGroupName string, dashboardName string, options *DashboardsClientGetOptions) (DashboardsClientGetResponse, error) { @@ -187,7 +187,7 @@ func (client *DashboardsClient) Get(ctx context.Context, resourceGroupName strin if err != nil { return DashboardsClientGetResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) return DashboardsClientGetResponse{}, err } @@ -233,7 +233,7 @@ func (client *DashboardsClient) getHandleResponse(resp *http.Response) (Dashboar // NewListByResourceGroupPager - Gets all the Dashboards within a resource group. // // Generated from API version 2020-09-01-preview -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DashboardsClientListByResourceGroupOptions contains the optional parameters for the DashboardsClient.NewListByResourceGroupPager // method. func (client *DashboardsClient) NewListByResourceGroupPager(resourceGroupName string, options *DashboardsClientListByResourceGroupOptions) *runtime.Pager[DashboardsClientListByResourceGroupResponse] { @@ -349,17 +349,17 @@ func (client *DashboardsClient) listBySubscriptionHandleResponse(resp *http.Resp // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - dashboardName - The name of the dashboard. -// - dashboard - The updatable fields of a Dashboard. +// - properties - The updatable fields of a Dashboard. // - options - DashboardsClientUpdateOptions contains the optional parameters for the DashboardsClient.Update method. -func (client *DashboardsClient) Update(ctx context.Context, resourceGroupName string, dashboardName string, dashboard PatchableDashboard, options *DashboardsClientUpdateOptions) (DashboardsClientUpdateResponse, error) { +func (client *DashboardsClient) Update(ctx context.Context, resourceGroupName string, dashboardName string, properties PatchableDashboard, options *DashboardsClientUpdateOptions) (DashboardsClientUpdateResponse, error) { var err error const operationName = "DashboardsClient.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, dashboardName, dashboard, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, dashboardName, properties, options) if err != nil { return DashboardsClientUpdateResponse{}, err } @@ -367,7 +367,7 @@ func (client *DashboardsClient) Update(ctx context.Context, resourceGroupName st if err != nil { return DashboardsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) return DashboardsClientUpdateResponse{}, err } @@ -376,7 +376,7 @@ func (client *DashboardsClient) Update(ctx context.Context, resourceGroupName st } // updateCreateRequest creates the Update request. -func (client *DashboardsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dashboardName string, dashboard PatchableDashboard, options *DashboardsClientUpdateOptions) (*policy.Request, error) { +func (client *DashboardsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dashboardName string, properties PatchableDashboard, options *DashboardsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -398,7 +398,7 @@ func (client *DashboardsClient) updateCreateRequest(ctx context.Context, resourc reqQP.Set("api-version", "2020-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, dashboard); err != nil { + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/portal/armportal/dashboards_client_example_test.go b/sdk/resourcemanager/portal/armportal/dashboards_client_example_test.go deleted file mode 100644 index bd23748ecf7f..000000000000 --- a/sdk/resourcemanager/portal/armportal/dashboards_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 armportal_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/portal/armportal" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/createOrUpdateDashboard.json -func ExampleDashboardsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDashboardsClient().CreateOrUpdate(ctx, "testRG", "testDashboard", armportal.Dashboard{ - Location: to.Ptr("eastus"), - Properties: &armportal.DashboardProperties{ - Lenses: []*armportal.DashboardLens{ - { - Order: to.Ptr[int32](1), - Parts: []*armportal.DashboardParts{ - { - Position: &armportal.DashboardPartsPosition{ - ColSpan: to.Ptr[int32](3), - RowSpan: to.Ptr[int32](4), - X: to.Ptr[int32](1), - Y: to.Ptr[int32](2), - }, - }, - { - Position: &armportal.DashboardPartsPosition{ - ColSpan: to.Ptr[int32](6), - RowSpan: to.Ptr[int32](6), - X: to.Ptr[int32](5), - Y: to.Ptr[int32](5), - }, - }}, - }, - { - Order: to.Ptr[int32](2), - Parts: []*armportal.DashboardParts{}, - }}, - Metadata: map[string]any{ - "metadata": map[string]any{ - "ColSpan": float64(2), - "RowSpan": float64(1), - "X": float64(4), - "Y": float64(3), - }, - }, - }, - Tags: map[string]*string{ - "aKey": to.Ptr("aValue"), - "anotherKey": to.Ptr("anotherValue"), - }, - }, 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.Dashboard = armportal.Dashboard{ - // Name: to.Ptr("testDashboard"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("aValue"), - // "anotherKey": to.Ptr("anotherValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/deleteDashboard.json -func ExampleDashboardsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDashboardsClient().Delete(ctx, "testRG", "testDashboard", 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/getDashboard.json -func ExampleDashboardsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDashboardsClient().Get(ctx, "testRG", "testDashboard", 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.Dashboard = armportal.Dashboard{ - // Name: to.Ptr("testDashboard"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("aValue"), - // "anotherKey": to.Ptr("anotherValue"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/updateDashboard.json -func ExampleDashboardsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDashboardsClient().Update(ctx, "testRG", "testDashboard", armportal.PatchableDashboard{ - Tags: map[string]*string{ - "aKey": to.Ptr("bValue"), - "anotherKey": to.Ptr("anotherValue2"), - }, - }, 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.Dashboard = armportal.Dashboard{ - // Name: to.Ptr("testDashboard"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("bValue"), - // "anotherKey": to.Ptr("anotherValue2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/listDashboardsByResourceGroup.json -func ExampleDashboardsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDashboardsClient().NewListByResourceGroupPager("testRG", 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.DashboardListResult = armportal.DashboardListResult{ - // Value: []*armportal.Dashboard{ - // { - // Name: to.Ptr("testDashboard"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("aValue"), - // "anotherKey": to.Ptr("anotherValue"), - // }, - // }, - // { - // Name: to.Ptr("testDashboard2"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard2"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("aValue"), - // "anotherKey": to.Ptr("anotherValue"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/listDashboardsBySubscription.json -func ExampleDashboardsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDashboardsClient().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.DashboardListResult = armportal.DashboardListResult{ - // Value: []*armportal.Dashboard{ - // { - // Name: to.Ptr("testDashboard"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("aValue"), - // "anotherKey": to.Ptr("anotherValue"), - // }, - // }, - // { - // Name: to.Ptr("testDashboard2"), - // Type: to.Ptr("Microsoft.Portal/dashboards"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRG/providers/Microsoft.Portal/dashboards/testDashboard2"), - // Location: to.Ptr("eastus"), - // Properties: &armportal.DashboardProperties{ - // Lenses: []*armportal.DashboardLens{ - // { - // Order: to.Ptr[int32](1), - // Parts: []*armportal.DashboardParts{ - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](3), - // RowSpan: to.Ptr[int32](4), - // X: to.Ptr[int32](1), - // Y: to.Ptr[int32](2), - // }, - // }, - // { - // Position: &armportal.DashboardPartsPosition{ - // ColSpan: to.Ptr[int32](6), - // RowSpan: to.Ptr[int32](6), - // X: to.Ptr[int32](5), - // Y: to.Ptr[int32](5), - // }, - // }}, - // }, - // { - // Order: to.Ptr[int32](2), - // Parts: []*armportal.DashboardParts{ - // }, - // }}, - // Metadata: map[string]any{ - // "metadata": map[string]any{ - // "ColSpan": float64(2), - // "RowSpan": float64(1), - // "X": float64(4), - // "Y": float64(3), - // }, - // }, - // }, - // Tags: map[string]*string{ - // "aKey": to.Ptr("aValue"), - // "anotherKey": to.Ptr("anotherValue"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/portal/armportal/fake/dashboards_server.go b/sdk/resourcemanager/portal/armportal/fake/dashboards_server.go index f73c6fec65db..8f573753d5ff 100644 --- a/sdk/resourcemanager/portal/armportal/fake/dashboards_server.go +++ b/sdk/resourcemanager/portal/armportal/fake/dashboards_server.go @@ -26,14 +26,14 @@ import ( type DashboardsServer struct { // CreateOrUpdate is the fake for method DashboardsClient.CreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, dashboardName string, dashboard armportal.Dashboard, options *armportal.DashboardsClientCreateOrUpdateOptions) (resp azfake.Responder[armportal.DashboardsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + CreateOrUpdate func(ctx context.Context, resourceGroupName string, dashboardName string, resource armportal.Dashboard, options *armportal.DashboardsClientCreateOrUpdateOptions) (resp azfake.Responder[armportal.DashboardsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method DashboardsClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent Delete func(ctx context.Context, resourceGroupName string, dashboardName string, options *armportal.DashboardsClientDeleteOptions) (resp azfake.Responder[armportal.DashboardsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DashboardsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusNotFound + // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, dashboardName string, options *armportal.DashboardsClientGetOptions) (resp azfake.Responder[armportal.DashboardsClientGetResponse], errResp azfake.ErrorResponder) // NewListByResourceGroupPager is the fake for method DashboardsClient.NewListByResourceGroupPager @@ -45,8 +45,8 @@ type DashboardsServer struct { NewListBySubscriptionPager func(options *armportal.DashboardsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armportal.DashboardsClientListBySubscriptionResponse]) // Update is the fake for method DashboardsClient.Update - // HTTP status codes to indicate success: http.StatusOK, http.StatusNotFound - Update func(ctx context.Context, resourceGroupName string, dashboardName string, dashboard armportal.PatchableDashboard, options *armportal.DashboardsClientUpdateOptions) (resp azfake.Responder[armportal.DashboardsClientUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, dashboardName string, properties armportal.PatchableDashboard, options *armportal.DashboardsClientUpdateOptions) (resp azfake.Responder[armportal.DashboardsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewDashboardsServerTransport creates a new instance of DashboardsServerTransport with the provided implementation. @@ -196,8 +196,8 @@ func (d *DashboardsServerTransport) dispatchGet(req *http.Request) (*http.Respon return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNotFound}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNotFound", respContent.HTTPStatus)} + 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).Dashboard, req) if err != nil { @@ -303,8 +303,8 @@ func (d *DashboardsServerTransport) dispatchUpdate(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNotFound}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNotFound", respContent.HTTPStatus)} + 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).Dashboard, req) if err != nil { diff --git a/sdk/resourcemanager/portal/armportal/fake/internal.go b/sdk/resourcemanager/portal/armportal/fake/internal.go index be04ff43d678..5f75802a569e 100644 --- a/sdk/resourcemanager/portal/armportal/fake/internal.go +++ b/sdk/resourcemanager/portal/armportal/fake/internal.go @@ -31,14 +31,6 @@ func contains[T comparable](s []T, v T) bool { return false } -func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { - t, err := parse(v) - if err != nil { - return *new(T), err - } - return t, err -} - func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/portal/armportal/fake/tenantconfigurations_server.go b/sdk/resourcemanager/portal/armportal/fake/tenantconfigurations_server.go index 9270327c8008..cec9947b9f87 100644 --- a/sdk/resourcemanager/portal/armportal/fake/tenantconfigurations_server.go +++ b/sdk/resourcemanager/portal/armportal/fake/tenantconfigurations_server.go @@ -26,15 +26,15 @@ import ( type TenantConfigurationsServer struct { // Create is the fake for method TenantConfigurationsClient.Create // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, configurationName armportal.ConfigurationName, tenantConfiguration armportal.Configuration, options *armportal.TenantConfigurationsClientCreateOptions) (resp azfake.Responder[armportal.TenantConfigurationsClientCreateResponse], errResp azfake.ErrorResponder) + Create func(ctx context.Context, configurationName string, resource armportal.Configuration, options *armportal.TenantConfigurationsClientCreateOptions) (resp azfake.Responder[armportal.TenantConfigurationsClientCreateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method TenantConfigurationsClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, configurationName armportal.ConfigurationName, options *armportal.TenantConfigurationsClientDeleteOptions) (resp azfake.Responder[armportal.TenantConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + Delete func(ctx context.Context, configurationName string, options *armportal.TenantConfigurationsClientDeleteOptions) (resp azfake.Responder[armportal.TenantConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method TenantConfigurationsClient.Get - // HTTP status codes to indicate success: http.StatusOK, http.StatusNotFound - Get func(ctx context.Context, configurationName armportal.ConfigurationName, options *armportal.TenantConfigurationsClientGetOptions) (resp azfake.Responder[armportal.TenantConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, configurationName string, options *armportal.TenantConfigurationsClientGetOptions) (resp azfake.Responder[armportal.TenantConfigurationsClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method TenantConfigurationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -103,13 +103,7 @@ func (t *TenantConfigurationsServerTransport) dispatchCreate(req *http.Request) if err != nil { return nil, err } - configurationNameParam, err := parseWithCast(matches[regex.SubexpIndex("configurationName")], func(v string) (armportal.ConfigurationName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armportal.ConfigurationName(p), nil - }) + configurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationName")]) if err != nil { return nil, err } @@ -138,13 +132,7 @@ func (t *TenantConfigurationsServerTransport) dispatchDelete(req *http.Request) if matches == nil || len(matches) < 1 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - configurationNameParam, err := parseWithCast(matches[regex.SubexpIndex("configurationName")], func(v string) (armportal.ConfigurationName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armportal.ConfigurationName(p), nil - }) + configurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationName")]) if err != nil { return nil, err } @@ -173,13 +161,7 @@ func (t *TenantConfigurationsServerTransport) dispatchGet(req *http.Request) (*h if matches == nil || len(matches) < 1 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - configurationNameParam, err := parseWithCast(matches[regex.SubexpIndex("configurationName")], func(v string) (armportal.ConfigurationName, error) { - p, unescapeErr := url.PathUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armportal.ConfigurationName(p), nil - }) + configurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationName")]) if err != nil { return nil, err } @@ -188,8 +170,8 @@ func (t *TenantConfigurationsServerTransport) dispatchGet(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNotFound}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNotFound", respContent.HTTPStatus)} + 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).Configuration, req) if err != nil { diff --git a/sdk/resourcemanager/portal/armportal/fake/time_rfc3339.go b/sdk/resourcemanager/portal/armportal/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/portal/armportal/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/portal/armportal/go.mod b/sdk/resourcemanager/portal/armportal/go.mod index d8667fd31b7b..9d147b2f9309 100644 --- a/sdk/resourcemanager/portal/armportal/go.mod +++ b/sdk/resourcemanager/portal/armportal/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/portal/armportal go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/portal/armportal/go.sum b/sdk/resourcemanager/portal/armportal/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/portal/armportal/go.sum +++ b/sdk/resourcemanager/portal/armportal/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/portal/armportal/listtenantconfigurationviolations_client_example_test.go b/sdk/resourcemanager/portal/armportal/listtenantconfigurationviolations_client_example_test.go deleted file mode 100644 index 4af884480ddb..000000000000 --- a/sdk/resourcemanager/portal/armportal/listtenantconfigurationviolations_client_example_test.go +++ /dev/null @@ -1,51 +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 armportal_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/portal/armportal" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetListOfTenantConfigurationViolations.json -func ExampleListTenantConfigurationViolationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewListTenantConfigurationViolationsClient().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.ViolationsList = armportal.ViolationsList{ - // Value: []*armportal.Violation{ - // { - // ErrorMessage: to.Ptr("Tenant is configured to allow only URI configuration for the Markdown tiles on dashboards."), - // ID: to.Ptr("private/5f4ff99a-efa9-40f9-9c04-6b5716828c0e"), - // UserID: to.Ptr(""), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/portal/armportal/models.go b/sdk/resourcemanager/portal/armportal/models.go index 924dd9550be1..013e6c22ab88 100644 --- a/sdk/resourcemanager/portal/armportal/models.go +++ b/sdk/resourcemanager/portal/armportal/models.go @@ -8,55 +8,66 @@ package armportal -// Configuration - Tenant configuration. +import "time" + +// Configuration - The tenant configuration resource definition. type Configuration struct { - // Tenant configuration properties. + // The resource-specific properties for this resource. Properties *ConfigurationProperties - // 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 } -// ConfigurationList - List of tenant configurations. -type ConfigurationList struct { - // The URL to use for getting the next set of results. - NextLink *string - - // The array of tenant configurations. +// ConfigurationListResult - The response of a Configuration list operation. +type ConfigurationListResult struct { + // REQUIRED; The Configuration items on this page Value []*Configuration + + // The link to the next page of items + NextLink *string } -// ConfigurationProperties - Tenant configuration properties. +// ConfigurationProperties - Tenant Configuration Properties with Provisioning state type ConfigurationProperties struct { // When flag is set to true Markdown tile will require external storage configuration (URI). The inline content configuration // will be prohibited. EnforcePrivateMarkdownStorage *bool + + // READ-ONLY; The status of the last operation. + ProvisioningState *ResourceProvisioningState } // Dashboard - The shared dashboard resource definition. type Dashboard struct { - // REQUIRED; Resource location + // REQUIRED; The geo-location where the resource lives Location *string - // The shared dashboard properties. - Properties *DashboardProperties + // The resource-specific properties for this resource. + Properties *DashboardPropertiesWithProvisioningState - // Resource tags + // Resource tags. Tags map[string]*string - // READ-ONLY; 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; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; 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 } @@ -69,25 +80,22 @@ type DashboardLens struct { Parts []*DashboardParts // The dashboard len's metadata. - Metadata map[string]any + Metadata any } -// DashboardListResult - List of dashboards. +// DashboardListResult - The response of a Dashboard list operation. type DashboardListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // The array of custom resource provider manifests. + // REQUIRED; The Dashboard items on this page Value []*Dashboard + + // The link to the next page of items + NextLink *string } // DashboardPartMetadata - A dashboard part metadata. type DashboardPartMetadata struct { - // REQUIRED; The type of dashboard part. - Type *string - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any + // REQUIRED; The dashboard part metadata type. + Type *DashboardPartMetadataType } // GetDashboardPartMetadata implements the DashboardPartMetadataClassification interface for type DashboardPartMetadata. @@ -117,7 +125,7 @@ type DashboardPartsPosition struct { Y *int32 // The dashboard part's metadata. - Metadata map[string]any + Metadata any } // DashboardProperties - The shared dashboard properties. @@ -126,34 +134,59 @@ type DashboardProperties struct { Lenses []*DashboardLens // The dashboard metadata. - Metadata map[string]any + Metadata any } -// ErrorDefinition - Error definition. -type ErrorDefinition struct { - // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *int32 +// DashboardPropertiesWithProvisioningState - Dashboard Properties with Provisioning state +type DashboardPropertiesWithProvisioningState struct { + // The dashboard lenses. + Lenses []*DashboardLens + + // The dashboard metadata. + Metadata any + + // READ-ONLY; The status of the last operation. + ProvisioningState *ResourceProvisioningState +} + +// 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; Internal error details. - Details []*ErrorDefinition + // READ-ONLY; The error code. + Code *string - // READ-ONLY; Description of the error. + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. Message *string + + // READ-ONLY; The error target. + Target *string } -// ErrorResponse - Error response. +// ErrorResponse - 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 ErrorResponse struct { - // The error details. - Error *ErrorDefinition + // The error object. + Error *ErrorDetail } // MarkdownPartMetadata - Markdown part metadata. type MarkdownPartMetadata struct { - // REQUIRED; The type of dashboard part. - Type *string - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any + // REQUIRED; The dashboard part metadata type. + Type *DashboardPartMetadataType // Input to dashboard part. Inputs []any @@ -165,8 +198,7 @@ type MarkdownPartMetadata struct { // GetDashboardPartMetadata implements the DashboardPartMetadataClassification interface for type MarkdownPartMetadata. func (m *MarkdownPartMetadata) GetDashboardPartMetadata() *DashboardPartMetadata { return &DashboardPartMetadata{ - AdditionalProperties: m.AdditionalProperties, - Type: m.Type, + Type: m.Type, } } @@ -200,6 +232,55 @@ type MarkdownPartMetadataSettingsContentSettings struct { Title *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 +} + // PatchableDashboard - The shared dashboard resource definition. type PatchableDashboard struct { // The shared dashboard properties. @@ -212,62 +293,75 @@ type PatchableDashboard struct { // 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. 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 } // 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} + // 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 } -// ResourceProviderOperation - Supported operations of this resource provider. -type ResourceProviderOperation struct { - // Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time - // Indicates whether the operation applies to data-plane. - IsDataAction *string + // The identity that created the resource. + CreatedBy *string - // Operation name, in format of {provider}/{resource}/{operation} - Name *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 } -// ResourceProviderOperationDisplay - Display metadata associated with the operation. -type ResourceProviderOperationDisplay struct { - // Description of this operation. - Description *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 - // Type of operation: get, read, delete, etc. - Operation *string + // Resource tags. + Tags map[string]*string - // Resource provider: Microsoft Custom Providers. - Provider *string + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // Resource on which the operation is performed. - Resource *string -} + // READ-ONLY; The name of the resource + Name *string -// ResourceProviderOperationList - Results of the request to list operations. -type ResourceProviderOperationList struct { - // The URL to use for getting the next set of results. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // List of operations supported by this resource provider. - Value []*ResourceProviderOperation + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // Violation information. @@ -284,9 +378,9 @@ type Violation struct { // ViolationsList - List of list of items that violate tenant's configuration. type ViolationsList struct { - // The URL to use for getting the next set of results. - NextLink *string - - // The array of violations. + // REQUIRED; The Violation items on this page Value []*Violation + + // The link to the next page of items + NextLink *string } diff --git a/sdk/resourcemanager/portal/armportal/models_serde.go b/sdk/resourcemanager/portal/armportal/models_serde.go index c7a0db3e1931..dbd3eabff8bf 100644 --- a/sdk/resourcemanager/portal/armportal/models_serde.go +++ b/sdk/resourcemanager/portal/armportal/models_serde.go @@ -21,6 +21,7 @@ func (c Configuration) MarshalJSON() ([]byte, error) { populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -43,6 +44,9 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -54,16 +58,16 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationList. -func (c ConfigurationList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConfigurationListResult. +func (c ConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationList. -func (c *ConfigurationList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationListResult. +func (c *ConfigurationListResult) UnmarshalJSON(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) @@ -89,6 +93,7 @@ func (c *ConfigurationList) UnmarshalJSON(data []byte) error { func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "enforcePrivateMarkdownStorage", c.EnforcePrivateMarkdownStorage) + populate(objectMap, "provisioningState", c.ProvisioningState) return json.Marshal(objectMap) } @@ -104,6 +109,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { case "enforcePrivateMarkdownStorage": err = unpopulate(val, "EnforcePrivateMarkdownStorage", &c.EnforcePrivateMarkdownStorage) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -119,6 +127,7 @@ func (d Dashboard) MarshalJSON() ([]byte, error) { 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) @@ -145,6 +154,9 @@ func (d *Dashboard) 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 "tags": err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) @@ -162,7 +174,7 @@ func (d *Dashboard) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DashboardLens. func (d DashboardLens) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "metadata", d.Metadata) + populateAny(objectMap, "metadata", d.Metadata) populate(objectMap, "order", d.Order) populate(objectMap, "parts", d.Parts) return json.Marshal(objectMap) @@ -229,11 +241,6 @@ func (d *DashboardListResult) UnmarshalJSON(data []byte) error { func (d DashboardPartMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["type"] = d.Type - if d.AdditionalProperties != nil { - for key, val := range d.AdditionalProperties { - objectMap[key] = val - } - } return json.Marshal(objectMap) } @@ -249,16 +256,6 @@ func (d *DashboardPartMetadata) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &d.Type) 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) @@ -302,7 +299,7 @@ func (d *DashboardParts) UnmarshalJSON(data []byte) error { func (d DashboardPartsPosition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "colSpan", d.ColSpan) - populate(objectMap, "metadata", d.Metadata) + populateAny(objectMap, "metadata", d.Metadata) populate(objectMap, "rowSpan", d.RowSpan) populate(objectMap, "x", d.X) populate(objectMap, "y", d.Y) @@ -345,7 +342,7 @@ func (d *DashboardPartsPosition) UnmarshalJSON(data []byte) error { func (d DashboardProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "lenses", d.Lenses) - populate(objectMap, "metadata", d.Metadata) + populateAny(objectMap, "metadata", d.Metadata) return json.Marshal(objectMap) } @@ -372,17 +369,85 @@ func (d *DashboardProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DashboardPropertiesWithProvisioningState. +func (d DashboardPropertiesWithProvisioningState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "lenses", d.Lenses) + populateAny(objectMap, "metadata", d.Metadata) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DashboardPropertiesWithProvisioningState. +func (d *DashboardPropertiesWithProvisioningState) UnmarshalJSON(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 "lenses": + err = unpopulate(val, "Lenses", &d.Lenses) + 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 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 ErrorDefinition. -func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { +// 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) @@ -390,6 +455,9 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { 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) @@ -399,6 +467,9 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { 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) @@ -439,12 +510,7 @@ func (m MarkdownPartMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "inputs", m.Inputs) populate(objectMap, "settings", m.Settings) - objectMap["type"] = "Extension/HubsExtension/PartType/MarkdownPart" - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } + objectMap["type"] = DashboardPartMetadataTypeMarkdown return json.Marshal(objectMap) } @@ -466,16 +532,6 @@ func (m *MarkdownPartMetadata) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &m.Type) 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) @@ -581,6 +637,119 @@ func (m *MarkdownPartMetadataSettingsContentSettings) UnmarshalJSON(data []byte) 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 PatchableDashboard. func (p PatchableDashboard) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -617,6 +786,7 @@ func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -636,6 +806,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "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", &p.Type) delete(rawMsg, key) @@ -652,6 +825,7 @@ func (r Resource) 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) } @@ -671,6 +845,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { 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) @@ -682,106 +859,95 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceProviderOperation. -func (r ResourceProviderOperation) 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, "display", r.Display) - populate(objectMap, "isDataAction", r.IsDataAction) - populate(objectMap, "name", r.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 ResourceProviderOperation. -func (r *ResourceProviderOperation) 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &r.Display) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &r.IsDataAction) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceProviderOperationDisplay. -func (r ResourceProviderOperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", r.Description) - populate(objectMap, "operation", r.Operation) - populate(objectMap, "provider", r.Provider) - populate(objectMap, "resource", r.Resource) + 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 ResourceProviderOperationDisplay. -func (r *ResourceProviderOperationDisplay) UnmarshalJSON(data []byte) error { +// 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &r.Description) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &r.Operation) + case "location": + err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &r.Provider) + case "name": + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &r.Resource) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) 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 ResourceProviderOperationList. -func (r ResourceProviderOperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationList. -func (r *ResourceProviderOperationList) UnmarshalJSON(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) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil @@ -863,8 +1029,18 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func 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/portal/armportal/operations_client.go b/sdk/resourcemanager/portal/armportal/operations_client.go index 4e737f126145..a6fcf3a5fd06 100644 --- a/sdk/resourcemanager/portal/armportal/operations_client.go +++ b/sdk/resourcemanager/portal/armportal/operations_client.go @@ -37,7 +37,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - The Microsoft Portal operations API. +// NewListPager - List the operations for the provider // // Generated from API version 2020-09-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. @@ -81,7 +81,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceProviderOperationList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/portal/armportal/operations_client_example_test.go b/sdk/resourcemanager/portal/armportal/operations_client_example_test.go deleted file mode 100644 index 969de5ba2a62..000000000000 --- a/sdk/resourcemanager/portal/armportal/operations_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armportal_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/portal/armportal" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/operationsList.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 := armportal.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.ResourceProviderOperationList = armportal.ResourceProviderOperationList{ - // Value: []*armportal.ResourceProviderOperation{ - // { - // Name: to.Ptr("Microsoft.Portal/dashboards/read"), - // Display: &armportal.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Reads the dashboards for the subscription."), - // Operation: to.Ptr("Get Dashboard"), - // Provider: to.Ptr("Microsoft Portal"), - // Resource: to.Ptr("Dashboards"), - // }, - // IsDataAction: to.Ptr("false"), - // }, - // { - // Name: to.Ptr("Microsoft.Portal/dashboards/write"), - // Display: &armportal.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Add or modify dashboard to a subscription."), - // Operation: to.Ptr("Set Dashboard"), - // Provider: to.Ptr("Microsoft Portal"), - // Resource: to.Ptr("Dashboards"), - // }, - // IsDataAction: to.Ptr("false"), - // }, - // { - // Name: to.Ptr("Microsoft.Portal/dashboards/delete"), - // Display: &armportal.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Removes the dashboard from the subscription."), - // Operation: to.Ptr("Delete Dashboard"), - // Provider: to.Ptr("Microsoft Portal"), - // Resource: to.Ptr("Dashboards"), - // }, - // IsDataAction: to.Ptr("false"), - // }, - // { - // Name: to.Ptr("Microsoft.Portal/register/action"), - // Display: &armportal.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Registers the subscription for the portal resource provider and enables shared dashboards."), - // Operation: to.Ptr("Registers the Portal Resource Provider"), - // Provider: to.Ptr("Microsoft Portal"), - // Resource: to.Ptr("Portal Resource Provider"), - // }, - // IsDataAction: to.Ptr("false"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/portal/armportal/polymorphic_helpers.go b/sdk/resourcemanager/portal/armportal/polymorphic_helpers.go index 7c86d38e07c8..81cdc5b1b385 100644 --- a/sdk/resourcemanager/portal/armportal/polymorphic_helpers.go +++ b/sdk/resourcemanager/portal/armportal/polymorphic_helpers.go @@ -11,7 +11,7 @@ package armportal import "encoding/json" func unmarshalDashboardPartMetadataClassification(rawMsg json.RawMessage) (DashboardPartMetadataClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -20,7 +20,7 @@ func unmarshalDashboardPartMetadataClassification(rawMsg json.RawMessage) (Dashb } var b DashboardPartMetadataClassification switch m["type"] { - case "Extension/HubsExtension/PartType/MarkdownPart": + case string(DashboardPartMetadataTypeMarkdown): b = &MarkdownPartMetadata{} default: b = &DashboardPartMetadata{} diff --git a/sdk/resourcemanager/portal/armportal/response_types.go b/sdk/resourcemanager/portal/armportal/responses.go similarity index 86% rename from sdk/resourcemanager/portal/armportal/response_types.go rename to sdk/resourcemanager/portal/armportal/responses.go index b4ed5284a392..6bb45790b426 100644 --- a/sdk/resourcemanager/portal/armportal/response_types.go +++ b/sdk/resourcemanager/portal/armportal/responses.go @@ -27,13 +27,13 @@ type DashboardsClientGetResponse struct { // DashboardsClientListByResourceGroupResponse contains the response from method DashboardsClient.NewListByResourceGroupPager. type DashboardsClientListByResourceGroupResponse struct { - // List of dashboards. + // The response of a Dashboard list operation. DashboardListResult } // DashboardsClientListBySubscriptionResponse contains the response from method DashboardsClient.NewListBySubscriptionPager. type DashboardsClientListBySubscriptionResponse struct { - // List of dashboards. + // The response of a Dashboard list operation. DashboardListResult } @@ -51,13 +51,13 @@ type ListTenantConfigurationViolationsClientListResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // Results of the request to list operations. - ResourceProviderOperationList + // 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 } // TenantConfigurationsClientCreateResponse contains the response from method TenantConfigurationsClient.Create. type TenantConfigurationsClientCreateResponse struct { - // Tenant configuration. + // The tenant configuration resource definition. Configuration } @@ -68,12 +68,12 @@ type TenantConfigurationsClientDeleteResponse struct { // TenantConfigurationsClientGetResponse contains the response from method TenantConfigurationsClient.Get. type TenantConfigurationsClientGetResponse struct { - // Tenant configuration. + // The tenant configuration resource definition. Configuration } // TenantConfigurationsClientListResponse contains the response from method TenantConfigurationsClient.NewListPager. type TenantConfigurationsClientListResponse struct { - // List of tenant configurations. - ConfigurationList + // The response of a Configuration list operation. + ConfigurationListResult } diff --git a/sdk/resourcemanager/portal/armportal/tenantconfigurations_client.go b/sdk/resourcemanager/portal/armportal/tenantconfigurations_client.go index eb22e2264399..db11bbfc3dd7 100644 --- a/sdk/resourcemanager/portal/armportal/tenantconfigurations_client.go +++ b/sdk/resourcemanager/portal/armportal/tenantconfigurations_client.go @@ -45,17 +45,17 @@ func NewTenantConfigurationsClient(credential azcore.TokenCredential, options *a // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - configurationName - The configuration name. Value must be 'default' -// - tenantConfiguration - The parameters required to create or update tenant configuration. +// - configurationName - The name of the Configuration +// - resource - The parameters required to create or update tenant configuration. // - options - TenantConfigurationsClientCreateOptions contains the optional parameters for the TenantConfigurationsClient.Create // method. -func (client *TenantConfigurationsClient) Create(ctx context.Context, configurationName ConfigurationName, tenantConfiguration Configuration, options *TenantConfigurationsClientCreateOptions) (TenantConfigurationsClientCreateResponse, error) { +func (client *TenantConfigurationsClient) Create(ctx context.Context, configurationName string, resource Configuration, options *TenantConfigurationsClientCreateOptions) (TenantConfigurationsClientCreateResponse, error) { var err error const operationName = "TenantConfigurationsClient.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, configurationName, tenantConfiguration, options) + req, err := client.createCreateRequest(ctx, configurationName, resource, options) if err != nil { return TenantConfigurationsClientCreateResponse{}, err } @@ -72,12 +72,12 @@ func (client *TenantConfigurationsClient) Create(ctx context.Context, configurat } // createCreateRequest creates the Create request. -func (client *TenantConfigurationsClient) createCreateRequest(ctx context.Context, configurationName ConfigurationName, tenantConfiguration Configuration, options *TenantConfigurationsClientCreateOptions) (*policy.Request, error) { +func (client *TenantConfigurationsClient) createCreateRequest(ctx context.Context, configurationName string, resource Configuration, options *TenantConfigurationsClientCreateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Portal/tenantConfigurations/{configurationName}" if configurationName == "" { return nil, errors.New("parameter configurationName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(string(configurationName))) + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -86,7 +86,7 @@ func (client *TenantConfigurationsClient) createCreateRequest(ctx context.Contex reqQP.Set("api-version", "2020-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, tenantConfiguration); err != nil { + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -105,10 +105,10 @@ func (client *TenantConfigurationsClient) createHandleResponse(resp *http.Respon // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - configurationName - The configuration name. Value must be 'default' +// - configurationName - The name of the Configuration // - options - TenantConfigurationsClientDeleteOptions contains the optional parameters for the TenantConfigurationsClient.Delete // method. -func (client *TenantConfigurationsClient) Delete(ctx context.Context, configurationName ConfigurationName, options *TenantConfigurationsClientDeleteOptions) (TenantConfigurationsClientDeleteResponse, error) { +func (client *TenantConfigurationsClient) Delete(ctx context.Context, configurationName string, options *TenantConfigurationsClientDeleteOptions) (TenantConfigurationsClientDeleteResponse, error) { var err error const operationName = "TenantConfigurationsClient.Delete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -130,12 +130,12 @@ func (client *TenantConfigurationsClient) Delete(ctx context.Context, configurat } // deleteCreateRequest creates the Delete request. -func (client *TenantConfigurationsClient) deleteCreateRequest(ctx context.Context, configurationName ConfigurationName, options *TenantConfigurationsClientDeleteOptions) (*policy.Request, error) { +func (client *TenantConfigurationsClient) deleteCreateRequest(ctx context.Context, configurationName string, options *TenantConfigurationsClientDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Portal/tenantConfigurations/{configurationName}" if configurationName == "" { return nil, errors.New("parameter configurationName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(string(configurationName))) + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -151,10 +151,10 @@ func (client *TenantConfigurationsClient) deleteCreateRequest(ctx context.Contex // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-09-01-preview -// - configurationName - The configuration name. Value must be 'default' +// - configurationName - The name of the Configuration // - options - TenantConfigurationsClientGetOptions contains the optional parameters for the TenantConfigurationsClient.Get // method. -func (client *TenantConfigurationsClient) Get(ctx context.Context, configurationName ConfigurationName, options *TenantConfigurationsClientGetOptions) (TenantConfigurationsClientGetResponse, error) { +func (client *TenantConfigurationsClient) Get(ctx context.Context, configurationName string, options *TenantConfigurationsClientGetOptions) (TenantConfigurationsClientGetResponse, error) { var err error const operationName = "TenantConfigurationsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -168,7 +168,7 @@ func (client *TenantConfigurationsClient) Get(ctx context.Context, configuration if err != nil { return TenantConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) return TenantConfigurationsClientGetResponse{}, err } @@ -177,12 +177,12 @@ func (client *TenantConfigurationsClient) Get(ctx context.Context, configuration } // getCreateRequest creates the Get request. -func (client *TenantConfigurationsClient) getCreateRequest(ctx context.Context, configurationName ConfigurationName, options *TenantConfigurationsClientGetOptions) (*policy.Request, error) { +func (client *TenantConfigurationsClient) getCreateRequest(ctx context.Context, configurationName string, options *TenantConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Portal/tenantConfigurations/{configurationName}" if configurationName == "" { return nil, errors.New("parameter configurationName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(string(configurationName))) + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -248,7 +248,7 @@ func (client *TenantConfigurationsClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *TenantConfigurationsClient) listHandleResponse(resp *http.Response) (TenantConfigurationsClientListResponse, error) { result := TenantConfigurationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil { return TenantConfigurationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/portal/armportal/tenantconfigurations_client_example_test.go b/sdk/resourcemanager/portal/armportal/tenantconfigurations_client_example_test.go deleted file mode 100644 index 6084b546be5c..000000000000 --- a/sdk/resourcemanager/portal/armportal/tenantconfigurations_client_example_test.go +++ /dev/null @@ -1,132 +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 armportal_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/portal/armportal" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetListOfTenantConfigurations.json -func ExampleTenantConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantConfigurationsClient().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.ConfigurationList = armportal.ConfigurationList{ - // Value: []*armportal.Configuration{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Portal/tenantConfiguration"), - // ID: to.Ptr("/providers/Microsoft.Portal/tenantConfigurations"), - // Properties: &armportal.ConfigurationProperties{ - // EnforcePrivateMarkdownStorage: to.Ptr(true), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetTenantConfiguration.json -func ExampleTenantConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantConfigurationsClient().Get(ctx, armportal.ConfigurationNameDefault, 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.Configuration = armportal.Configuration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Portal/tenantConfiguration"), - // ID: to.Ptr("/providers/Microsoft.Portal/tenantConfigurations/default"), - // Properties: &armportal.ConfigurationProperties{ - // EnforcePrivateMarkdownStorage: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/CreateOrUpdateTenantConfiguration.json -func ExampleTenantConfigurationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantConfigurationsClient().Create(ctx, armportal.ConfigurationNameDefault, armportal.Configuration{ - Properties: &armportal.ConfigurationProperties{ - EnforcePrivateMarkdownStorage: 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.Configuration = armportal.Configuration{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Portal/tenantConfiguration"), - // ID: to.Ptr("/providers/Microsoft.Portal/tenantConfigurations/default"), - // Properties: &armportal.ConfigurationProperties{ - // EnforcePrivateMarkdownStorage: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/DeleteTenantConfiguration.json -func ExampleTenantConfigurationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armportal.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantConfigurationsClient().Delete(ctx, armportal.ConfigurationNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/portal/armportal/time_rfc3339.go b/sdk/resourcemanager/portal/armportal/time_rfc3339.go new file mode 100644 index 000000000000..d11defe98f54 --- /dev/null +++ b/sdk/resourcemanager/portal/armportal/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armportal + +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/CHANGELOG.md b/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md index 4b4702a05b07..0eb77b1a9a1d 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md +++ b/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.1.0 (2024-08-09) +### Features Added + +- New field `PrivateLinkScopeResourceID` in struct `GuestAgentProperties` +- New field `DomainName`, `DomainPassword`, `DomainUsername`, `ProductKey`, `RunOnceCommands`, `Timezone`, `Workgroup` in struct `OsProfileForVMInstance` + + ## 1.0.0 (2024-06-28) ### Breaking Changes diff --git a/sdk/resourcemanager/scvmm/armscvmm/autorest.md b/sdk/resourcemanager/scvmm/armscvmm/autorest.md index be912d6e1c0c..1304d7b50d8a 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: 1.1.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..b593e3a91dcd 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client.go @@ -46,7 +46,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - availabilitySetResourceName - Name of the AvailabilitySet. // - resource - Resource create parameters. @@ -73,7 +73,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 2024-06-01 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" @@ -115,7 +115,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,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 2024-06-01 // - 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 +153,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 2024-06-01 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 +195,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", "2024-06-01") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -207,7 +207,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 2024-06-01 // - 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. @@ -253,7 +253,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +270,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AvailabilitySetsClientListByResourceGroupOptions contains the optional parameters for the AvailabilitySetsClient.NewListByResourceGroupPager // method. @@ -313,7 +313,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,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 2024-06-01 // - options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager // method. func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *AvailabilitySetsClientListBySubscriptionOptions) *runtime.Pager[AvailabilitySetsClientListBySubscriptionResponse] { @@ -368,7 +368,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,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 2024-06-01 // - 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 +413,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 2024-06-01 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" @@ -455,7 +455,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", "2024-06-01") 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/clouds_client.go b/sdk/resourcemanager/scvmm/armscvmm/clouds_client.go index defd671ed809..5f2de325e9bd 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/clouds_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/clouds_client.go @@ -46,7 +46,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudResourceName - Name of the Cloud. // - resource - Resource create parameters. @@ -73,7 +73,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 2024-06-01 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" @@ -115,7 +115,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,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 2024-06-01 // - 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 +152,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 2024-06-01 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 +194,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", "2024-06-01") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -206,7 +206,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 2024-06-01 // - 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. @@ -252,7 +252,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudsClientListByResourceGroupOptions contains the optional parameters for the CloudsClient.NewListByResourceGroupPager // method. @@ -312,7 +312,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +329,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 2024-06-01 // - options - CloudsClientListBySubscriptionOptions contains the optional parameters for the CloudsClient.NewListBySubscriptionPager // method. func (client *CloudsClient) NewListBySubscriptionPager(options *CloudsClientListBySubscriptionOptions) *runtime.Pager[CloudsClientListBySubscriptionResponse] { @@ -367,7 +367,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,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 2024-06-01 // - 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 +411,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 2024-06-01 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" @@ -453,7 +453,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", "2024-06-01") 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..941176f967e1 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/constants.go +++ b/sdk/resourcemanager/scvmm/armscvmm/constants.go @@ -10,7 +10,7 @@ package armscvmm const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm" - 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/scvmm/armscvmm/go.mod b/sdk/resourcemanager/scvmm/armscvmm/go.mod index bd204cd34872..ad56824aeda2 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/go.mod +++ b/sdk/resourcemanager/scvmm/armscvmm/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/scvmm/armscvmm/go.sum b/sdk/resourcemanager/scvmm/armscvmm/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/go.sum +++ b/sdk/resourcemanager/scvmm/armscvmm/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= 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..a19e5074b1bf 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/guestagents_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/guestagents_client.go @@ -41,7 +41,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 2024-06-01 // - 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 +66,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 2024-06-01 func (client *GuestAgentsClient) create(ctx context.Context, resourceURI string, resource GuestAgent, options *GuestAgentsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "GuestAgentsClient.BeginCreate" @@ -97,7 +97,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -109,7 +109,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 2024-06-01 // - 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) { @@ -142,7 +142,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -151,7 +151,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 2024-06-01 // - 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) { @@ -185,7 +185,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - GuestAgentsClientListByVirtualMachineInstanceOptions contains the optional parameters for the GuestAgentsClient.NewListByVirtualMachineInstancePager // method. @@ -238,7 +238,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", "2024-06-01") 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/inventoryitems_client.go b/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client.go index 33d02089cc34..c90100c46477 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client.go @@ -46,7 +46,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - inventoryItemResourceName - Name of the inventoryItem. @@ -98,7 +98,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -119,7 +119,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - inventoryItemResourceName - Name of the inventoryItem. @@ -169,7 +169,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +178,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - inventoryItemResourceName - Name of the inventoryItem. @@ -229,7 +229,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +246,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 2024-06-01 // - 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 @@ -294,7 +294,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", "2024-06-01") 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..56712fc917c8 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/models.go +++ b/sdk/resourcemanager/scvmm/armscvmm/models.go @@ -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 @@ -549,6 +552,27 @@ type OsProfileForVMInstance struct { // 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 diff --git a/sdk/resourcemanager/scvmm/armscvmm/models_serde.go b/sdk/resourcemanager/scvmm/armscvmm/models_serde.go index a0c75adc8c61..257a76cefd1f 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/models_serde.go +++ b/sdk/resourcemanager/scvmm/armscvmm/models_serde.go @@ -586,6 +586,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 +612,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) @@ -1323,9 +1327,16 @@ func (o OsProfileForVMInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adminPassword", o.AdminPassword) 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) } @@ -1344,6 +1355,15 @@ func (o *OsProfileForVMInstance) UnmarshalJSON(data []byte) error { 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 +1373,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) diff --git a/sdk/resourcemanager/scvmm/armscvmm/operations_client.go b/sdk/resourcemanager/scvmm/armscvmm/operations_client.go index 859c2036320a..71a20790552f 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/operations_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/operations_client.go @@ -39,7 +39,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 2024-06-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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2024-06-01") 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/virtualmachineinstances_client.go b/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client.go index baed77d9ab5c..0ad33f957eca 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client.go @@ -41,7 +41,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 2024-06-01 // - 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 +67,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 2024-06-01 func (client *VirtualMachineInstancesClient) createCheckpoint(ctx context.Context, resourceURI string, body VirtualMachineCreateCheckpoint, options *VirtualMachineInstancesClientBeginCreateCheckpointOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginCreateCheckpoint" @@ -98,7 +98,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -111,7 +111,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 2024-06-01 // - 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 +138,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 2024-06-01 func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, resourceURI string, resource VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginCreateOrUpdate" @@ -169,7 +169,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -181,7 +181,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDelete // method. @@ -206,7 +206,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 2024-06-01 func (client *VirtualMachineInstancesClient) deleteOperation(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginDelete" @@ -237,7 +237,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", "2024-06-01") if options != nil && options.DeleteFromHost != nil { reqQP.Set("deleteFromHost", string(*options.DeleteFromHost)) } @@ -252,7 +252,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 2024-06-01 // - 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 +278,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 2024-06-01 func (client *VirtualMachineInstancesClient) deleteCheckpoint(ctx context.Context, resourceURI string, body VirtualMachineDeleteCheckpoint, options *VirtualMachineInstancesClientBeginDeleteCheckpointOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginDeleteCheckpoint" @@ -309,7 +309,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -321,7 +321,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientGetOptions contains the optional parameters for the VirtualMachineInstancesClient.Get // method. @@ -356,7 +356,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,7 +373,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientListOptions contains the optional parameters for the VirtualMachineInstancesClient.NewListPager // method. @@ -409,7 +409,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -427,7 +427,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart // method. @@ -452,7 +452,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 2024-06-01 func (client *VirtualMachineInstancesClient) restart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginRestart" @@ -483,7 +483,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -492,7 +492,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 2024-06-01 // - 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 +518,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 2024-06-01 func (client *VirtualMachineInstancesClient) restoreCheckpoint(ctx context.Context, resourceURI string, body VirtualMachineRestoreCheckpoint, options *VirtualMachineInstancesClientBeginRestoreCheckpointOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginRestoreCheckpoint" @@ -549,7 +549,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -561,7 +561,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart // method. @@ -586,7 +586,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 2024-06-01 func (client *VirtualMachineInstancesClient) start(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStart" @@ -617,7 +617,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -626,7 +626,7 @@ 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 2024-06-01 // - 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 @@ -652,7 +652,7 @@ 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 +// Generated from API version 2024-06-01 func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceURI string, body StopVirtualMachineOptions, options *VirtualMachineInstancesClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStop" @@ -683,7 +683,7 @@ 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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -695,7 +695,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 2024-06-01 // - 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 +721,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 2024-06-01 func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourceURI string, properties VirtualMachineInstanceUpdate, options *VirtualMachineInstancesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginUpdate" @@ -752,7 +752,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", "2024-06-01") 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..30b8ef90956b 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client.go @@ -46,7 +46,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualMachineTemplateName - Name of the VirtualMachineTemplate. // - resource - Resource create parameters. @@ -73,7 +73,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 2024-06-01 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" @@ -115,7 +115,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,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 2024-06-01 // - 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 +153,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 2024-06-01 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 +195,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", "2024-06-01") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -207,7 +207,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 2024-06-01 // - 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 @@ -254,7 +254,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +271,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualMachineTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListByResourceGroupPager // method. @@ -314,7 +314,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +331,7 @@ func (client *VirtualMachineTemplatesClient) listByResourceGroupHandleResponse(r // NewListBySubscriptionPager - List of VirtualMachineTemplates in a subscription. // -// Generated from API version 2023-10-07 +// Generated from API version 2024-06-01 // - options - VirtualMachineTemplatesClientListBySubscriptionOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListBySubscriptionPager // method. func (client *VirtualMachineTemplatesClient) NewListBySubscriptionPager(options *VirtualMachineTemplatesClientListBySubscriptionOptions) *runtime.Pager[VirtualMachineTemplatesClientListBySubscriptionResponse] { @@ -369,7 +369,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,7 +387,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 2024-06-01 // - 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 +414,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 2024-06-01 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" @@ -456,7 +456,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", "2024-06-01") 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..fd4acca640f4 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client.go @@ -46,7 +46,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualNetworkName - Name of the VirtualNetwork. // - resource - Resource create parameters. @@ -73,7 +73,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 2024-06-01 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" @@ -115,7 +115,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,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 2024-06-01 // - 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 +153,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 2024-06-01 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 +195,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", "2024-06-01") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -207,7 +207,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 2024-06-01 // - 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. @@ -253,7 +253,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +270,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager // method. @@ -313,7 +313,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,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 2024-06-01 // - options - VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager // method. func (client *VirtualNetworksClient) NewListBySubscriptionPager(options *VirtualNetworksClientListBySubscriptionOptions) *runtime.Pager[VirtualNetworksClientListBySubscriptionResponse] { @@ -368,7 +368,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,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 2024-06-01 // - 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 +413,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 2024-06-01 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" @@ -455,7 +455,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", "2024-06-01") 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..5b63a4eb8026 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client.go @@ -41,7 +41,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VMInstanceHybridIdentityMetadatasClientGetOptions contains the optional parameters for the VMInstanceHybridIdentityMetadatasClient.Get // method. @@ -76,7 +76,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -93,7 +93,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 2024-06-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VMInstanceHybridIdentityMetadatasClientListByVirtualMachineInstanceOptions contains the optional parameters for // the VMInstanceHybridIdentityMetadatasClient.NewListByVirtualMachineInstancePager method. @@ -129,7 +129,7 @@ func (client *VMInstanceHybridIdentityMetadatasClient) listByVirtualMachineInsta return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2024-06-01") 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..0fe0192fadfe 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client.go @@ -46,7 +46,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - resource - Resource create parameters. @@ -73,7 +73,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 2024-06-01 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" @@ -115,7 +115,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,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 2024-06-01 // - 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 +152,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 2024-06-01 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 +194,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", "2024-06-01") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -206,7 +206,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 2024-06-01 // - 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. @@ -252,7 +252,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,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 2024-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VmmServersClientListByResourceGroupOptions contains the optional parameters for the VmmServersClient.NewListByResourceGroupPager // method. @@ -312,7 +312,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +329,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 2024-06-01 // - options - VmmServersClientListBySubscriptionOptions contains the optional parameters for the VmmServersClient.NewListBySubscriptionPager // method. func (client *VmmServersClient) NewListBySubscriptionPager(options *VmmServersClientListBySubscriptionOptions) *runtime.Pager[VmmServersClientListBySubscriptionResponse] { @@ -367,7 +367,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", "2024-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,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 2024-06-01 // - 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 +411,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 2024-06-01 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" @@ -453,7 +453,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", "2024-06-01") 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/servicenetworking/armservicenetworking/CHANGELOG.md b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md index 936481ac695d..e06f14f4042e 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md @@ -1,5 +1,32 @@ # Release History +## 1.1.0-beta.1 (2024-08-09) +### Features Added + +- New enum type `PolicyType` with values `PolicyTypeWAF` +- New function `*ClientFactory.NewSecurityPoliciesInterfaceClient() *SecurityPoliciesInterfaceClient` +- New function `NewSecurityPoliciesInterfaceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SecurityPoliciesInterfaceClient, error)` +- New function `*SecurityPoliciesInterfaceClient.BeginCreateOrUpdate(context.Context, string, string, string, SecurityPolicy, *SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecurityPoliciesInterfaceClientCreateOrUpdateResponse], error)` +- New function `*SecurityPoliciesInterfaceClient.BeginDelete(context.Context, string, string, string, *SecurityPoliciesInterfaceClientBeginDeleteOptions) (*runtime.Poller[SecurityPoliciesInterfaceClientDeleteResponse], error)` +- New function `*SecurityPoliciesInterfaceClient.Get(context.Context, string, string, string, *SecurityPoliciesInterfaceClientGetOptions) (SecurityPoliciesInterfaceClientGetResponse, error)` +- New function `*SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager(string, string, *SecurityPoliciesInterfaceClientListByTrafficControllerOptions) *runtime.Pager[SecurityPoliciesInterfaceClientListByTrafficControllerResponse]` +- New function `*SecurityPoliciesInterfaceClient.Update(context.Context, string, string, string, SecurityPolicyUpdate, *SecurityPoliciesInterfaceClientUpdateOptions) (SecurityPoliciesInterfaceClientUpdateResponse, error)` +- New struct `SecurityPolicy` +- New struct `SecurityPolicyConfigurations` +- New struct `SecurityPolicyConfigurationsUpdate` +- New struct `SecurityPolicyListResult` +- New struct `SecurityPolicyProperties` +- New struct `SecurityPolicyUpdate` +- New struct `SecurityPolicyUpdateProperties` +- New struct `TrafficControllerUpdateProperties` +- New struct `WafPolicy` +- New struct `WafPolicyUpdate` +- New struct `WafSecurityPolicy` +- New struct `WafSecurityPolicyUpdate` +- New field `SecurityPolicies`, `SecurityPolicyConfigurations` in struct `TrafficControllerProperties` +- New field `Properties` in struct `TrafficControllerUpdate` + + ## 1.0.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go index 98868c7284e5..40fdc2d44dd2 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client.go @@ -46,7 +46,7 @@ func NewAssociationsInterfaceClient(subscriptionID string, credential azcore.Tok // BeginCreateOrUpdate - Create a Association // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - associationName - Name of Association @@ -74,7 +74,7 @@ func (client *AssociationsInterfaceClient) BeginCreateOrUpdate(ctx context.Conte // CreateOrUpdate - Create a Association // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview func (client *AssociationsInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, resource Association, options *AssociationsInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AssociationsInterfaceClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *AssociationsInterfaceClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -132,7 +132,7 @@ func (client *AssociationsInterfaceClient) createOrUpdateCreateRequest(ctx conte // BeginDelete - Delete a Association // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - associationName - Name of Association @@ -159,7 +159,7 @@ func (client *AssociationsInterfaceClient) BeginDelete(ctx context.Context, reso // Delete - Delete a Association // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview func (client *AssociationsInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, options *AssociationsInterfaceClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AssociationsInterfaceClient.BeginDelete" @@ -174,7 +174,7 @@ func (client *AssociationsInterfaceClient) deleteOperation(ctx context.Context, 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 } @@ -205,7 +205,7 @@ func (client *AssociationsInterfaceClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *AssociationsInterfaceClient) deleteCreateRequest(ctx context.Conte // Get - Get a Association // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - associationName - Name of Association @@ -266,7 +266,7 @@ func (client *AssociationsInterfaceClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *AssociationsInterfaceClient) getHandleResponse(resp *http.Response // NewListByTrafficControllerPager - List Association resources by TrafficController // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - options - AssociationsInterfaceClientListByTrafficControllerOptions contains the optional parameters for the AssociationsInterfaceClient.NewListByTrafficControllerPager @@ -331,7 +331,7 @@ func (client *AssociationsInterfaceClient) listByTrafficControllerCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *AssociationsInterfaceClient) listByTrafficControllerHandleResponse // Update - Update a Association // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - associationName - Name of Association @@ -402,7 +402,7 @@ func (client *AssociationsInterfaceClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") 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/servicenetworking/armservicenetworking/associationsinterface_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client_example_test.go deleted file mode 100644 index 2cba5d9ea1ef..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/associationsinterface_client_example_test.go +++ /dev/null @@ -1,198 +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 armservicenetworking_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/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationsGet.json -func ExampleAssociationsInterfaceClient_NewListByTrafficControllerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssociationsInterfaceClient().NewListByTrafficControllerPager("rg1", "tc1", 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.AssociationListResult = armservicenetworking.AssociationListResult{ - // Value: []*armservicenetworking.Association{ - // { - // Name: to.Ptr("as1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationGet.json -func ExampleAssociationsInterfaceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssociationsInterfaceClient().Get(ctx, "rg1", "tc1", "as1", 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.Association = armservicenetworking.Association{ - // Name: to.Ptr("as1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationPut.json -func ExampleAssociationsInterfaceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssociationsInterfaceClient().BeginCreateOrUpdate(ctx, "rg1", "tc1", "as1", armservicenetworking.Association{ - Location: to.Ptr("NorthCentralUS"), - Properties: &armservicenetworking.AssociationProperties{ - AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - Subnet: &armservicenetworking.AssociationSubnet{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - }, - }, - }, 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.Association = armservicenetworking.Association{ - // Name: to.Ptr("associatedvnet-1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationPatch.json -func ExampleAssociationsInterfaceClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssociationsInterfaceClient().Update(ctx, "rg1", "tc1", "as1", armservicenetworking.AssociationUpdate{ - Properties: &armservicenetworking.AssociationUpdateProperties{ - AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - Subnet: &armservicenetworking.AssociationSubnetUpdate{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - }, - }, - }, 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.Association = armservicenetworking.Association{ - // Name: to.Ptr("as1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/associations"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.AssociationProperties{ - // AssociationType: to.Ptr(armservicenetworking.AssociationTypeSubnets), - // Subnet: &armservicenetworking.AssociationSubnet{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationDelete.json -func ExampleAssociationsInterfaceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssociationsInterfaceClient().BeginDelete(ctx, "rg1", "tc1", "as1", 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/servicenetworking/armservicenetworking/autorest.md b/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md index a42c041d31f9..1d90593fc787 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicenetworking/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicenetworking/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2023-11-01 +module-version: 1.1.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go index e3e94fcfa2f2..b3ec6ff8b8ba 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/client_factory.go @@ -17,8 +17,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,36 +26,51 @@ 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 } // NewAssociationsInterfaceClient creates a new instance of AssociationsInterfaceClient. func (c *ClientFactory) NewAssociationsInterfaceClient() *AssociationsInterfaceClient { - subClient, _ := NewAssociationsInterfaceClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AssociationsInterfaceClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewFrontendsInterfaceClient creates a new instance of FrontendsInterfaceClient. func (c *ClientFactory) NewFrontendsInterfaceClient() *FrontendsInterfaceClient { - subClient, _ := NewFrontendsInterfaceClient(c.subscriptionID, c.credential, c.options) - return subClient + return &FrontendsInterfaceClient{ + 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, + } +} + +// NewSecurityPoliciesInterfaceClient creates a new instance of SecurityPoliciesInterfaceClient. +func (c *ClientFactory) NewSecurityPoliciesInterfaceClient() *SecurityPoliciesInterfaceClient { + return &SecurityPoliciesInterfaceClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewTrafficControllerInterfaceClient creates a new instance of TrafficControllerInterfaceClient. func (c *ClientFactory) NewTrafficControllerInterfaceClient() *TrafficControllerInterfaceClient { - subClient, _ := NewTrafficControllerInterfaceClient(c.subscriptionID, c.credential, c.options) - return subClient + return &TrafficControllerInterfaceClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go index 4a6d266648f2..3ea9e0d96078 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go @@ -10,7 +10,7 @@ package armservicenetworking const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0-beta.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,9 +27,11 @@ func PossibleActionTypeValues() []ActionType { } } +// AssociationType - Association Type Enum type AssociationType string const ( + // AssociationTypeSubnets - Association of Type Subnet AssociationTypeSubnets AssociationType = "subnets" ) @@ -79,16 +81,39 @@ func PossibleOriginValues() []Origin { } } +// PolicyType - Policy Type of the Security Policy +type PolicyType string + +const ( + // PolicyTypeWAF - Policy of Type WAF + PolicyTypeWAF PolicyType = "waf" +) + +// PossiblePolicyTypeValues returns the possible values for the PolicyType const type. +func PossiblePolicyTypeValues() []PolicyType { + return []PolicyType{ + PolicyTypeWAF, + } +} + +// ProvisioningState - Resource Provisioning State Enum type ProvisioningState string const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateAccepted - Resource in Accepted State + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource in Canceled State + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource in Deleting State + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource in Failed State + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Resource in Provisioning State ProvisioningStateProvisioning ProvisioningState = "Provisioning" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateSucceeded - Resource in Succeeded State + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Resource in Updating State + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go index 762cd7853950..7e9364abd690 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go @@ -29,7 +29,7 @@ type AssociationsInterfaceServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, resource armservicenetworking.Association, options *armservicenetworking.AssociationsInterfaceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armservicenetworking.AssociationsInterfaceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AssociationsInterfaceClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, trafficControllerName string, associationName string, options *armservicenetworking.AssociationsInterfaceClientBeginDeleteOptions) (resp azfake.PollerResponder[armservicenetworking.AssociationsInterfaceClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AssociationsInterfaceClient.Get @@ -188,9 +188,9 @@ func (a *AssociationsInterfaceServerTransport) dispatchBeginDelete(req *http.Req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{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)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go index 628e4af7a79f..74480f8fa6e5 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go @@ -29,7 +29,7 @@ type FrontendsInterfaceServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, resource armservicenetworking.Frontend, options *armservicenetworking.FrontendsInterfaceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armservicenetworking.FrontendsInterfaceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FrontendsInterfaceClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, options *armservicenetworking.FrontendsInterfaceClientBeginDeleteOptions) (resp azfake.PollerResponder[armservicenetworking.FrontendsInterfaceClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FrontendsInterfaceClient.Get @@ -188,9 +188,9 @@ func (f *FrontendsInterfaceServerTransport) dispatchBeginDelete(req *http.Reques return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{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)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go new file mode 100644 index 000000000000..71b054235b84 --- /dev/null +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go @@ -0,0 +1,319 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/servicenetworking/armservicenetworking" + "net/http" + "net/url" + "regexp" +) + +// SecurityPoliciesInterfaceServer is a fake server for instances of the armservicenetworking.SecurityPoliciesInterfaceClient type. +type SecurityPoliciesInterfaceServer struct { + // BeginCreateOrUpdate is the fake for method SecurityPoliciesInterfaceClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, resource armservicenetworking.SecurityPolicy, options *armservicenetworking.SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armservicenetworking.SecurityPoliciesInterfaceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SecurityPoliciesInterfaceClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *armservicenetworking.SecurityPoliciesInterfaceClientBeginDeleteOptions) (resp azfake.PollerResponder[armservicenetworking.SecurityPoliciesInterfaceClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SecurityPoliciesInterfaceClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *armservicenetworking.SecurityPoliciesInterfaceClientGetOptions) (resp azfake.Responder[armservicenetworking.SecurityPoliciesInterfaceClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByTrafficControllerPager is the fake for method SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager + // HTTP status codes to indicate success: http.StatusOK + NewListByTrafficControllerPager func(resourceGroupName string, trafficControllerName string, options *armservicenetworking.SecurityPoliciesInterfaceClientListByTrafficControllerOptions) (resp azfake.PagerResponder[armservicenetworking.SecurityPoliciesInterfaceClientListByTrafficControllerResponse]) + + // Update is the fake for method SecurityPoliciesInterfaceClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, properties armservicenetworking.SecurityPolicyUpdate, options *armservicenetworking.SecurityPoliciesInterfaceClientUpdateOptions) (resp azfake.Responder[armservicenetworking.SecurityPoliciesInterfaceClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSecurityPoliciesInterfaceServerTransport creates a new instance of SecurityPoliciesInterfaceServerTransport with the provided implementation. +// The returned SecurityPoliciesInterfaceServerTransport instance is connected to an instance of armservicenetworking.SecurityPoliciesInterfaceClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSecurityPoliciesInterfaceServerTransport(srv *SecurityPoliciesInterfaceServer) *SecurityPoliciesInterfaceServerTransport { + return &SecurityPoliciesInterfaceServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armservicenetworking.SecurityPoliciesInterfaceClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armservicenetworking.SecurityPoliciesInterfaceClientDeleteResponse]](), + newListByTrafficControllerPager: newTracker[azfake.PagerResponder[armservicenetworking.SecurityPoliciesInterfaceClientListByTrafficControllerResponse]](), + } +} + +// SecurityPoliciesInterfaceServerTransport connects instances of armservicenetworking.SecurityPoliciesInterfaceClient to instances of SecurityPoliciesInterfaceServer. +// Don't use this type directly, use NewSecurityPoliciesInterfaceServerTransport instead. +type SecurityPoliciesInterfaceServerTransport struct { + srv *SecurityPoliciesInterfaceServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armservicenetworking.SecurityPoliciesInterfaceClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armservicenetworking.SecurityPoliciesInterfaceClientDeleteResponse]] + newListByTrafficControllerPager *tracker[azfake.PagerResponder[armservicenetworking.SecurityPoliciesInterfaceClientListByTrafficControllerResponse]] +} + +// Do implements the policy.Transporter interface for SecurityPoliciesInterfaceServerTransport. +func (s *SecurityPoliciesInterfaceServerTransport) 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 "SecurityPoliciesInterfaceClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SecurityPoliciesInterfaceClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SecurityPoliciesInterfaceClient.Get": + resp, err = s.dispatchGet(req) + case "SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager": + resp, err = s.dispatchNewListByTrafficControllerPager(req) + case "SecurityPoliciesInterfaceClient.Update": + resp, err = s.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SecurityPoliciesInterfaceServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicy/(?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[armservicenetworking.SecurityPolicy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + trafficControllerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("trafficControllerName")]) + if err != nil { + return nil, err + } + securityPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, trafficControllerNameParam, securityPolicyNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.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) { + s.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) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SecurityPoliciesInterfaceServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicy/(?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 + } + trafficControllerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("trafficControllerName")]) + if err != nil { + return nil, err + } + securityPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, trafficControllerNameParam, securityPolicyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SecurityPoliciesInterfaceServerTransport) 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\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicy/(?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 + } + trafficControllerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("trafficControllerName")]) + if err != nil { + return nil, err + } + securityPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, trafficControllerNameParam, securityPolicyNameParam, 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).SecurityPolicy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecurityPoliciesInterfaceServerTransport) dispatchNewListByTrafficControllerPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByTrafficControllerPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByTrafficControllerPager not implemented")} + } + newListByTrafficControllerPager := s.newListByTrafficControllerPager.get(req) + if newListByTrafficControllerPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicy` + 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 + } + trafficControllerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("trafficControllerName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByTrafficControllerPager(resourceGroupNameParam, trafficControllerNameParam, nil) + newListByTrafficControllerPager = &resp + s.newListByTrafficControllerPager.add(req, newListByTrafficControllerPager) + server.PagerResponderInjectNextLinks(newListByTrafficControllerPager, req, func(page *armservicenetworking.SecurityPoliciesInterfaceClientListByTrafficControllerResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByTrafficControllerPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByTrafficControllerPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByTrafficControllerPager) { + s.newListByTrafficControllerPager.remove(req) + } + return resp, nil +} + +func (s *SecurityPoliciesInterfaceServerTransport) 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\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicy/(?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[armservicenetworking.SecurityPolicyUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + trafficControllerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("trafficControllerName")]) + if err != nil { + return nil, err + } + securityPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, trafficControllerNameParam, securityPolicyNameParam, 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).SecurityPolicy, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/server_factory.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/server_factory.go index c5efb1fb7ba1..eff1829529d6 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/server_factory.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/server_factory.go @@ -22,6 +22,7 @@ type ServerFactory struct { AssociationsInterfaceServer AssociationsInterfaceServer FrontendsInterfaceServer FrontendsInterfaceServer OperationsServer OperationsServer + SecurityPoliciesInterfaceServer SecurityPoliciesInterfaceServer TrafficControllerInterfaceServer TrafficControllerInterfaceServer } @@ -42,6 +43,7 @@ type ServerFactoryTransport struct { trAssociationsInterfaceServer *AssociationsInterfaceServerTransport trFrontendsInterfaceServer *FrontendsInterfaceServerTransport trOperationsServer *OperationsServerTransport + trSecurityPoliciesInterfaceServer *SecurityPoliciesInterfaceServerTransport trTrafficControllerInterfaceServer *TrafficControllerInterfaceServerTransport } @@ -71,6 +73,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "SecurityPoliciesInterfaceClient": + initServer(s, &s.trSecurityPoliciesInterfaceServer, func() *SecurityPoliciesInterfaceServerTransport { + return NewSecurityPoliciesInterfaceServerTransport(&s.srv.SecurityPoliciesInterfaceServer) + }) + resp, err = s.trSecurityPoliciesInterfaceServer.Do(req) case "TrafficControllerInterfaceClient": initServer(s, &s.trTrafficControllerInterfaceServer, func() *TrafficControllerInterfaceServerTransport { return NewTrafficControllerInterfaceServerTransport(&s.srv.TrafficControllerInterfaceServer) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go index 993d37add085..6934459ff187 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go @@ -29,7 +29,7 @@ type TrafficControllerInterfaceServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, trafficControllerName string, resource armservicenetworking.TrafficController, options *armservicenetworking.TrafficControllerInterfaceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armservicenetworking.TrafficControllerInterfaceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method TrafficControllerInterfaceClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, trafficControllerName string, options *armservicenetworking.TrafficControllerInterfaceClientBeginDeleteOptions) (resp azfake.PollerResponder[armservicenetworking.TrafficControllerInterfaceClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method TrafficControllerInterfaceClient.Get @@ -188,9 +188,9 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { t.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { t.beginDelete.remove(req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go index b69b46d6c449..90015a6dbaf3 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client.go @@ -46,7 +46,7 @@ func NewFrontendsInterfaceClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Create a Frontend // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - frontendName - Frontends @@ -74,7 +74,7 @@ func (client *FrontendsInterfaceClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create a Frontend // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview func (client *FrontendsInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, resource Frontend, options *FrontendsInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "FrontendsInterfaceClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *FrontendsInterfaceClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -132,7 +132,7 @@ func (client *FrontendsInterfaceClient) createOrUpdateCreateRequest(ctx context. // BeginDelete - Delete a Frontend // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - frontendName - Frontends @@ -159,7 +159,7 @@ func (client *FrontendsInterfaceClient) BeginDelete(ctx context.Context, resourc // Delete - Delete a Frontend // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview func (client *FrontendsInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, frontendName string, options *FrontendsInterfaceClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FrontendsInterfaceClient.BeginDelete" @@ -174,7 +174,7 @@ func (client *FrontendsInterfaceClient) deleteOperation(ctx context.Context, res 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 } @@ -205,7 +205,7 @@ func (client *FrontendsInterfaceClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *FrontendsInterfaceClient) deleteCreateRequest(ctx context.Context, // Get - Get a Frontend // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - frontendName - Frontends @@ -265,7 +265,7 @@ func (client *FrontendsInterfaceClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +282,7 @@ func (client *FrontendsInterfaceClient) getHandleResponse(resp *http.Response) ( // NewListByTrafficControllerPager - List Frontend resources by TrafficController // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - options - FrontendsInterfaceClientListByTrafficControllerOptions contains the optional parameters for the FrontendsInterfaceClient.NewListByTrafficControllerPager @@ -330,7 +330,7 @@ func (client *FrontendsInterfaceClient) listByTrafficControllerCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +348,7 @@ func (client *FrontendsInterfaceClient) listByTrafficControllerHandleResponse(re // Update - Update a Frontend // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - frontendName - Frontends @@ -401,7 +401,7 @@ func (client *FrontendsInterfaceClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") 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/servicenetworking/armservicenetworking/frontendsinterface_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_client_example_test.go deleted file mode 100644 index 261369fbe915..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/frontendsinterface_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 armservicenetworking_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/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendsGet.json -func ExampleFrontendsInterfaceClient_NewListByTrafficControllerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFrontendsInterfaceClient().NewListByTrafficControllerPager("rg1", "tc1", 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.FrontendListResult = armservicenetworking.FrontendListResult{ - // Value: []*armservicenetworking.Frontend{ - // { - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendGet.json -func ExampleFrontendsInterfaceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFrontendsInterfaceClient().Get(ctx, "rg1", "tc1", "fe1", 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.Frontend = armservicenetworking.Frontend{ - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendPut.json -func ExampleFrontendsInterfaceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFrontendsInterfaceClient().BeginCreateOrUpdate(ctx, "rg1", "tc1", "fe1", armservicenetworking.Frontend{ - Location: to.Ptr("NorthCentralUS"), - Properties: &armservicenetworking.FrontendProperties{}, - }, 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.Frontend = armservicenetworking.Frontend{ - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendPatch.json -func ExampleFrontendsInterfaceClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFrontendsInterfaceClient().Update(ctx, "rg1", "tc1", "fe1", armservicenetworking.FrontendUpdate{}, 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.Frontend = armservicenetworking.Frontend{ - // Name: to.Ptr("fe1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/frontends"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // Location: to.Ptr("NorthCentralUS"), - // Properties: &armservicenetworking.FrontendProperties{ - // Fqdn: to.Ptr("test.net"), - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendDelete.json -func ExampleFrontendsInterfaceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFrontendsInterfaceClient().BeginDelete(ctx, "rg1", "tc1", "fe1", 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/servicenetworking/armservicenetworking/go.mod b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod index 484babbec608..af302b2f8eae 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/a go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go index 2111d1db8771..7723667482a0 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go @@ -69,7 +69,7 @@ type AssociationSubnetUpdate struct { // AssociationUpdate - The type used for update operations of the Association. type AssociationUpdate struct { - // The updatable properties of the Association. + // The resource-specific properties for this resource. Properties *AssociationUpdateProperties // Resource tags. @@ -85,7 +85,7 @@ type AssociationUpdateProperties struct { Subnet *AssociationSubnetUpdate } -// Frontend Subresource of Traffic Controller. +// Frontend Sub Resource of Traffic Controller. type Frontend struct { // REQUIRED; The geo-location where the resource lives Location *string @@ -188,6 +188,78 @@ type ResourceID struct { ID *string } +// SecurityPolicy Subresource of Traffic Controller. +type SecurityPolicy struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SecurityPolicyProperties + + // 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 +} + +// SecurityPolicyConfigurations Subresource of Traffic Controller. +type SecurityPolicyConfigurations struct { + // Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. + WafSecurityPolicy *WafSecurityPolicy +} + +// SecurityPolicyConfigurationsUpdate - SecurityPolicyConfigurations Subresource of Traffic Controller. +type SecurityPolicyConfigurationsUpdate struct { + // Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. + WafSecurityPolicy *WafSecurityPolicyUpdate +} + +// SecurityPolicyListResult - The response of a SecurityPolicy list operation. +type SecurityPolicyListResult struct { + // REQUIRED; The SecurityPolicy items on this page + Value []*SecurityPolicy + + // The link to the next page of items + NextLink *string +} + +// SecurityPolicyProperties - SecurityPolicy Properties. +type SecurityPolicyProperties struct { + // Web Application Firewall Policy of the Traffic Controller Security Policy + WafPolicy *WafPolicy + + // READ-ONLY; Type of the Traffic Controller Security Policy + PolicyType *PolicyType + + // READ-ONLY; Provisioning State of Traffic Controller SecurityPolicy Resource + ProvisioningState *ProvisioningState +} + +// SecurityPolicyUpdate - The type used for update operations of the SecurityPolicy. +type SecurityPolicyUpdate struct { + // The resource-specific properties for this resource. + Properties *SecurityPolicyUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// SecurityPolicyUpdateProperties - The updatable properties of the SecurityPolicy. +type SecurityPolicyUpdateProperties struct { + // Web Application Firewall Policy of the Traffic Controller Security Policy + WafPolicy *WafPolicyUpdate +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -244,6 +316,9 @@ type TrafficControllerListResult struct { // TrafficControllerProperties - Traffic Controller Properties. type TrafficControllerProperties struct { + // Security Policy Configuration + SecurityPolicyConfigurations *SecurityPolicyConfigurations + // READ-ONLY; Associations References List Associations []*ResourceID @@ -255,10 +330,46 @@ type TrafficControllerProperties struct { // READ-ONLY; The status of the last operation. ProvisioningState *ProvisioningState + + // READ-ONLY; Security Policies References List + SecurityPolicies []*ResourceID } // TrafficControllerUpdate - The type used for update operations of the TrafficController. type TrafficControllerUpdate struct { + // The resource-specific properties for this resource. + Properties *TrafficControllerUpdateProperties + // Resource tags. Tags map[string]*string } + +// TrafficControllerUpdateProperties - The updatable properties of the TrafficController. +type TrafficControllerUpdateProperties struct { + // Security Policy Configuration + SecurityPolicyConfigurations *SecurityPolicyConfigurationsUpdate +} + +// WafPolicy - Web Application Firewall Policy +type WafPolicy struct { + // REQUIRED; Resource ID of the WAF + ID *string +} + +// WafPolicyUpdate - Web Application Firewall Policy +type WafPolicyUpdate struct { + // Resource ID of the WAF + ID *string +} + +// WafSecurityPolicy - Web Application Firewall Security Policy +type WafSecurityPolicy struct { + // REQUIRED; Resource ID of the Waf Security Policy + ID *string +} + +// WafSecurityPolicyUpdate - Web Application Firewall Security Policy +type WafSecurityPolicyUpdate struct { + // Resource ID of the Waf Security Policy + ID *string +} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go index e595b80706d0..bbc64dfc3412 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/models_serde.go @@ -528,6 +528,235 @@ func (r *ResourceID) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SecurityPolicy. +func (s SecurityPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + 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 SecurityPolicy. +func (s *SecurityPolicy) UnmarshalJSON(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 "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 SecurityPolicyConfigurations. +func (s SecurityPolicyConfigurations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "wafSecurityPolicy", s.WafSecurityPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPolicyConfigurations. +func (s *SecurityPolicyConfigurations) UnmarshalJSON(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 "wafSecurityPolicy": + err = unpopulate(val, "WafSecurityPolicy", &s.WafSecurityPolicy) + 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 SecurityPolicyConfigurationsUpdate. +func (s SecurityPolicyConfigurationsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "wafSecurityPolicy", s.WafSecurityPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPolicyConfigurationsUpdate. +func (s *SecurityPolicyConfigurationsUpdate) UnmarshalJSON(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 "wafSecurityPolicy": + err = unpopulate(val, "WafSecurityPolicy", &s.WafSecurityPolicy) + 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 SecurityPolicyListResult. +func (s SecurityPolicyListResult) 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 SecurityPolicyListResult. +func (s *SecurityPolicyListResult) UnmarshalJSON(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 SecurityPolicyProperties. +func (s SecurityPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "policyType", s.PolicyType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "wafPolicy", s.WafPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPolicyProperties. +func (s *SecurityPolicyProperties) UnmarshalJSON(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 "policyType": + err = unpopulate(val, "PolicyType", &s.PolicyType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "wafPolicy": + err = unpopulate(val, "WafPolicy", &s.WafPolicy) + 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 SecurityPolicyUpdate. +func (s SecurityPolicyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPolicyUpdate. +func (s *SecurityPolicyUpdate) UnmarshalJSON(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 "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 SecurityPolicyUpdateProperties. +func (s SecurityPolicyUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "wafPolicy", s.WafPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPolicyUpdateProperties. +func (s *SecurityPolicyUpdateProperties) UnmarshalJSON(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 "wafPolicy": + err = unpopulate(val, "WafPolicy", &s.WafPolicy) + 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) @@ -664,6 +893,8 @@ func (t TrafficControllerProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "configurationEndpoints", t.ConfigurationEndpoints) populate(objectMap, "frontends", t.Frontends) populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "securityPolicies", t.SecurityPolicies) + populate(objectMap, "securityPolicyConfigurations", t.SecurityPolicyConfigurations) return json.Marshal(objectMap) } @@ -688,6 +919,12 @@ func (t *TrafficControllerProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) delete(rawMsg, key) + case "securityPolicies": + err = unpopulate(val, "SecurityPolicies", &t.SecurityPolicies) + delete(rawMsg, key) + case "securityPolicyConfigurations": + err = unpopulate(val, "SecurityPolicyConfigurations", &t.SecurityPolicyConfigurations) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -699,6 +936,7 @@ func (t *TrafficControllerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TrafficControllerUpdate. func (t TrafficControllerUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "properties", t.Properties) populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } @@ -712,6 +950,9 @@ func (t *TrafficControllerUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -723,6 +964,141 @@ func (t *TrafficControllerUpdate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TrafficControllerUpdateProperties. +func (t TrafficControllerUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "securityPolicyConfigurations", t.SecurityPolicyConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficControllerUpdateProperties. +func (t *TrafficControllerUpdateProperties) UnmarshalJSON(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 "securityPolicyConfigurations": + err = unpopulate(val, "SecurityPolicyConfigurations", &t.SecurityPolicyConfigurations) + 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 WafPolicy. +func (w WafPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WafPolicy. +func (w *WafPolicy) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WafPolicyUpdate. +func (w WafPolicyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WafPolicyUpdate. +func (w *WafPolicyUpdate) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WafSecurityPolicy. +func (w WafSecurityPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WafSecurityPolicy. +func (w *WafSecurityPolicy) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WafSecurityPolicyUpdate. +func (w WafSecurityPolicyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WafSecurityPolicyUpdate. +func (w *WafSecurityPolicyUpdate) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return @@ -734,7 +1110,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/servicenetworking/armservicenetworking/operations_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go index 1000bf18cf09..ae25aca1116d 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client_example_test.go deleted file mode 100644 index 734431ef05cd..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/operations_client_example_test.go +++ /dev/null @@ -1,57 +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 armservicenetworking_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/OperationsList.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 := armservicenetworking.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 = armservicenetworking.OperationListResult{ - // Value: []*armservicenetworking.Operation{ - // { - // Name: to.Ptr("Microsoft.ServiceNetworking/trafficControllers/read"), - // Display: &armservicenetworking.OperationDisplay{ - // Description: to.Ptr("Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup"), - // Operation: to.Ptr("Get Traffic Controller configuration"), - // Provider: to.Ptr("Microsoft Service Networking"), - // Resource: to.Ptr("Traffic Controller"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armservicenetworking.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go index 35b047221323..c25d85b968fa 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/options.go @@ -73,6 +73,38 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.BeginCreateOrUpdate +// method. +type SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityPoliciesInterfaceClientBeginDeleteOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.BeginDelete +// method. +type SecurityPoliciesInterfaceClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityPoliciesInterfaceClientGetOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.Get +// method. +type SecurityPoliciesInterfaceClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecurityPoliciesInterfaceClientListByTrafficControllerOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager +// method. +type SecurityPoliciesInterfaceClientListByTrafficControllerOptions struct { + // placeholder for future optional parameters +} + +// SecurityPoliciesInterfaceClientUpdateOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.Update +// method. +type SecurityPoliciesInterfaceClientUpdateOptions struct { + // placeholder for future optional parameters +} + // TrafficControllerInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the TrafficControllerInterfaceClient.BeginCreateOrUpdate // method. type TrafficControllerInterfaceClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/responses.go similarity index 76% rename from sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go rename to sdk/resourcemanager/servicenetworking/armservicenetworking/responses.go index 3cd51f53b009..6bfb68611c48 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/response_types.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/responses.go @@ -39,7 +39,7 @@ type AssociationsInterfaceClientUpdateResponse struct { // FrontendsInterfaceClientCreateOrUpdateResponse contains the response from method FrontendsInterfaceClient.BeginCreateOrUpdate. type FrontendsInterfaceClientCreateOrUpdateResponse struct { - // Frontend Subresource of Traffic Controller. + // Frontend Sub Resource of Traffic Controller. Frontend } @@ -50,7 +50,7 @@ type FrontendsInterfaceClientDeleteResponse struct { // FrontendsInterfaceClientGetResponse contains the response from method FrontendsInterfaceClient.Get. type FrontendsInterfaceClientGetResponse struct { - // Frontend Subresource of Traffic Controller. + // Frontend Sub Resource of Traffic Controller. Frontend } @@ -62,7 +62,7 @@ type FrontendsInterfaceClientListByTrafficControllerResponse struct { // FrontendsInterfaceClientUpdateResponse contains the response from method FrontendsInterfaceClient.Update. type FrontendsInterfaceClientUpdateResponse struct { - // Frontend Subresource of Traffic Controller. + // Frontend Sub Resource of Traffic Controller. Frontend } @@ -72,6 +72,35 @@ type OperationsClientListResponse struct { OperationListResult } +// SecurityPoliciesInterfaceClientCreateOrUpdateResponse contains the response from method SecurityPoliciesInterfaceClient.BeginCreateOrUpdate. +type SecurityPoliciesInterfaceClientCreateOrUpdateResponse struct { + // SecurityPolicy Subresource of Traffic Controller. + SecurityPolicy +} + +// SecurityPoliciesInterfaceClientDeleteResponse contains the response from method SecurityPoliciesInterfaceClient.BeginDelete. +type SecurityPoliciesInterfaceClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityPoliciesInterfaceClientGetResponse contains the response from method SecurityPoliciesInterfaceClient.Get. +type SecurityPoliciesInterfaceClientGetResponse struct { + // SecurityPolicy Subresource of Traffic Controller. + SecurityPolicy +} + +// SecurityPoliciesInterfaceClientListByTrafficControllerResponse contains the response from method SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager. +type SecurityPoliciesInterfaceClientListByTrafficControllerResponse struct { + // The response of a SecurityPolicy list operation. + SecurityPolicyListResult +} + +// SecurityPoliciesInterfaceClientUpdateResponse contains the response from method SecurityPoliciesInterfaceClient.Update. +type SecurityPoliciesInterfaceClientUpdateResponse struct { + // SecurityPolicy Subresource of Traffic Controller. + SecurityPolicy +} + // TrafficControllerInterfaceClientCreateOrUpdateResponse contains the response from method TrafficControllerInterfaceClient.BeginCreateOrUpdate. type TrafficControllerInterfaceClientCreateOrUpdateResponse struct { // Concrete tracked resource types can be created by aliasing this type using a specific property type. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/securitypoliciesinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/securitypoliciesinterface_client.go new file mode 100644 index 000000000000..aa1d95e8f095 --- /dev/null +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/securitypoliciesinterface_client.go @@ -0,0 +1,421 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armservicenetworking + +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" +) + +// SecurityPoliciesInterfaceClient contains the methods for the SecurityPoliciesInterface group. +// Don't use this type directly, use NewSecurityPoliciesInterfaceClient() instead. +type SecurityPoliciesInterfaceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSecurityPoliciesInterfaceClient creates a new instance of SecurityPoliciesInterfaceClient 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 NewSecurityPoliciesInterfaceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityPoliciesInterfaceClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityPoliciesInterfaceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a SecurityPolicy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - trafficControllerName - traffic controller name for path +// - securityPolicyName - SecurityPolicy +// - resource - Resource create parameters. +// - options - SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.BeginCreateOrUpdate +// method. +func (client *SecurityPoliciesInterfaceClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, resource SecurityPolicy, options *SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecurityPoliciesInterfaceClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, trafficControllerName, securityPolicyName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityPoliciesInterfaceClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecurityPoliciesInterfaceClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a SecurityPolicy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +func (client *SecurityPoliciesInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, resource SecurityPolicy, options *SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SecurityPoliciesInterfaceClient.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, trafficControllerName, securityPolicyName, 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 *SecurityPoliciesInterfaceClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, resource SecurityPolicy, options *SecurityPoliciesInterfaceClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicy/{securityPolicyName}" + 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 trafficControllerName == "" { + return nil, errors.New("parameter trafficControllerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trafficControllerName}", url.PathEscape(trafficControllerName)) + if securityPolicyName == "" { + return nil, errors.New("parameter securityPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPolicyName}", url.PathEscape(securityPolicyName)) + 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-05-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 - Delete a SecurityPolicy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - trafficControllerName - traffic controller name for path +// - securityPolicyName - SecurityPolicy +// - options - SecurityPoliciesInterfaceClientBeginDeleteOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.BeginDelete +// method. +func (client *SecurityPoliciesInterfaceClient) BeginDelete(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *SecurityPoliciesInterfaceClientBeginDeleteOptions) (*runtime.Poller[SecurityPoliciesInterfaceClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, trafficControllerName, securityPolicyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecurityPoliciesInterfaceClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecurityPoliciesInterfaceClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a SecurityPolicy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +func (client *SecurityPoliciesInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *SecurityPoliciesInterfaceClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SecurityPoliciesInterfaceClient.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, trafficControllerName, securityPolicyName, 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 *SecurityPoliciesInterfaceClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *SecurityPoliciesInterfaceClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicy/{securityPolicyName}" + 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 trafficControllerName == "" { + return nil, errors.New("parameter trafficControllerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trafficControllerName}", url.PathEscape(trafficControllerName)) + if securityPolicyName == "" { + return nil, errors.New("parameter securityPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPolicyName}", url.PathEscape(securityPolicyName)) + 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-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SecurityPolicy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - trafficControllerName - traffic controller name for path +// - securityPolicyName - SecurityPolicy +// - options - SecurityPoliciesInterfaceClientGetOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.Get +// method. +func (client *SecurityPoliciesInterfaceClient) Get(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *SecurityPoliciesInterfaceClientGetOptions) (SecurityPoliciesInterfaceClientGetResponse, error) { + var err error + const operationName = "SecurityPoliciesInterfaceClient.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, trafficControllerName, securityPolicyName, options) + if err != nil { + return SecurityPoliciesInterfaceClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityPoliciesInterfaceClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityPoliciesInterfaceClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SecurityPoliciesInterfaceClient) getCreateRequest(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, options *SecurityPoliciesInterfaceClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicy/{securityPolicyName}" + 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 trafficControllerName == "" { + return nil, errors.New("parameter trafficControllerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trafficControllerName}", url.PathEscape(trafficControllerName)) + if securityPolicyName == "" { + return nil, errors.New("parameter securityPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPolicyName}", url.PathEscape(securityPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-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 *SecurityPoliciesInterfaceClient) getHandleResponse(resp *http.Response) (SecurityPoliciesInterfaceClientGetResponse, error) { + result := SecurityPoliciesInterfaceClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPolicy); err != nil { + return SecurityPoliciesInterfaceClientGetResponse{}, err + } + return result, nil +} + +// NewListByTrafficControllerPager - List SecurityPolicy resources by TrafficController +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - trafficControllerName - traffic controller name for path +// - options - SecurityPoliciesInterfaceClientListByTrafficControllerOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager +// method. +func (client *SecurityPoliciesInterfaceClient) NewListByTrafficControllerPager(resourceGroupName string, trafficControllerName string, options *SecurityPoliciesInterfaceClientListByTrafficControllerOptions) *runtime.Pager[SecurityPoliciesInterfaceClientListByTrafficControllerResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityPoliciesInterfaceClientListByTrafficControllerResponse]{ + More: func(page SecurityPoliciesInterfaceClientListByTrafficControllerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityPoliciesInterfaceClientListByTrafficControllerResponse) (SecurityPoliciesInterfaceClientListByTrafficControllerResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecurityPoliciesInterfaceClient.NewListByTrafficControllerPager") + 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.listByTrafficControllerCreateRequest(ctx, resourceGroupName, trafficControllerName, options) + }, nil) + if err != nil { + return SecurityPoliciesInterfaceClientListByTrafficControllerResponse{}, err + } + return client.listByTrafficControllerHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByTrafficControllerCreateRequest creates the ListByTrafficController request. +func (client *SecurityPoliciesInterfaceClient) listByTrafficControllerCreateRequest(ctx context.Context, resourceGroupName string, trafficControllerName string, options *SecurityPoliciesInterfaceClientListByTrafficControllerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicy" + 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 trafficControllerName == "" { + return nil, errors.New("parameter trafficControllerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trafficControllerName}", url.PathEscape(trafficControllerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTrafficControllerHandleResponse handles the ListByTrafficController response. +func (client *SecurityPoliciesInterfaceClient) listByTrafficControllerHandleResponse(resp *http.Response) (SecurityPoliciesInterfaceClientListByTrafficControllerResponse, error) { + result := SecurityPoliciesInterfaceClientListByTrafficControllerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPolicyListResult); err != nil { + return SecurityPoliciesInterfaceClientListByTrafficControllerResponse{}, err + } + return result, nil +} + +// Update - Update a SecurityPolicy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - trafficControllerName - traffic controller name for path +// - securityPolicyName - SecurityPolicy +// - properties - The resource properties to be updated. +// - options - SecurityPoliciesInterfaceClientUpdateOptions contains the optional parameters for the SecurityPoliciesInterfaceClient.Update +// method. +func (client *SecurityPoliciesInterfaceClient) Update(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, properties SecurityPolicyUpdate, options *SecurityPoliciesInterfaceClientUpdateOptions) (SecurityPoliciesInterfaceClientUpdateResponse, error) { + var err error + const operationName = "SecurityPoliciesInterfaceClient.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, trafficControllerName, securityPolicyName, properties, options) + if err != nil { + return SecurityPoliciesInterfaceClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityPoliciesInterfaceClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityPoliciesInterfaceClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SecurityPoliciesInterfaceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, trafficControllerName string, securityPolicyName string, properties SecurityPolicyUpdate, options *SecurityPoliciesInterfaceClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicy/{securityPolicyName}" + 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 trafficControllerName == "" { + return nil, errors.New("parameter trafficControllerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trafficControllerName}", url.PathEscape(trafficControllerName)) + if securityPolicyName == "" { + return nil, errors.New("parameter securityPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPolicyName}", url.PathEscape(securityPolicyName)) + 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-05-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 *SecurityPoliciesInterfaceClient) updateHandleResponse(resp *http.Response) (SecurityPoliciesInterfaceClientUpdateResponse, error) { + result := SecurityPoliciesInterfaceClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPolicy); err != nil { + return SecurityPoliciesInterfaceClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go index 8ad85197d842..e2b025f5d16c 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go index be066259f3b3..7a6f8a7978ef 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client.go @@ -46,7 +46,7 @@ func NewTrafficControllerInterfaceClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create a TrafficController // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - resource - Resource create parameters. @@ -73,7 +73,7 @@ func (client *TrafficControllerInterfaceClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create a TrafficController // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview func (client *TrafficControllerInterfaceClient) createOrUpdate(ctx context.Context, resourceGroupName string, trafficControllerName string, resource TrafficController, options *TrafficControllerInterfaceClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "TrafficControllerInterfaceClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *TrafficControllerInterfaceClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,7 @@ func (client *TrafficControllerInterfaceClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a TrafficController // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - options - TrafficControllerInterfaceClientBeginDeleteOptions contains the optional parameters for the TrafficControllerInterfaceClient.BeginDelete @@ -153,7 +153,7 @@ func (client *TrafficControllerInterfaceClient) BeginDelete(ctx context.Context, // Delete - Delete a TrafficController // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview func (client *TrafficControllerInterfaceClient) deleteOperation(ctx context.Context, resourceGroupName string, trafficControllerName string, options *TrafficControllerInterfaceClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "TrafficControllerInterfaceClient.BeginDelete" @@ -168,7 +168,7 @@ func (client *TrafficControllerInterfaceClient) deleteOperation(ctx context.Cont 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 } @@ -195,7 +195,7 @@ func (client *TrafficControllerInterfaceClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +204,7 @@ func (client *TrafficControllerInterfaceClient) deleteCreateRequest(ctx context. // Get - Get a TrafficController // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - options - TrafficControllerInterfaceClientGetOptions contains the optional parameters for the TrafficControllerInterfaceClient.Get @@ -251,7 +251,7 @@ func (client *TrafficControllerInterfaceClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +268,7 @@ func (client *TrafficControllerInterfaceClient) getHandleResponse(resp *http.Res // NewListByResourceGroupPager - List TrafficController resources by resource group // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - TrafficControllerInterfaceClientListByResourceGroupOptions contains the optional parameters for the TrafficControllerInterfaceClient.NewListByResourceGroupPager // method. @@ -311,7 +311,7 @@ func (client *TrafficControllerInterfaceClient) listByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +328,7 @@ func (client *TrafficControllerInterfaceClient) listByResourceGroupHandleRespons // NewListBySubscriptionPager - List TrafficController resources by subscription ID // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - options - TrafficControllerInterfaceClientListBySubscriptionOptions contains the optional parameters for the TrafficControllerInterfaceClient.NewListBySubscriptionPager // method. func (client *TrafficControllerInterfaceClient) NewListBySubscriptionPager(options *TrafficControllerInterfaceClientListBySubscriptionOptions) *runtime.Pager[TrafficControllerInterfaceClientListBySubscriptionResponse] { @@ -366,7 +366,7 @@ func (client *TrafficControllerInterfaceClient) listBySubscriptionCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +384,7 @@ func (client *TrafficControllerInterfaceClient) listBySubscriptionHandleResponse // Update - Update a TrafficController // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2024-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - trafficControllerName - traffic controller name for path // - properties - The resource properties to be updated. @@ -432,7 +432,7 @@ func (client *TrafficControllerInterfaceClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2024-05-01-preview") 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/servicenetworking/armservicenetworking/trafficcontrollerinterface_client_example_test.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client_example_test.go deleted file mode 100644 index 3d753cf55300..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/trafficcontrollerinterface_client_example_test.go +++ /dev/null @@ -1,279 +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 armservicenetworking_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/servicenetworking/armservicenetworking" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllersGetList.json -func ExampleTrafficControllerInterfaceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTrafficControllerInterfaceClient().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.TrafficControllerListResult = armservicenetworking.TrafficControllerListResult{ - // Value: []*armservicenetworking.TrafficController{ - // { - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllersGet.json -func ExampleTrafficControllerInterfaceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTrafficControllerInterfaceClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TrafficControllerListResult = armservicenetworking.TrafficControllerListResult{ - // Value: []*armservicenetworking.TrafficController{ - // { - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerGet.json -func ExampleTrafficControllerInterfaceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTrafficControllerInterfaceClient().Get(ctx, "rg1", "tc1", 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.TrafficController = armservicenetworking.TrafficController{ - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerPut.json -func ExampleTrafficControllerInterfaceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTrafficControllerInterfaceClient().BeginCreateOrUpdate(ctx, "rg1", "tc1", armservicenetworking.TrafficController{ - Location: to.Ptr("NorthCentralUS"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, 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.TrafficController = armservicenetworking.TrafficController{ - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerPatch.json -func ExampleTrafficControllerInterfaceClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTrafficControllerInterfaceClient().Update(ctx, "rg1", "tc1", armservicenetworking.TrafficControllerUpdate{ - 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.TrafficController = armservicenetworking.TrafficController{ - // Name: to.Ptr("tc1"), - // Type: to.Ptr("Microsoft.ServiceNetworking/trafficControllers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1"), - // Location: to.Ptr("NorthCentralUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armservicenetworking.TrafficControllerProperties{ - // Associations: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1"), - // }}, - // ConfigurationEndpoints: []*string{ - // to.Ptr("abc.trafficcontroller.azure.net")}, - // Frontends: []*armservicenetworking.ResourceID{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1"), - // }}, - // ProvisioningState: to.Ptr(armservicenetworking.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/db9788dde7a0c2c0d82e4fdf5f7b4de3843937e3/specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerDelete.json -func ExampleTrafficControllerInterfaceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armservicenetworking.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTrafficControllerInterfaceClient().BeginDelete(ctx, "rg1", "tc1", 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..56766d12788c 100644 --- a/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md +++ b/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-08-09) +### 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_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_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/constants.go b/sdk/resourcemanager/sphere/armsphere/constants.go index 4fa7e90a0c8f..07028e01a14e 100644 --- a/sdk/resourcemanager/sphere/armsphere/constants.go +++ b/sdk/resourcemanager/sphere/armsphere/constants.go @@ -10,7 +10,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_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_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_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/go.mod b/sdk/resourcemanager/sphere/armsphere/go.mod index 9cac9337d121..1e35eb6cfb25 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.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/sphere/armsphere/go.sum b/sdk/resourcemanager/sphere/armsphere/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/sphere/armsphere/go.sum +++ b/sdk/resourcemanager/sphere/armsphere/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 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..00d8e2ce3bbf 100644 --- a/sdk/resourcemanager/sphere/armsphere/models.go +++ b/sdk/resourcemanager/sphere/armsphere/models.go @@ -39,7 +39,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 +87,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 +150,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 +210,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 +294,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 +363,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 +457,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 +484,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/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/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/trustedsigning/armtrustedsigning/CHANGELOG.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md new file mode 100644 index 000000000000..a6d66d2b297f --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning` 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/trustedsigning/armtrustedsigning/LICENSE.txt b/sdk/resourcemanager/trustedsigning/armtrustedsigning/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/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/trustedsigning/armtrustedsigning/README.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/README.md new file mode 100644 index 000000000000..c49b120a564d --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/README.md @@ -0,0 +1,92 @@ +# Azure Trustedsigning Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning) + +The `armtrustedsigning` module provides operations for working with Azure Trustedsigning. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/trustedsigning/armtrustedsigning) + +# 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 Trustedsigning module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Trustedsigning. 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 Trustedsigning 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 := armtrustedsigning.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 := armtrustedsigning.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.NewCertificateProfilesClient() +``` + +## 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 `Trustedsigning` 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/trustedsigning/armtrustedsigning/autorest.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/autorest.md new file mode 100644 index 000000000000..44641942e27f --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/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/codesigning/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/codesigning/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/trustedsigning/armtrustedsigning/build.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/build.go new file mode 100644 index 000000000000..c175ba2451e4 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/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/trustedsigning/armtrustedsigning + +package armtrustedsigning diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go new file mode 100644 index 000000000000..6c7689bb0f62 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go @@ -0,0 +1,410 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +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" +) + +// CertificateProfilesClient contains the methods for the CertificateProfiles group. +// Don't use this type directly, use NewCertificateProfilesClient() instead. +type CertificateProfilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCertificateProfilesClient creates a new instance of CertificateProfilesClient 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 NewCertificateProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificateProfilesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CertificateProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - resource - Parameters to create the certificate profile +// - options - CertificateProfilesClientBeginCreateOptions contains the optional parameters for the CertificateProfilesClient.BeginCreate +// method. +func (client *CertificateProfilesClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*runtime.Poller[CertificateProfilesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, profileName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateProfilesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CertificateProfilesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CertificateProfilesClient) create(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CertificateProfilesClient.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, accountName, profileName, 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 *CertificateProfilesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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-05-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 - Delete a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - options - CertificateProfilesClientBeginDeleteOptions contains the optional parameters for the CertificateProfilesClient.BeginDelete +// method. +func (client *CertificateProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*runtime.Poller[CertificateProfilesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, profileName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateProfilesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CertificateProfilesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CertificateProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CertificateProfilesClient.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, accountName, profileName, 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 *CertificateProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get details of a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - options - CertificateProfilesClientGetOptions contains the optional parameters for the CertificateProfilesClient.Get method. +func (client *CertificateProfilesClient) Get(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientGetOptions) (CertificateProfilesClientGetResponse, error) { + var err error + const operationName = "CertificateProfilesClient.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, accountName, profileName, options) + if err != nil { + return CertificateProfilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificateProfilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CertificateProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CertificateProfilesClient) getHandleResponse(resp *http.Response) (CertificateProfilesClientGetResponse, error) { + result := CertificateProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateProfile); err != nil { + return CertificateProfilesClientGetResponse{}, err + } + return result, nil +} + +// NewListByCodeSigningAccountPager - List certificate profiles under a trusted signing account. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - options - CertificateProfilesClientListByCodeSigningAccountOptions contains the optional parameters for the CertificateProfilesClient.NewListByCodeSigningAccountPager +// method. +func (client *CertificateProfilesClient) NewListByCodeSigningAccountPager(resourceGroupName string, accountName string, options *CertificateProfilesClientListByCodeSigningAccountOptions) *runtime.Pager[CertificateProfilesClientListByCodeSigningAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[CertificateProfilesClientListByCodeSigningAccountResponse]{ + More: func(page CertificateProfilesClientListByCodeSigningAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CertificateProfilesClientListByCodeSigningAccountResponse) (CertificateProfilesClientListByCodeSigningAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CertificateProfilesClient.NewListByCodeSigningAccountPager") + 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.listByCodeSigningAccountCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return CertificateProfilesClientListByCodeSigningAccountResponse{}, err + } + return client.listByCodeSigningAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCodeSigningAccountCreateRequest creates the ListByCodeSigningAccount request. +func (client *CertificateProfilesClient) listByCodeSigningAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CertificateProfilesClientListByCodeSigningAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCodeSigningAccountHandleResponse handles the ListByCodeSigningAccount response. +func (client *CertificateProfilesClient) listByCodeSigningAccountHandleResponse(resp *http.Response) (CertificateProfilesClientListByCodeSigningAccountResponse, error) { + result := CertificateProfilesClientListByCodeSigningAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateProfileListResult); err != nil { + return CertificateProfilesClientListByCodeSigningAccountResponse{}, err + } + return result, nil +} + +// RevokeCertificate - Revoke a certificate under a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - body - Parameters to revoke the certificate profile +// - options - CertificateProfilesClientRevokeCertificateOptions contains the optional parameters for the CertificateProfilesClient.RevokeCertificate +// method. +func (client *CertificateProfilesClient) RevokeCertificate(ctx context.Context, resourceGroupName string, accountName string, profileName string, body RevokeCertificate, options *CertificateProfilesClientRevokeCertificateOptions) (CertificateProfilesClientRevokeCertificateResponse, error) { + var err error + const operationName = "CertificateProfilesClient.RevokeCertificate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revokeCertificateCreateRequest(ctx, resourceGroupName, accountName, profileName, body, options) + if err != nil { + return CertificateProfilesClientRevokeCertificateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateProfilesClientRevokeCertificateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CertificateProfilesClientRevokeCertificateResponse{}, err + } + return CertificateProfilesClientRevokeCertificateResponse{}, nil +} + +// revokeCertificateCreateRequest creates the RevokeCertificate request. +func (client *CertificateProfilesClient) revokeCertificateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, body RevokeCertificate, options *CertificateProfilesClientRevokeCertificateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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-02-05-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 +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/ci.yml b/sdk/resourcemanager/trustedsigning/armtrustedsigning/ci.yml new file mode 100644 index 000000000000..47f480d76a2d --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/ci.yml @@ -0,0 +1,28 @@ +# 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/trustedsigning/armtrustedsigning/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/trustedsigning/armtrustedsigning/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/trustedsigning/armtrustedsigning' diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/client_factory.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/client_factory.go new file mode 100644 index 000000000000..d41345a5cf8c --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/client_factory.go @@ -0,0 +1,60 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +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 +} + +// NewCertificateProfilesClient creates a new instance of CertificateProfilesClient. +func (c *ClientFactory) NewCertificateProfilesClient() *CertificateProfilesClient { + return &CertificateProfilesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewCodeSigningAccountsClient creates a new instance of CodeSigningAccountsClient. +func (c *ClientFactory) NewCodeSigningAccountsClient() *CodeSigningAccountsClient { + return &CodeSigningAccountsClient{ + 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/trustedsigning/armtrustedsigning/codesigningaccounts_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go new file mode 100644 index 000000000000..1f30aaa1bc25 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go @@ -0,0 +1,521 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +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" +) + +// CodeSigningAccountsClient contains the methods for the CodeSigningAccounts group. +// Don't use this type directly, use NewCodeSigningAccountsClient() instead. +type CodeSigningAccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCodeSigningAccountsClient creates a new instance of CodeSigningAccountsClient 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 NewCodeSigningAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CodeSigningAccountsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CodeSigningAccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Checks that the trusted signing account name is valid and is not already in use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - body - The CheckAvailability request +// - options - CodeSigningAccountsClientCheckNameAvailabilityOptions contains the optional parameters for the CodeSigningAccountsClient.CheckNameAvailability +// method. +func (client *CodeSigningAccountsClient) CheckNameAvailability(ctx context.Context, body CheckNameAvailability, options *CodeSigningAccountsClientCheckNameAvailabilityOptions) (CodeSigningAccountsClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "CodeSigningAccountsClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, body, options) + if err != nil { + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *CodeSigningAccountsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailability, options *CodeSigningAccountsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability" + 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", "2024-02-05-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 +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *CodeSigningAccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (CodeSigningAccountsClientCheckNameAvailabilityResponse, error) { + result := CodeSigningAccountsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Create a trusted Signing Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - resource - Parameters to create the trusted signing account +// - options - CodeSigningAccountsClientBeginCreateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginCreate +// method. +func (client *CodeSigningAccountsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*runtime.Poller[CodeSigningAccountsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CodeSigningAccountsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CodeSigningAccountsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a trusted Signing Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CodeSigningAccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CodeSigningAccountsClient.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, accountName, 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 *CodeSigningAccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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-05-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 - Delete a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - options - CodeSigningAccountsClientBeginDeleteOptions contains the optional parameters for the CodeSigningAccountsClient.BeginDelete +// method. +func (client *CodeSigningAccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*runtime.Poller[CodeSigningAccountsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CodeSigningAccountsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CodeSigningAccountsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CodeSigningAccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CodeSigningAccountsClient.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, accountName, 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 *CodeSigningAccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a trusted Signing Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - options - CodeSigningAccountsClientGetOptions contains the optional parameters for the CodeSigningAccountsClient.Get method. +func (client *CodeSigningAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientGetOptions) (CodeSigningAccountsClientGetResponse, error) { + var err error + const operationName = "CodeSigningAccountsClient.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, accountName, options) + if err != nil { + return CodeSigningAccountsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CodeSigningAccountsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CodeSigningAccountsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CodeSigningAccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CodeSigningAccountsClient) getHandleResponse(resp *http.Response) (CodeSigningAccountsClientGetResponse, error) { + result := CodeSigningAccountsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CodeSigningAccount); err != nil { + return CodeSigningAccountsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists trusted signing accounts within a resource group. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CodeSigningAccountsClientListByResourceGroupOptions contains the optional parameters for the CodeSigningAccountsClient.NewListByResourceGroupPager +// method. +func (client *CodeSigningAccountsClient) NewListByResourceGroupPager(resourceGroupName string, options *CodeSigningAccountsClientListByResourceGroupOptions) *runtime.Pager[CodeSigningAccountsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CodeSigningAccountsClientListByResourceGroupResponse]{ + More: func(page CodeSigningAccountsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CodeSigningAccountsClientListByResourceGroupResponse) (CodeSigningAccountsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CodeSigningAccountsClient.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 CodeSigningAccountsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CodeSigningAccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CodeSigningAccountsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts" + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CodeSigningAccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (CodeSigningAccountsClientListByResourceGroupResponse, error) { + result := CodeSigningAccountsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CodeSigningAccountListResult); err != nil { + return CodeSigningAccountsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists trusted signing accounts within a subscription. +// +// Generated from API version 2024-02-05-preview +// - options - CodeSigningAccountsClientListBySubscriptionOptions contains the optional parameters for the CodeSigningAccountsClient.NewListBySubscriptionPager +// method. +func (client *CodeSigningAccountsClient) NewListBySubscriptionPager(options *CodeSigningAccountsClientListBySubscriptionOptions) *runtime.Pager[CodeSigningAccountsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CodeSigningAccountsClientListBySubscriptionResponse]{ + More: func(page CodeSigningAccountsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CodeSigningAccountsClientListBySubscriptionResponse) (CodeSigningAccountsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CodeSigningAccountsClient.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 CodeSigningAccountsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CodeSigningAccountsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CodeSigningAccountsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSigningAccounts" + 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-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CodeSigningAccountsClient) listBySubscriptionHandleResponse(resp *http.Response) (CodeSigningAccountsClientListBySubscriptionResponse, error) { + result := CodeSigningAccountsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CodeSigningAccountListResult); err != nil { + return CodeSigningAccountsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - properties - Parameters supplied to update the trusted signing account +// - options - CodeSigningAccountsClientBeginUpdateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginUpdate +// method. +func (client *CodeSigningAccountsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*runtime.Poller[CodeSigningAccountsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CodeSigningAccountsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CodeSigningAccountsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CodeSigningAccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CodeSigningAccountsClient.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, accountName, 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 *CodeSigningAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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-05-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/trustedsigning/armtrustedsigning/constants.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go new file mode 100644 index 000000000000..0b34c3ddf9b7 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go @@ -0,0 +1,224 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" + 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, + } +} + +// CertificateProfileStatus - Status of the certificate profiles. +type CertificateProfileStatus string + +const ( + // CertificateProfileStatusActive - The certificate profile is active. + CertificateProfileStatusActive CertificateProfileStatus = "Active" + // CertificateProfileStatusDisabled - The certificate profile is disabled. + CertificateProfileStatusDisabled CertificateProfileStatus = "Disabled" + // CertificateProfileStatusSuspended - The certificate profile is suspended. + CertificateProfileStatusSuspended CertificateProfileStatus = "Suspended" +) + +// PossibleCertificateProfileStatusValues returns the possible values for the CertificateProfileStatus const type. +func PossibleCertificateProfileStatusValues() []CertificateProfileStatus { + return []CertificateProfileStatus{ + CertificateProfileStatusActive, + CertificateProfileStatusDisabled, + CertificateProfileStatusSuspended, + } +} + +// CertificateStatus - Status of the certificate +type CertificateStatus string + +const ( + // CertificateStatusActive - The certificate is active. + CertificateStatusActive CertificateStatus = "Active" + // CertificateStatusExpired - The certificate is expired. + CertificateStatusExpired CertificateStatus = "Expired" + // CertificateStatusRevoked - The certificate is revoked. + CertificateStatusRevoked CertificateStatus = "Revoked" +) + +// PossibleCertificateStatusValues returns the possible values for the CertificateStatus const type. +func PossibleCertificateStatusValues() []CertificateStatus { + return []CertificateStatus{ + CertificateStatusActive, + CertificateStatusExpired, + CertificateStatusRevoked, + } +} + +// 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, + } +} + +// NameUnavailabilityReason - The reason that a trusted signing account name could not be used. The Reason element is only +// returned if nameAvailable is false. +type NameUnavailabilityReason string + +const ( + // NameUnavailabilityReasonAccountNameInvalid - Account name is invalid + NameUnavailabilityReasonAccountNameInvalid NameUnavailabilityReason = "AccountNameInvalid" + // NameUnavailabilityReasonAlreadyExists - Account name already exists + NameUnavailabilityReasonAlreadyExists NameUnavailabilityReason = "AlreadyExists" +) + +// PossibleNameUnavailabilityReasonValues returns the possible values for the NameUnavailabilityReason const type. +func PossibleNameUnavailabilityReasonValues() []NameUnavailabilityReason { + return []NameUnavailabilityReason{ + NameUnavailabilityReasonAccountNameInvalid, + NameUnavailabilityReasonAlreadyExists, + } +} + +// 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, + } +} + +// ProfileType - Type of the certificate +type ProfileType string + +const ( + // ProfileTypePrivateTrust - Used for signing files which are distributed internally within organization or group boundary. + ProfileTypePrivateTrust ProfileType = "PrivateTrust" + // ProfileTypePrivateTrustCIPolicy - Used for signing CI policy files. + ProfileTypePrivateTrustCIPolicy ProfileType = "PrivateTrustCIPolicy" + // ProfileTypePublicTrust - Used for signing files which are distributed publicly. + ProfileTypePublicTrust ProfileType = "PublicTrust" + // ProfileTypePublicTrustTest - Used for signing files for testing purpose. + ProfileTypePublicTrustTest ProfileType = "PublicTrustTest" + // ProfileTypeVBSEnclave - Used for signing files which are run in secure vbs enclave. + ProfileTypeVBSEnclave ProfileType = "VBSEnclave" +) + +// PossibleProfileTypeValues returns the possible values for the ProfileType const type. +func PossibleProfileTypeValues() []ProfileType { + return []ProfileType{ + ProfileTypePrivateTrust, + ProfileTypePrivateTrustCIPolicy, + ProfileTypePublicTrust, + ProfileTypePublicTrustTest, + ProfileTypeVBSEnclave, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Resource creation started. + 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" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Updating in progress. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// RevocationStatus - Revocation status of the certificate. +type RevocationStatus string + +const ( + // RevocationStatusFailed - Certificate revocation failed. + RevocationStatusFailed RevocationStatus = "Failed" + // RevocationStatusInProgress - Certificate revocation is in progress. + RevocationStatusInProgress RevocationStatus = "InProgress" + // RevocationStatusSucceeded - Certificate revocation succeeded. + RevocationStatusSucceeded RevocationStatus = "Succeeded" +) + +// PossibleRevocationStatusValues returns the possible values for the RevocationStatus const type. +func PossibleRevocationStatusValues() []RevocationStatus { + return []RevocationStatus{ + RevocationStatusFailed, + RevocationStatusInProgress, + RevocationStatusSucceeded, + } +} + +// SKUName - Name of the sku. +type SKUName string + +const ( + // SKUNameBasic - Basic sku. + SKUNameBasic SKUName = "Basic" + // SKUNamePremium - Premium sku. + SKUNamePremium SKUName = "Premium" +) + +// PossibleSKUNameValues returns the possible values for the SKUName const type. +func PossibleSKUNameValues() []SKUName { + return []SKUName{ + SKUNameBasic, + SKUNamePremium, + } +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go new file mode 100644 index 000000000000..de2b09739015 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go @@ -0,0 +1,319 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/trustedsigning/armtrustedsigning" + "net/http" + "net/url" + "regexp" +) + +// CertificateProfilesServer is a fake server for instances of the armtrustedsigning.CertificateProfilesClient type. +type CertificateProfilesServer struct { + // BeginCreate is the fake for method CertificateProfilesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource armtrustedsigning.CertificateProfile, options *armtrustedsigning.CertificateProfilesClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CertificateProfilesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *armtrustedsigning.CertificateProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CertificateProfilesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *armtrustedsigning.CertificateProfilesClientGetOptions) (resp azfake.Responder[armtrustedsigning.CertificateProfilesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByCodeSigningAccountPager is the fake for method CertificateProfilesClient.NewListByCodeSigningAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByCodeSigningAccountPager func(resourceGroupName string, accountName string, options *armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountOptions) (resp azfake.PagerResponder[armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse]) + + // RevokeCertificate is the fake for method CertificateProfilesClient.RevokeCertificate + // HTTP status codes to indicate success: http.StatusNoContent + RevokeCertificate func(ctx context.Context, resourceGroupName string, accountName string, profileName string, body armtrustedsigning.RevokeCertificate, options *armtrustedsigning.CertificateProfilesClientRevokeCertificateOptions) (resp azfake.Responder[armtrustedsigning.CertificateProfilesClientRevokeCertificateResponse], errResp azfake.ErrorResponder) +} + +// NewCertificateProfilesServerTransport creates a new instance of CertificateProfilesServerTransport with the provided implementation. +// The returned CertificateProfilesServerTransport instance is connected to an instance of armtrustedsigning.CertificateProfilesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCertificateProfilesServerTransport(srv *CertificateProfilesServer) *CertificateProfilesServerTransport { + return &CertificateProfilesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse]](), + newListByCodeSigningAccountPager: newTracker[azfake.PagerResponder[armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse]](), + } +} + +// CertificateProfilesServerTransport connects instances of armtrustedsigning.CertificateProfilesClient to instances of CertificateProfilesServer. +// Don't use this type directly, use NewCertificateProfilesServerTransport instead. +type CertificateProfilesServerTransport struct { + srv *CertificateProfilesServer + beginCreate *tracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse]] + newListByCodeSigningAccountPager *tracker[azfake.PagerResponder[armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse]] +} + +// Do implements the policy.Transporter interface for CertificateProfilesServerTransport. +func (c *CertificateProfilesServerTransport) 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 "CertificateProfilesClient.BeginCreate": + resp, err = c.dispatchBeginCreate(req) + case "CertificateProfilesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CertificateProfilesClient.Get": + resp, err = c.dispatchGet(req) + case "CertificateProfilesClient.NewListByCodeSigningAccountPager": + resp, err = c.dispatchNewListByCodeSigningAccountPager(req) + case "CertificateProfilesClient.RevokeCertificate": + resp, err = c.dispatchRevokeCertificate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := c.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?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[armtrustedsigning.CertificateProfile](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + c.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) { + c.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) { + c.beginCreate.remove(req) + } + + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CertificateProfilesServerTransport) 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~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, 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).CertificateProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchNewListByCodeSigningAccountPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByCodeSigningAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCodeSigningAccountPager not implemented")} + } + newListByCodeSigningAccountPager := c.newListByCodeSigningAccountPager.get(req) + if newListByCodeSigningAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles` + 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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListByCodeSigningAccountPager(resourceGroupNameParam, accountNameParam, nil) + newListByCodeSigningAccountPager = &resp + c.newListByCodeSigningAccountPager.add(req, newListByCodeSigningAccountPager) + server.PagerResponderInjectNextLinks(newListByCodeSigningAccountPager, req, func(page *armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCodeSigningAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByCodeSigningAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCodeSigningAccountPager) { + c.newListByCodeSigningAccountPager.remove(req) + } + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchRevokeCertificate(req *http.Request) (*http.Response, error) { + if c.srv.RevokeCertificate == nil { + return nil, &nonRetriableError{errors.New("fake for method RevokeCertificate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revokeCertificate` + 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[armtrustedsigning.RevokeCertificate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.RevokeCertificate(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go new file mode 100644 index 000000000000..e2550284a034 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go @@ -0,0 +1,388 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/trustedsigning/armtrustedsigning" + "net/http" + "net/url" + "regexp" +) + +// CodeSigningAccountsServer is a fake server for instances of the armtrustedsigning.CodeSigningAccountsClient type. +type CodeSigningAccountsServer struct { + // CheckNameAvailability is the fake for method CodeSigningAccountsClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, body armtrustedsigning.CheckNameAvailability, options *armtrustedsigning.CodeSigningAccountsClientCheckNameAvailabilityOptions) (resp azfake.Responder[armtrustedsigning.CodeSigningAccountsClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + + // BeginCreate is the fake for method CodeSigningAccountsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, resource armtrustedsigning.CodeSigningAccount, options *armtrustedsigning.CodeSigningAccountsClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CodeSigningAccountsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, options *armtrustedsigning.CodeSigningAccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CodeSigningAccountsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, options *armtrustedsigning.CodeSigningAccountsClientGetOptions) (resp azfake.Responder[armtrustedsigning.CodeSigningAccountsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CodeSigningAccountsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armtrustedsigning.CodeSigningAccountsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CodeSigningAccountsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armtrustedsigning.CodeSigningAccountsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method CodeSigningAccountsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, properties armtrustedsigning.CodeSigningAccountPatch, options *armtrustedsigning.CodeSigningAccountsClientBeginUpdateOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCodeSigningAccountsServerTransport creates a new instance of CodeSigningAccountsServerTransport with the provided implementation. +// The returned CodeSigningAccountsServerTransport instance is connected to an instance of armtrustedsigning.CodeSigningAccountsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCodeSigningAccountsServerTransport(srv *CodeSigningAccountsServer) *CodeSigningAccountsServerTransport { + return &CodeSigningAccountsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientUpdateResponse]](), + } +} + +// CodeSigningAccountsServerTransport connects instances of armtrustedsigning.CodeSigningAccountsClient to instances of CodeSigningAccountsServer. +// Don't use this type directly, use NewCodeSigningAccountsServerTransport instead. +type CodeSigningAccountsServerTransport struct { + srv *CodeSigningAccountsServer + beginCreate *tracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CodeSigningAccountsServerTransport. +func (c *CodeSigningAccountsServerTransport) 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 "CodeSigningAccountsClient.CheckNameAvailability": + resp, err = c.dispatchCheckNameAvailability(req) + case "CodeSigningAccountsClient.BeginCreate": + resp, err = c.dispatchBeginCreate(req) + case "CodeSigningAccountsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CodeSigningAccountsClient.Get": + resp, err = c.dispatchGet(req) + case "CodeSigningAccountsClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CodeSigningAccountsClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CodeSigningAccountsClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if c.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/checkNameAvailability` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CheckNameAvailability](req) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CheckNameAvailability(req.Context(), 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).CheckNameAvailabilityResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := c.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?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[armtrustedsigning.CodeSigningAccount](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + c.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) { + c.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) { + c.beginCreate.remove(req) + } + + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{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)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) 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~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?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 + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, 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).CodeSigningAccount, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts` + 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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse, 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) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts` + 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 := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse, 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) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?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[armtrustedsigning.CodeSigningAccountPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.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) { + c.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) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/trustedsigning/armtrustedsigning/fake/operations_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go new file mode 100644 index 000000000000..7f4e7f3b79f0 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/trustedsigning/armtrustedsigning" + "net/http" +) + +// OperationsServer is a fake server for instances of the armtrustedsigning.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armtrustedsigning.OperationsClientListOptions) (resp azfake.PagerResponder[armtrustedsigning.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armtrustedsigning.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[armtrustedsigning.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armtrustedsigning.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armtrustedsigning.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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 *armtrustedsigning.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 +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/server_factory.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/server_factory.go new file mode 100644 index 000000000000..a650ea01eaaa --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/server_factory.go @@ -0,0 +1,89 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning.ClientFactory type. +type ServerFactory struct { + CertificateProfilesServer CertificateProfilesServer + CodeSigningAccountsServer CodeSigningAccountsServer + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armtrustedsigning.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 armtrustedsigning.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trCertificateProfilesServer *CertificateProfilesServerTransport + trCodeSigningAccountsServer *CodeSigningAccountsServerTransport + 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 "CertificateProfilesClient": + initServer(s, &s.trCertificateProfilesServer, func() *CertificateProfilesServerTransport { + return NewCertificateProfilesServerTransport(&s.srv.CertificateProfilesServer) + }) + resp, err = s.trCertificateProfilesServer.Do(req) + case "CodeSigningAccountsClient": + initServer(s, &s.trCodeSigningAccountsServer, func() *CodeSigningAccountsServerTransport { + return NewCodeSigningAccountsServerTransport(&s.srv.CodeSigningAccountsServer) + }) + resp, err = s.trCodeSigningAccountsServer.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/trustedsigning/armtrustedsigning/fake/time_rfc3339.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/trustedsigning/armtrustedsigning/go.mod b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod new file mode 100644 index 000000000000..d137c8da0e69 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go new file mode 100644 index 000000000000..d7331750e5ba --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go @@ -0,0 +1,317 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +import "time" + +// AccountSKU - SKU of the trusted signing account. +type AccountSKU struct { + // REQUIRED; Name of the SKU. + Name *SKUName +} + +// Certificate - Properties of the certificate. +type Certificate struct { + // Certificate created date. + CreatedDate *string + + // Certificate expiry date. + ExpiryDate *string + + // Revocations history of a certificate. + Revocation *Revocation + + // Serial number of the certificate. + SerialNumber *string + + // Status of the certificate. + Status *CertificateStatus + + // Subject name of the certificate. + SubjectName *string + + // Thumbprint of the certificate. + Thumbprint *string +} + +// CertificateProfile - Certificate profile resource. +type CertificateProfile struct { + // The resource-specific properties for this resource. + Properties *CertificateProfileProperties + + // 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 +} + +// CertificateProfileListResult - The response of a CertificateProfile list operation. +type CertificateProfileListResult struct { + // REQUIRED; The CertificateProfile items on this page + Value []*CertificateProfile + + // The link to the next page of items + NextLink *string +} + +// CertificateProfileProperties - Properties of the certificate profile. +type CertificateProfileProperties struct { + // REQUIRED; Profile type of the certificate. + ProfileType *ProfileType + + // Identity validation id used for the certificate subject name. + IdentityValidationID *string + + // Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types + IncludeCity *bool + + // Whether to include C in the certificate subject name. Applicable only for private trust, private trust ci profile types + IncludeCountry *bool + + // Whether to include PC in the certificate subject name. + IncludePostalCode *bool + + // Whether to include S in the certificate subject name. Applicable only for private trust, private trust ci profile types + IncludeState *bool + + // Whether to include STREET in the certificate subject name. + IncludeStreetAddress *bool + + // READ-ONLY; List of renewed certificates. + Certificates []*Certificate + + // READ-ONLY; Used as L in the certificate subject name. + City *string + + // READ-ONLY; Used as CN in the certificate subject name. + CommonName *string + + // READ-ONLY; Used as C in the certificate subject name. + Country *string + + // READ-ONLY; Enhanced key usage of the certificate. + EnhancedKeyUsage *string + + // READ-ONLY; Used as O in the certificate subject name. + Organization *string + + // READ-ONLY; Used as OU in the private trust certificate subject name. + OrganizationUnit *string + + // READ-ONLY; Used as PC in the certificate subject name. + PostalCode *string + + // READ-ONLY; Status of the current operation on certificate profile. + ProvisioningState *ProvisioningState + + // READ-ONLY; Used as S in the certificate subject name. + State *string + + // READ-ONLY; Status of the certificate profile. + Status *CertificateProfileStatus + + // READ-ONLY; Used as STREET in the certificate subject name. + StreetAddress *string +} + +// CheckNameAvailability - The parameters used to check the availability of the trusted signing account name. +type CheckNameAvailability struct { + // REQUIRED; Trusted signing account name. + Name *string +} + +// CheckNameAvailabilityResult - The CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + // READ-ONLY; An error message explaining the Reason value in more detail. + Message *string + + // READ-ONLY; A boolean value that indicates whether the name is available for you to use. If true, the name is available. + // If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool + + // READ-ONLY; The reason that a trusted signing account name could not be used. The Reason element is only returned if nameAvailable + // is false. + Reason *NameUnavailabilityReason +} + +// CodeSigningAccount - Trusted signing account resource. +type CodeSigningAccount struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CodeSigningAccountProperties + + // 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 +} + +// CodeSigningAccountListResult - The response of a CodeSigningAccount list operation. +type CodeSigningAccountListResult struct { + // REQUIRED; The CodeSigningAccount items on this page + Value []*CodeSigningAccount + + // The link to the next page of items + NextLink *string +} + +// CodeSigningAccountPatch - Parameters for creating or updating a trusted signing account. +type CodeSigningAccountPatch struct { + // Properties of the trusted signing account. + Properties *CodeSigningAccountPatchProperties + + // Resource tags. + Tags map[string]*string +} + +// CodeSigningAccountPatchProperties - Properties of the trusted signing account. +type CodeSigningAccountPatchProperties struct { + // SKU of the trusted signing account. + SKU *AccountSKU +} + +// CodeSigningAccountProperties - Properties of the trusted signing account. +type CodeSigningAccountProperties struct { + // SKU of the trusted signing account. + SKU *AccountSKU + + // READ-ONLY; The URI of the trusted signing account which is used during signing files. + AccountURI *string + + // READ-ONLY; Status of the current operation on trusted signing account. + ProvisioningState *ProvisioningState +} + +// 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 +} + +// Revocation details of the certificate. +type Revocation struct { + // The timestamp when the revocation is effective. + EffectiveAt *time.Time + + // Reason for the revocation failure. + FailureReason *string + + // Reason for revocation. + Reason *string + + // Remarks for the revocation. + Remarks *string + + // The timestamp when the revocation is requested. + RequestedAt *time.Time + + // READ-ONLY; Status of the revocation. + Status *RevocationStatus +} + +// RevokeCertificate - Defines the certificate revocation properties. +type RevokeCertificate struct { + // REQUIRED; The timestamp when the revocation is effective. + EffectiveAt *time.Time + + // REQUIRED; Reason for the revocation. + Reason *string + + // REQUIRED; Serial number of the certificate. + SerialNumber *string + + // REQUIRED; Thumbprint of the certificate. + Thumbprint *string + + // Remarks for the revocation. + Remarks *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 +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go new file mode 100644 index 000000000000..6c74475d63b2 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go @@ -0,0 +1,774 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccountSKU. +func (a AccountSKU) 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 AccountSKU. +func (a *AccountSKU) UnmarshalJSON(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 Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdDate", c.CreatedDate) + populate(objectMap, "expiryDate", c.ExpiryDate) + populate(objectMap, "revocation", c.Revocation) + populate(objectMap, "serialNumber", c.SerialNumber) + populate(objectMap, "status", c.Status) + populate(objectMap, "subjectName", c.SubjectName) + populate(objectMap, "thumbprint", c.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. +func (c *Certificate) UnmarshalJSON(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 "createdDate": + err = unpopulate(val, "CreatedDate", &c.CreatedDate) + delete(rawMsg, key) + case "expiryDate": + err = unpopulate(val, "ExpiryDate", &c.ExpiryDate) + delete(rawMsg, key) + case "revocation": + err = unpopulate(val, "Revocation", &c.Revocation) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &c.SerialNumber) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, "SubjectName", &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + 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 CertificateProfile. +func (c CertificateProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProfile. +func (c *CertificateProfile) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + 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 CertificateProfileListResult. +func (c CertificateProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProfileListResult. +func (c *CertificateProfileListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 CertificateProfileProperties. +func (c CertificateProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificates", c.Certificates) + populate(objectMap, "city", c.City) + populate(objectMap, "commonName", c.CommonName) + populate(objectMap, "country", c.Country) + populate(objectMap, "enhancedKeyUsage", c.EnhancedKeyUsage) + populate(objectMap, "identityValidationId", c.IdentityValidationID) + populate(objectMap, "includeCity", c.IncludeCity) + populate(objectMap, "includeCountry", c.IncludeCountry) + populate(objectMap, "includePostalCode", c.IncludePostalCode) + populate(objectMap, "includeState", c.IncludeState) + populate(objectMap, "includeStreetAddress", c.IncludeStreetAddress) + populate(objectMap, "organization", c.Organization) + populate(objectMap, "organizationUnit", c.OrganizationUnit) + populate(objectMap, "postalCode", c.PostalCode) + populate(objectMap, "profileType", c.ProfileType) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "state", c.State) + populate(objectMap, "status", c.Status) + populate(objectMap, "streetAddress", c.StreetAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProfileProperties. +func (c *CertificateProfileProperties) UnmarshalJSON(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 "certificates": + err = unpopulate(val, "Certificates", &c.Certificates) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &c.City) + delete(rawMsg, key) + case "commonName": + err = unpopulate(val, "CommonName", &c.CommonName) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &c.Country) + delete(rawMsg, key) + case "enhancedKeyUsage": + err = unpopulate(val, "EnhancedKeyUsage", &c.EnhancedKeyUsage) + delete(rawMsg, key) + case "identityValidationId": + err = unpopulate(val, "IdentityValidationID", &c.IdentityValidationID) + delete(rawMsg, key) + case "includeCity": + err = unpopulate(val, "IncludeCity", &c.IncludeCity) + delete(rawMsg, key) + case "includeCountry": + err = unpopulate(val, "IncludeCountry", &c.IncludeCountry) + delete(rawMsg, key) + case "includePostalCode": + err = unpopulate(val, "IncludePostalCode", &c.IncludePostalCode) + delete(rawMsg, key) + case "includeState": + err = unpopulate(val, "IncludeState", &c.IncludeState) + delete(rawMsg, key) + case "includeStreetAddress": + err = unpopulate(val, "IncludeStreetAddress", &c.IncludeStreetAddress) + delete(rawMsg, key) + case "organization": + err = unpopulate(val, "Organization", &c.Organization) + delete(rawMsg, key) + case "organizationUnit": + err = unpopulate(val, "OrganizationUnit", &c.OrganizationUnit) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &c.PostalCode) + delete(rawMsg, key) + case "profileType": + err = unpopulate(val, "ProfileType", &c.ProfileType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "streetAddress": + err = unpopulate(val, "StreetAddress", &c.StreetAddress) + 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 CheckNameAvailability. +func (c CheckNameAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailability. +func (c *CheckNameAvailability) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 CodeSigningAccount. +func (c CodeSigningAccount) 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) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccount. +func (c *CodeSigningAccount) UnmarshalJSON(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 "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) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CodeSigningAccountListResult. +func (c CodeSigningAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountListResult. +func (c *CodeSigningAccountListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 CodeSigningAccountPatch. +func (c CodeSigningAccountPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountPatch. +func (c *CodeSigningAccountPatch) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CodeSigningAccountPatchProperties. +func (c CodeSigningAccountPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountPatchProperties. +func (c *CodeSigningAccountPatchProperties) UnmarshalJSON(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 "sku": + err = unpopulate(val, "SKU", &c.SKU) + 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 CodeSigningAccountProperties. +func (c CodeSigningAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountUri", c.AccountURI) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountProperties. +func (c *CodeSigningAccountProperties) UnmarshalJSON(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 "accountUri": + err = unpopulate(val, "AccountURI", &c.AccountURI) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + 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 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 Revocation. +func (r Revocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "effectiveAt", r.EffectiveAt) + populate(objectMap, "failureReason", r.FailureReason) + populate(objectMap, "reason", r.Reason) + populate(objectMap, "remarks", r.Remarks) + populateDateTimeRFC3339(objectMap, "requestedAt", r.RequestedAt) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Revocation. +func (r *Revocation) UnmarshalJSON(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 "effectiveAt": + err = unpopulateDateTimeRFC3339(val, "EffectiveAt", &r.EffectiveAt) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, "FailureReason", &r.FailureReason) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + delete(rawMsg, key) + case "remarks": + err = unpopulate(val, "Remarks", &r.Remarks) + delete(rawMsg, key) + case "requestedAt": + err = unpopulateDateTimeRFC3339(val, "RequestedAt", &r.RequestedAt) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + 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 RevokeCertificate. +func (r RevokeCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "effectiveAt", r.EffectiveAt) + populate(objectMap, "reason", r.Reason) + populate(objectMap, "remarks", r.Remarks) + populate(objectMap, "serialNumber", r.SerialNumber) + populate(objectMap, "thumbprint", r.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RevokeCertificate. +func (r *RevokeCertificate) UnmarshalJSON(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 "effectiveAt": + err = unpopulateDateTimeRFC3339(val, "EffectiveAt", &r.EffectiveAt) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + delete(rawMsg, key) + case "remarks": + err = unpopulate(val, "Remarks", &r.Remarks) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &r.SerialNumber) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &r.Thumbprint) + 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 +} + +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/trustedsigning/armtrustedsigning/operations_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go new file mode 100644 index 000000000000..cf33777f6f62 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +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-02-05-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.CodeSigning/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-02-05-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/trustedsigning/armtrustedsigning/options.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/options.go new file mode 100644 index 000000000000..202f9b6928a4 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/options.go @@ -0,0 +1,89 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +// CertificateProfilesClientBeginCreateOptions contains the optional parameters for the CertificateProfilesClient.BeginCreate +// method. +type CertificateProfilesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateProfilesClientBeginDeleteOptions contains the optional parameters for the CertificateProfilesClient.BeginDelete +// method. +type CertificateProfilesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateProfilesClientGetOptions contains the optional parameters for the CertificateProfilesClient.Get method. +type CertificateProfilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificateProfilesClientListByCodeSigningAccountOptions contains the optional parameters for the CertificateProfilesClient.NewListByCodeSigningAccountPager +// method. +type CertificateProfilesClientListByCodeSigningAccountOptions struct { + // placeholder for future optional parameters +} + +// CertificateProfilesClientRevokeCertificateOptions contains the optional parameters for the CertificateProfilesClient.RevokeCertificate +// method. +type CertificateProfilesClientRevokeCertificateOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientBeginCreateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginCreate +// method. +type CodeSigningAccountsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CodeSigningAccountsClientBeginDeleteOptions contains the optional parameters for the CodeSigningAccountsClient.BeginDelete +// method. +type CodeSigningAccountsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CodeSigningAccountsClientBeginUpdateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginUpdate +// method. +type CodeSigningAccountsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CodeSigningAccountsClientCheckNameAvailabilityOptions contains the optional parameters for the CodeSigningAccountsClient.CheckNameAvailability +// method. +type CodeSigningAccountsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientGetOptions contains the optional parameters for the CodeSigningAccountsClient.Get method. +type CodeSigningAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientListByResourceGroupOptions contains the optional parameters for the CodeSigningAccountsClient.NewListByResourceGroupPager +// method. +type CodeSigningAccountsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientListBySubscriptionOptions contains the optional parameters for the CodeSigningAccountsClient.NewListBySubscriptionPager +// method. +type CodeSigningAccountsClientListBySubscriptionOptions 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/trustedsigning/armtrustedsigning/responses.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/responses.go new file mode 100644 index 000000000000..951a06e1fcf0 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/responses.go @@ -0,0 +1,84 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +// CertificateProfilesClientCreateResponse contains the response from method CertificateProfilesClient.BeginCreate. +type CertificateProfilesClientCreateResponse struct { + // Certificate profile resource. + CertificateProfile +} + +// CertificateProfilesClientDeleteResponse contains the response from method CertificateProfilesClient.BeginDelete. +type CertificateProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// CertificateProfilesClientGetResponse contains the response from method CertificateProfilesClient.Get. +type CertificateProfilesClientGetResponse struct { + // Certificate profile resource. + CertificateProfile +} + +// CertificateProfilesClientListByCodeSigningAccountResponse contains the response from method CertificateProfilesClient.NewListByCodeSigningAccountPager. +type CertificateProfilesClientListByCodeSigningAccountResponse struct { + // The response of a CertificateProfile list operation. + CertificateProfileListResult +} + +// CertificateProfilesClientRevokeCertificateResponse contains the response from method CertificateProfilesClient.RevokeCertificate. +type CertificateProfilesClientRevokeCertificateResponse struct { + // placeholder for future response values +} + +// CodeSigningAccountsClientCheckNameAvailabilityResponse contains the response from method CodeSigningAccountsClient.CheckNameAvailability. +type CodeSigningAccountsClientCheckNameAvailabilityResponse struct { + // The CheckNameAvailability operation response. + CheckNameAvailabilityResult +} + +// CodeSigningAccountsClientCreateResponse contains the response from method CodeSigningAccountsClient.BeginCreate. +type CodeSigningAccountsClientCreateResponse struct { + // Trusted signing account resource. + CodeSigningAccount +} + +// CodeSigningAccountsClientDeleteResponse contains the response from method CodeSigningAccountsClient.BeginDelete. +type CodeSigningAccountsClientDeleteResponse struct { + // placeholder for future response values +} + +// CodeSigningAccountsClientGetResponse contains the response from method CodeSigningAccountsClient.Get. +type CodeSigningAccountsClientGetResponse struct { + // Trusted signing account resource. + CodeSigningAccount +} + +// CodeSigningAccountsClientListByResourceGroupResponse contains the response from method CodeSigningAccountsClient.NewListByResourceGroupPager. +type CodeSigningAccountsClientListByResourceGroupResponse struct { + // The response of a CodeSigningAccount list operation. + CodeSigningAccountListResult +} + +// CodeSigningAccountsClientListBySubscriptionResponse contains the response from method CodeSigningAccountsClient.NewListBySubscriptionPager. +type CodeSigningAccountsClientListBySubscriptionResponse struct { + // The response of a CodeSigningAccount list operation. + CodeSigningAccountListResult +} + +// CodeSigningAccountsClientUpdateResponse contains the response from method CodeSigningAccountsClient.BeginUpdate. +type CodeSigningAccountsClientUpdateResponse struct { + // Trusted signing account resource. + CodeSigningAccount +} + +// 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/trustedsigning/armtrustedsigning/time_rfc3339.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/time_rfc3339.go new file mode 100644 index 000000000000..951e2e2112be --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 armtrustedsigning + +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/verifiedid/armverifiedid/CHANGELOG.md b/sdk/resourcemanager/verifiedid/armverifiedid/CHANGELOG.md new file mode 100644 index 000000000000..fdb3057f60d8 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### 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..3cf519fe3a02 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/README.md @@ -0,0 +1,92 @@ +# Azure Verifiedid Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid) + +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..a38796774122 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/authorities_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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, options *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, options *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, options *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, options *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, options *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, options *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..87af2c16b59b --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/ci.yml @@ -0,0 +1,28 @@ +# 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: + IncludeRelease: true + 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..3a4a875bf3eb --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/client_factory.go @@ -0,0 +1,52 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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..29633389c828 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/constants.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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..0f2ac4f5db8c --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/authorities_server.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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")} + } + + var resp *http.Response + var err error + + switch method { + case "AuthoritiesClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AuthoritiesClient.Delete": + resp, err = a.dispatchDelete(req) + case "AuthoritiesClient.Get": + resp, err = a.dispatchGet(req) + case "AuthoritiesClient.NewListByResourceGroupPager": + resp, err = a.dispatchNewListByResourceGroupPager(req) + case "AuthoritiesClient.NewListBySubscriptionPager": + resp, err = a.dispatchNewListBySubscriptionPager(req) + case "AuthoritiesClient.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 *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 +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/fake/internal.go b/sdk/resourcemanager/verifiedid/armverifiedid/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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..e3ee9a5be4f6 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 +} 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..dfd2a8d8bc49 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/server_factory.go @@ -0,0 +1,80 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 AuthoritiesServer + 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/fake/time_rfc3339.go b/sdk/resourcemanager/verifiedid/armverifiedid/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/verifiedid/armverifiedid/go.mod b/sdk/resourcemanager/verifiedid/armverifiedid/go.mod new file mode 100644 index 000000000000..904f98341e95 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/go.sum b/sdk/resourcemanager/verifiedid/armverifiedid/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/models.go b/sdk/resourcemanager/verifiedid/armverifiedid/models.go new file mode 100644 index 000000000000..71bf309ab3ee --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/models.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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..37bc043cc900 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/models_serde.go @@ -0,0 +1,332 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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..c1e9305326a2 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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, options *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..2d4946668332 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/options.go @@ -0,0 +1,48 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 LRO 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..6e6a98633bd0 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/responses.go @@ -0,0 +1,50 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/verifiedid/armverifiedid/time_rfc3339.go b/sdk/resourcemanager/verifiedid/armverifiedid/time_rfc3339.go new file mode 100644 index 000000000000..32f30004cfc5 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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" + "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/workloads/armworkloads/CHANGELOG.md b/sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md index ce60c0b6463f..1f0a161a1511 100644 --- a/sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md +++ b/sdk/resourcemanager/workloads/armworkloads/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.1 (2024-08-09) +### Other Changes + + ## 1.1.0 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/workloads/armworkloads/README.md b/sdk/resourcemanager/workloads/armworkloads/README.md index 7481ac64e879..f70b826e60b2 100644 --- a/sdk/resourcemanager/workloads/armworkloads/README.md +++ b/sdk/resourcemanager/workloads/armworkloads/README.md @@ -57,7 +57,7 @@ clientFactory, err := armworkloads.NewClientFactory(, cred, &op 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.NewProviderInstancesClient() +client := clientFactory.NewClient() ``` ## Fakes diff --git a/sdk/resourcemanager/workloads/armworkloads/autorest.md b/sdk/resourcemanager/workloads/armworkloads/autorest.md index 9927d696b5ea..7c48666e6a98 100644 --- a/sdk/resourcemanager/workloads/armworkloads/autorest.md +++ b/sdk/resourcemanager/workloads/armworkloads/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 1.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/armworkloads/client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/client_example_test.go deleted file mode 100644 index 3b7d04d4ab5c..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/client_example_test.go +++ /dev/null @@ -1,1194 +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 armworkloads_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json -func ExampleClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSizingRecommendations(ctx, "centralus", &armworkloads.ClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloads.ClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloads.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](2), - // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](1), - // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](1), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json -func ExampleClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributedHaAvSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSizingRecommendations(ctx, "centralus", &armworkloads.ClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloads.ClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloads.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](3), - // ApplicationServerVMSKU: to.Ptr("Standard_E16ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](2), - // CentralServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](2), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json -func ExampleClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributedHaAvZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSizingRecommendations(ctx, "centralus", &armworkloads.ClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloads.ClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloads.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](6), - // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](2), - // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](2), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json -func ExampleClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaSingleServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSizingRecommendations(ctx, "centralus", &armworkloads.ClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloads.ClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloads.SingleServerRecommendationResult{ - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json -func ExampleClient_SAPSupportedSKU_sapSupportedSkusDistributed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSupportedSKU(ctx, "centralus", &armworkloads.ClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloads.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloads.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E4ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E8ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E16ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E20ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json -func ExampleClient_SAPSupportedSKU_sapSupportedSkusDistributedHaAvSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSupportedSKU(ctx, "centralus", &armworkloads.ClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloads.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloads.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E4ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E8ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E16ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E20ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json -func ExampleClient_SAPSupportedSKU_sapSupportedSkusDistributedHaAvZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSupportedSKU(ctx, "centralus", &armworkloads.ClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloads.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloads.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json -func ExampleClient_SAPSupportedSKU_sapSupportedSkusSingleServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPSupportedSKU(ctx, "centralus", &armworkloads.ClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloads.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloads.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json -func ExampleClient_SAPDiskConfigurations_sapDiskConfigurationsNonProd() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPDiskConfigurations(ctx, "centralus", &armworkloads.ClientSAPDiskConfigurationsOptions{SAPDiskConfigurations: 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.SAPDiskConfigurationsResult = armworkloads.SAPDiskConfigurationsResult{ - // VolumeConfigurations: map[string]*armworkloads.SAPDiskConfiguration{ - // "backup": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("E10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/data": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/log": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/shared": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P30"), - // IopsReadWrite: to.Ptr[int64](5000), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](200), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P40"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P50"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E30"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E40"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E50"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // "os": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](240), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](50), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // "usr/sap": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json -func ExampleClient_SAPDiskConfigurations_sapDiskConfigurationsProd() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPDiskConfigurations(ctx, "centralus", &armworkloads.ClientSAPDiskConfigurationsOptions{SAPDiskConfigurations: 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.SAPDiskConfigurationsResult = armworkloads.SAPDiskConfigurationsResult{ - // VolumeConfigurations: map[string]*armworkloads.SAPDiskConfiguration{ - // "backup": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/data": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/log": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/shared": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P30"), - // IopsReadWrite: to.Ptr[int64](5000), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](200), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P40"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P50"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "os": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](240), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](50), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "usr/sap": &armworkloads.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloads.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json -func ExampleClient_SAPAvailabilityZoneDetails_sapAvailabilityZoneDetailsEastus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPAvailabilityZoneDetails(ctx, "centralus", &armworkloads.ClientSAPAvailabilityZoneDetailsOptions{SAPAvailabilityZoneDetails: 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.SAPAvailabilityZoneDetailsResult = armworkloads.SAPAvailabilityZoneDetailsResult{ - // AvailabilityZonePairs: []*armworkloads.SAPAvailabilityZonePair{ - // { - // ZoneA: to.Ptr[int64](1), - // ZoneB: to.Ptr[int64](2), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json -func ExampleClient_SAPAvailabilityZoneDetails_sapAvailabilityZoneDetailsNortheurope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().SAPAvailabilityZoneDetails(ctx, "centralus", &armworkloads.ClientSAPAvailabilityZoneDetailsOptions{SAPAvailabilityZoneDetails: 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.SAPAvailabilityZoneDetailsResult = armworkloads.SAPAvailabilityZoneDetailsResult{ - // AvailabilityZonePairs: []*armworkloads.SAPAvailabilityZonePair{ - // { - // ZoneA: to.Ptr[int64](2), - // ZoneB: to.Ptr[int64](3), - // }}, - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/client_factory.go b/sdk/resourcemanager/workloads/armworkloads/client_factory.go index b7ea672e3e2a..3a76a21bb728 100644 --- a/sdk/resourcemanager/workloads/armworkloads/client_factory.go +++ b/sdk/resourcemanager/workloads/armworkloads/client_factory.go @@ -17,8 +17,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,66 +26,83 @@ 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 } // NewClient creates a new instance of Client. func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) - return subClient + return &Client{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMonitorsClient creates a new instance of MonitorsClient. func (c *ClientFactory) NewMonitorsClient() *MonitorsClient { - subClient, _ := NewMonitorsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MonitorsClient{ + 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, + } } // NewProviderInstancesClient creates a new instance of ProviderInstancesClient. func (c *ClientFactory) NewProviderInstancesClient() *ProviderInstancesClient { - subClient, _ := NewProviderInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ProviderInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSAPApplicationServerInstancesClient creates a new instance of SAPApplicationServerInstancesClient. func (c *ClientFactory) NewSAPApplicationServerInstancesClient() *SAPApplicationServerInstancesClient { - subClient, _ := NewSAPApplicationServerInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SAPApplicationServerInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSAPCentralInstancesClient creates a new instance of SAPCentralInstancesClient. func (c *ClientFactory) NewSAPCentralInstancesClient() *SAPCentralInstancesClient { - subClient, _ := NewSAPCentralInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SAPCentralInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSAPDatabaseInstancesClient creates a new instance of SAPDatabaseInstancesClient. func (c *ClientFactory) NewSAPDatabaseInstancesClient() *SAPDatabaseInstancesClient { - subClient, _ := NewSAPDatabaseInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SAPDatabaseInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSAPVirtualInstancesClient creates a new instance of SAPVirtualInstancesClient. func (c *ClientFactory) NewSAPVirtualInstancesClient() *SAPVirtualInstancesClient { - subClient, _ := NewSAPVirtualInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SAPVirtualInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSapLandscapeMonitorClient creates a new instance of SapLandscapeMonitorClient. func (c *ClientFactory) NewSapLandscapeMonitorClient() *SapLandscapeMonitorClient { - subClient, _ := NewSapLandscapeMonitorClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SapLandscapeMonitorClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/workloads/armworkloads/constants.go b/sdk/resourcemanager/workloads/armworkloads/constants.go index 15927acdac21..0a00686a32b0 100644 --- a/sdk/resourcemanager/workloads/armworkloads/constants.go +++ b/sdk/resourcemanager/workloads/armworkloads/constants.go @@ -10,7 +10,7 @@ package armworkloads const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads" - moduleVersion = "v1.1.0" + moduleVersion = "v1.1.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/workloads/armworkloads/fake/time_rfc3339.go b/sdk/resourcemanager/workloads/armworkloads/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/workloads/armworkloads/fake/time_rfc3339.go +++ b/sdk/resourcemanager/workloads/armworkloads/fake/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/workloads/armworkloads/go.mod b/sdk/resourcemanager/workloads/armworkloads/go.mod index ae5deded1111..64e127e8327d 100644 --- a/sdk/resourcemanager/workloads/armworkloads/go.mod +++ b/sdk/resourcemanager/workloads/armworkloads/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworklo go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // 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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/workloads/armworkloads/go.sum b/sdk/resourcemanager/workloads/armworkloads/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/workloads/armworkloads/go.sum +++ b/sdk/resourcemanager/workloads/armworkloads/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/workloads/armworkloads/models_serde.go b/sdk/resourcemanager/workloads/armworkloads/models_serde.go index 9242dbfa92b4..7ad1e5896573 100644 --- a/sdk/resourcemanager/workloads/armworkloads/models_serde.go +++ b/sdk/resourcemanager/workloads/armworkloads/models_serde.go @@ -5107,7 +5107,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/workloads/armworkloads/monitors_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/monitors_client_example_test.go deleted file mode 100644 index bf3ba30d27ca..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/monitors_client_example_test.go +++ /dev/null @@ -1,444 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_List.json -func ExampleMonitorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMonitorsClient().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.MonitorListResult = armworkloads.MonitorListResult{ - // Value: []*armworkloads.Monitor{ - // { - // Name: to.Ptr("mySapMonitor1"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("eastus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg1"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // ZoneRedundancyPreference: to.Ptr("ZoneRedundantApp"), - // }, - // }, - // { - // Name: to.Ptr("mySapMonitor2"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("westus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg2"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceDefault), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_ListByRG.json -func ExampleMonitorsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMonitorsClient().NewListByResourceGroupPager("example-rg", 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.MonitorListResult = armworkloads.MonitorListResult{ - // Value: []*armworkloads.Monitor{ - // { - // Name: to.Ptr("mySapMonitor1"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Workloads/monitors/mySapMonitor1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("eastus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/example-rg/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg1"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // ZoneRedundancyPreference: to.Ptr("ZoneRedundantApp"), - // }, - // }, - // { - // Name: to.Ptr("mySapMonitor2"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Workloads/monitors/mySapMonitor2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("westus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/example-rg/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg2"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceDefault), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_Get.json -func ExampleMonitorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMonitorsClient().Get(ctx, "myResourceGroup", "mySapMonitor", 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.Monitor = armworkloads.Monitor{ - // Name: to.Ptr("mySapMonitor1"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("eastus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // ZoneRedundancyPreference: to.Ptr("ZoneRedundantApp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_Create.json -func ExampleMonitorsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMonitorsClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", armworkloads.Monitor{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armworkloads.MonitorProperties{ - AppLocation: to.Ptr("westus"), - LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - Name: to.Ptr("myManagedRg"), - }, - MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - }, - }, 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.Monitor = armworkloads.Monitor{ - // Name: to.Ptr("mySapMonitor"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("eastus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // ZoneRedundancyPreference: to.Ptr("ZoneRedundantApp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_Delete.json -func ExampleMonitorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMonitorsClient().BeginDelete(ctx, "myResourceGroup", "mySapMonitor", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0f"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/operations/locations/westus/1e4193c3-206e-4916-b124-1da16175eb0f"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_PatchTags_Delete.json -func ExampleMonitorsClient_Update_deleteTagsFieldOfASapMonitor() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMonitorsClient().Update(ctx, "myResourceGroup", "mySapMonitor", armworkloads.UpdateMonitorRequest{ - Identity: &armworkloads.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloads.ManagedServiceIdentityTypeNone), - }, - 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.Monitor = armworkloads.Monitor{ - // Name: to.Ptr("mySapMonitor"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Identity: &armworkloads.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloads.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("eastus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // ZoneRedundancyPreference: to.Ptr("ZoneRedundantApp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/monitors_PatchTags.json -func ExampleMonitorsClient_Update_updateTagsFieldOfASapMonitor() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMonitorsClient().Update(ctx, "myResourceGroup", "mySapMonitor", armworkloads.UpdateMonitorRequest{ - Identity: &armworkloads.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloads.ManagedServiceIdentityTypeNone), - }, - Tags: map[string]*string{ - "testkey": to.Ptr("testvalue"), - }, - }, 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.Monitor = armworkloads.Monitor{ - // Name: to.Ptr("mySapMonitor"), - // Type: to.Ptr("Microsoft.Workloads/monitors"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Identity: &armworkloads.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloads.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloads.MonitorProperties{ - // AppLocation: to.Ptr("eastus"), - // Errors: &armworkloads.MonitorPropertiesErrors{ - // }, - // LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("myManagedRg"), - // }, - // MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"), - // MsiArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myMsi"), - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // RoutingPreference: to.Ptr(armworkloads.RoutingPreferenceRouteAll), - // StorageAccountArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"), - // ZoneRedundancyPreference: to.Ptr("ZoneRedundantApp"), - // }, - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/operations_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/operations_client_example_test.go deleted file mode 100644 index 36214640dd7c..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/operations_client_example_test.go +++ /dev/null @@ -1,856 +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 armworkloads_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-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 := armworkloads.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 = armworkloads.OperationListResult{ - // Value: []*armworkloads.Operation{ - // { - // Name: to.Ptr("Microsoft.Workloads/RegisteredSubscriptions/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Reads registered subscriptions"), - // Operation: to.Ptr("Gets/Lists registered subscriptions"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("RegisteredSubscriptions"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists WordpressInstances resources under a phpWorkload resource"), - // Operation: to.Ptr("WordpressInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads/wordpressInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a WordpressInstances resource"), - // Operation: to.Ptr("WordpressInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads/wordpressInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Create or updated WordpressInstances resource"), - // Operation: to.Ptr("WordpressInstances_CreateOrUpdate"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads/wordpressInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Delete WordpressInstances resource"), - // Operation: to.Ptr("WordpressInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads/wordpressInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/skus/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets the list of Microsoft.Workloads SKUs available for your Subscription"), - // Operation: to.Ptr("Gets the list of Microsoft.Workloads SKUs available for your Subscription"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("Skus"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/Operations/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("read Operations"), - // Operation: to.Ptr("read_Operations"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/register/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Register the subscription for Microsoft.Workloads"), - // Operation: to.Ptr("Register the Microsoft.Workloads"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("Microsoft.Workloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/unregister/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Unregister the subscription for Microsoft.Workloads"), - // Operation: to.Ptr("Unregister the Microsoft.Workloads"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("Microsoft.Workloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/Locations/OperationStatuses/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("read OperationStatuses"), - // Operation: to.Ptr("read_OperationStatuses"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("Locations/OperationStatuses"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/Locations/OperationStatuses/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("write OperationStatuses"), - // Operation: to.Ptr("write_OperationStatuses"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("Locations/OperationStatuses"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists phpWorkload resources in a subscription"), - // Operation: to.Ptr("PhpWorkloads_ListBySubscription"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists phpWorkload resources in a resource group"), - // Operation: to.Ptr("PhpWorkloads_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a phpWorkload resource"), - // Operation: to.Ptr("PhpWorkloads_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Create or updated phpWorkloads resource"), - // Operation: to.Ptr("PhpWorkloads_CreateOrUpdate"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Delete phpWorkloads resource"), - // Operation: to.Ptr("PhpWorkloads_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Update PHP workload resource."), - // Operation: to.Ptr("PhpWorkloads_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("phpWorkloads"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets the SAP Application Server Instance."), - // Operation: to.Ptr("SAPApplicationServerInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Puts the SAP Application Server Instance."), - // Operation: to.Ptr("SAPApplicationServerInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes the SAP Application Server Instance.

This operation will be used by service only. Delete by end user will return a Bad Request error."), - // Operation: to.Ptr("SAPApplicationServerInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Puts the SAP Application Server Instance."), - // Operation: to.Ptr("SAPApplicationServerInstances_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists the SAP Application server Instances in an SVI."), - // Operation: to.Ptr("SAPApplicationServerInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/start/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Starts the SAP Application server Instance in an SVI."), - // Operation: to.Ptr("SAPApplicationServerInstances_StartInstance"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/stop/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Stops the SAP Application server Instance in an SVI."), - // Operation: to.Ptr("SAPApplicationServerInstances_StopInstance"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets the SAP Central Instance."), - // Operation: to.Ptr("SAPCentralInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Puts the SAP Central Instance.

This will be used by service only. PUT by end user will return a Bad Request error."), - // Operation: to.Ptr("SAPCentralInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes the SAP Central Instance.

This will be used by service only. Delete by end user will return a Bad Request error."), - // Operation: to.Ptr("SAPCentralInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Updates the SAP Central Instance.

This can be used to update tags."), - // Operation: to.Ptr("SAPCentralInstances_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists the SAP Central Instances in an SVI."), - // Operation: to.Ptr("SAPCentralInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/start/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Starts the SAP Central server Instance in an SVI."), - // Operation: to.Ptr("SAPCentralInstances_StartInstance"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/stop/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Stops the SAP Central server Instance in an SVI."), - // Operation: to.Ptr("SAPCentralInstances_StopInstance"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/centralInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets the SAP Database Instance."), - // Operation: to.Ptr("SAPDatabaseInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Puts the SAP Database Instance."), - // Operation: to.Ptr("SAPDatabaseInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes the SAP Database Instance.

This will be used by service only. Delete by end user will return a Bad Request error."), - // Operation: to.Ptr("SAPDatabaseInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Puts the SAP Database Instance."), - // Operation: to.Ptr("SAPDatabaseInstances_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists the SAP Database Instances in an SVI."), - // Operation: to.Ptr("SAPDatabaseInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/start/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Starts the database instance of the SAP system."), - // Operation: to.Ptr("SAPDatabaseInstances_StartInstance"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/stop/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Stops the database instance of the SAP system."), - // Operation: to.Ptr("SAPDatabaseInstances_StopInstance"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor."), - // Operation: to.Ptr("monitors_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified resource group."), - // Operation: to.Ptr("monitors_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP monitor with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each provider instances."), - // Operation: to.Ptr("ProviderInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a list of properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP Landscape monitor configuration with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("SapLandscapeMonitor_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets an SAP Virtual Instance."), - // Operation: to.Ptr("SAPVirtualInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates an SAP Virtual Instance."), - // Operation: to.Ptr("SAPVirtualInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes an SAP Virtual Instance."), - // Operation: to.Ptr("SAPVirtualInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Updates an SAP Virtual Instance."), - // Operation: to.Ptr("SAPVirtualInstances_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets all SAP Virtual Instances in a resource group."), - // Operation: to.Ptr("SAPVirtualInstances_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets all SAP Virtual Instances in the subscription."), - // Operation: to.Ptr("SAPVirtualInstances_ListBySubscription"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/start/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Starts the SAP System."), - // Operation: to.Ptr("SAPVirtualInstances_Start"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/stop/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Stops the SAP System."), - // Operation: to.Ptr("SAPVirtualInstances_Stop"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("sapVirtualInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getSizingRecommendations/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Get SAP sizing recommendations."), - // Operation: to.Ptr("SAPSizingRecommendations"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getSapSupportedSku/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Get SAP supported SKUs."), - // Operation: to.Ptr("SAPSupportedSku"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getDiskConfigurations/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Get SAP Disk Configurations."), - // Operation: to.Ptr("SAPDiskConfigurations"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getAvailabilityZoneDetails/action"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Get SAP Availability Zone Details."), - // Operation: to.Ptr("SAPAvailabilityZoneDetails"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a connector resource"), - // Operation: to.Ptr("Connectors_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates a connector resource"), - // Operation: to.Ptr("Connectors_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes a connector resource and its child resources, which are the associated connection resources. All the child resources have to be deleted before deleting the connector resource."), - // Operation: to.Ptr("Connectors_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Updates a connector resource"), - // Operation: to.Ptr("Connectors_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets all connector resources in a Resource Group."), - // Operation: to.Ptr("Connectors_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets all connector resources in a Subscription."), - // Operation: to.Ptr("Connectors_ListBySubscription"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets the backup connection resource of virtual instance for SAP."), - // Operation: to.Ptr("ACSSBackupConnections_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors/acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates the backup connection resource of virtual instance for SAP."), - // Operation: to.Ptr("ACSSBackupConnections_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors/acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes the backup connection resource of virtual instance for SAP."), - // Operation: to.Ptr("ACSSBackupConnections_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors/acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Updates the backup connection resource of virtual instance for SAP.

This can be used to update tags on the resource."), - // Operation: to.Ptr("ACSSBackupConnections_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors/acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Lists the backup connection resources of virtual instance for SAP under the given connector resource."), - // Operation: to.Ptr("ACSSBackupConnections_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors/acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/insights/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets properties of Workloads Insights instance for the specified subscription, resource group and instance name."), - // Operation: to.Ptr("Insights_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("insights"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/insights/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a list of Workloads Insight instances in the specified subscription and resource group. The operations returns various properties of each instance."), - // Operation: to.Ptr("Insights_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("insights"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/insights/read"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Gets a list of Workloads Insight instances in the specified subscription. The operations returns various properties of each instance."), - // Operation: to.Ptr("Insights_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("insights"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/insights/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Creates a Workloads Insights instance for the specified subscription, resource group, and instance name."), - // Operation: to.Ptr("Insights_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("insights"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/insights/delete"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Deletes a Workloads Insights instance for the specified subscription, resource group and instance name."), - // Operation: to.Ptr("Insights_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("insights"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/insights/write"), - // Display: &armworkloads.OperationDisplay{ - // Description: to.Ptr("Patches the Workload Insights instance for the specified subscription, resource group, and instance name."), - // Operation: to.Ptr("Insights_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("insights"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/polymorphic_helpers.go b/sdk/resourcemanager/workloads/armworkloads/polymorphic_helpers.go index d295d487859d..6d04ab8bc636 100644 --- a/sdk/resourcemanager/workloads/armworkloads/polymorphic_helpers.go +++ b/sdk/resourcemanager/workloads/armworkloads/polymorphic_helpers.go @@ -11,7 +11,7 @@ package armworkloads import "encoding/json" func unmarshalFileShareConfigurationClassification(rawMsg json.RawMessage) (FileShareConfigurationClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -36,7 +36,7 @@ func unmarshalFileShareConfigurationClassification(rawMsg json.RawMessage) (File } func unmarshalInfrastructureConfigurationClassification(rawMsg json.RawMessage) (InfrastructureConfigurationClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -59,7 +59,7 @@ func unmarshalInfrastructureConfigurationClassification(rawMsg json.RawMessage) } func unmarshalOSConfigurationClassification(rawMsg json.RawMessage) (OSConfigurationClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -82,7 +82,7 @@ func unmarshalOSConfigurationClassification(rawMsg json.RawMessage) (OSConfigura } func unmarshalProviderSpecificPropertiesClassification(rawMsg json.RawMessage) (ProviderSpecificPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -113,7 +113,7 @@ func unmarshalProviderSpecificPropertiesClassification(rawMsg json.RawMessage) ( } func unmarshalSAPConfigurationClassification(rawMsg json.RawMessage) (SAPConfigurationClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -138,7 +138,7 @@ func unmarshalSAPConfigurationClassification(rawMsg json.RawMessage) (SAPConfigu } func unmarshalSAPSizingRecommendationResultClassification(rawMsg json.RawMessage) (SAPSizingRecommendationResultClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -161,7 +161,7 @@ func unmarshalSAPSizingRecommendationResultClassification(rawMsg json.RawMessage } func unmarshalSingleServerCustomResourceNamesClassification(rawMsg json.RawMessage) (SingleServerCustomResourceNamesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -182,7 +182,7 @@ func unmarshalSingleServerCustomResourceNamesClassification(rawMsg json.RawMessa } func unmarshalSoftwareConfigurationClassification(rawMsg json.RawMessage) (SoftwareConfigurationClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -207,7 +207,7 @@ func unmarshalSoftwareConfigurationClassification(rawMsg json.RawMessage) (Softw } func unmarshalThreeTierCustomResourceNamesClassification(rawMsg json.RawMessage) (ThreeTierCustomResourceNamesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/sdk/resourcemanager/workloads/armworkloads/providerinstances_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/providerinstances_client_example_test.go deleted file mode 100644 index ef6cf920d2bf..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/providerinstances_client_example_test.go +++ /dev/null @@ -1,1235 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/ProviderInstances_List.json -func ExampleProviderInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProviderInstancesClient().NewListPager("myResourceGroup", "mySapMonitor", 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.ProviderInstanceListResult = armworkloads.ProviderInstanceListResult{ - // Value: []*armworkloads.ProviderInstance{ - // { - // Name: to.Ptr("myProviderInstance1"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance1"), - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.HanaDbProviderInstanceProperties{ - // ProviderType: to.Ptr("SapHana"), - // DbName: to.Ptr("db"), - // DbPasswordURI: to.Ptr(""), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("name"), - // InstanceNumber: to.Ptr("00"), - // SapSid: to.Ptr("SID"), - // SQLPort: to.Ptr("0000"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLHostNameInCertificate: to.Ptr("xyz.domain.com"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("myProviderInstance2"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance1"), - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.SapNetWeaverProviderInstanceProperties{ - // ProviderType: to.Ptr("SapNetWeaver"), - // SapClientID: to.Ptr("111"), - // SapHostFileEntries: []*string{ - // to.Ptr("127.0.0.1 name fqdn")}, - // SapHostname: to.Ptr("name"), - // SapInstanceNr: to.Ptr("00"), - // SapPasswordURI: to.Ptr(""), - // SapPortNumber: to.Ptr("1234"), - // SapSid: to.Ptr("SID"), - // SapUsername: to.Ptr("username"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("myProviderInstance4"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance1"), - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.MsSQLServerProviderInstanceProperties{ - // ProviderType: to.Ptr("MsSqlServer"), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("hostname"), - // SapSid: to.Ptr("sid"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("myProviderInstance3"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance1"), - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusOSProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusOS"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // SapSid: to.Ptr("SID"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("myProviderInstance3"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance1"), - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusHaClusterProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusHaCluster"), - // ClusterName: to.Ptr("clusterName"), - // Hostname: to.Ptr("hostname"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // Sid: to.Ptr("sid"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("myProviderInstance3"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance1"), - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.DB2ProviderInstanceProperties{ - // ProviderType: to.Ptr("Db2"), - // DbName: to.Ptr("OPA"), - // DbPasswordURI: to.Ptr(""), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("Db2OPA"), - // Hostname: to.Ptr("vmname.azure.com"), - // SapSid: to.Ptr("SID"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/Db2ProviderInstances_Get.json -func ExampleProviderInstancesClient_Get_getPropertiesOfADb2Provider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.DB2ProviderInstanceProperties{ - // ProviderType: to.Ptr("Db2"), - // DbName: to.Ptr("OPA"), - // DbPasswordURI: to.Ptr(""), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("Db2OPA"), - // Hostname: to.Ptr("vmname.azure.com"), - // SapSid: to.Ptr("SID"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/MsSqlServerProviderInstance_Get.json -func ExampleProviderInstancesClient_Get_getPropertiesOfAMsSqlServerProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.MsSQLServerProviderInstanceProperties{ - // ProviderType: to.Ptr("MsSqlServer"), - // DbPasswordURI: to.Ptr(""), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("hostname"), - // SapSid: to.Ptr("sid"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusOSProviderInstances_Get.json -func ExampleProviderInstancesClient_Get_getPropertiesOfAOsProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusOSProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusOS"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // SapSid: to.Ptr("SID"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Get.json -func ExampleProviderInstancesClient_Get_getPropertiesOfAPrometheusHaClusterProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusHaClusterProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusHaCluster"), - // ClusterName: to.Ptr("clusterName"), - // Hostname: to.Ptr("hostname"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // Sid: to.Ptr("sid"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/ProviderInstances_Get.json -func ExampleProviderInstancesClient_Get_getPropertiesOfASapMonitorHanaProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.HanaDbProviderInstanceProperties{ - // ProviderType: to.Ptr("SapHana"), - // DbName: to.Ptr("db"), - // DbPasswordURI: to.Ptr(""), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("name"), - // InstanceNumber: to.Ptr("00"), - // SapSid: to.Ptr("SID"), - // SQLPort: to.Ptr("0000"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLHostNameInCertificate: to.Ptr("xyz.domain.com"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/NetWeaverProviderInstances_Get.json -func ExampleProviderInstancesClient_Get_getPropertiesOfASapMonitorNetWeaverProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.SapNetWeaverProviderInstanceProperties{ - // ProviderType: to.Ptr("SapNetWeaver"), - // SapClientID: to.Ptr("111"), - // SapHostFileEntries: []*string{ - // to.Ptr("127.0.0.1 name fqdn")}, - // SapHostname: to.Ptr("name"), - // SapInstanceNr: to.Ptr("00"), - // SapPasswordURI: to.Ptr(""), - // SapPortNumber: to.Ptr("1234"), - // SapSid: to.Ptr("SID"), - // SapUsername: to.Ptr("username"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/Db2ProviderInstances_Create.json -func ExampleProviderInstancesClient_BeginCreate_createADb2Provider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.DB2ProviderInstanceProperties{ - ProviderType: to.Ptr("Db2"), - DbName: to.Ptr("dbName"), - DbPassword: to.Ptr("password"), - DbPasswordURI: to.Ptr(""), - DbPort: to.Ptr("dbPort"), - DbUsername: to.Ptr("username"), - Hostname: to.Ptr("hostname"), - SapSid: to.Ptr("SID"), - SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.DB2ProviderInstanceProperties{ - // ProviderType: to.Ptr("Db2"), - // DbName: to.Ptr("OPA"), - // DbPasswordURI: to.Ptr(""), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("Db2OPA"), - // Hostname: to.Ptr("vmname.azure.com"), - // SapSid: to.Ptr("SID"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/Db2ProviderInstances_Create_Root_Certificate.json -func ExampleProviderInstancesClient_BeginCreate_createADb2ProviderWithRootCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.DB2ProviderInstanceProperties{ - ProviderType: to.Ptr("Db2"), - DbName: to.Ptr("dbName"), - DbPassword: to.Ptr("password"), - DbPasswordURI: to.Ptr(""), - DbPort: to.Ptr("dbPort"), - DbUsername: to.Ptr("username"), - Hostname: to.Ptr("hostname"), - SapSid: to.Ptr("SID"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.DB2ProviderInstanceProperties{ - // ProviderType: to.Ptr("Db2"), - // DbName: to.Ptr("OPA"), - // DbPasswordURI: to.Ptr(""), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("Db2OPA"), - // Hostname: to.Ptr("vmname.azure.com"), - // SapSid: to.Ptr("SID"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/MsSqlServerProviderInstance_Create.json -func ExampleProviderInstancesClient_BeginCreate_createAMsSqlServerProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.MsSQLServerProviderInstanceProperties{ - ProviderType: to.Ptr("MsSqlServer"), - DbPassword: to.Ptr("****"), - DbPasswordURI: to.Ptr(""), - DbPort: to.Ptr("5912"), - DbUsername: to.Ptr("user"), - Hostname: to.Ptr("hostname"), - SapSid: to.Ptr("sid"), - SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.MsSQLServerProviderInstanceProperties{ - // ProviderType: to.Ptr("MsSqlServer"), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("hostname"), - // SapSid: to.Ptr("sid"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/MsSqlServerProviderInstance_Create_Root_Certificate.json -func ExampleProviderInstancesClient_BeginCreate_createAMsSqlServerProviderWithRootCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.MsSQLServerProviderInstanceProperties{ - ProviderType: to.Ptr("MsSqlServer"), - DbPassword: to.Ptr("****"), - DbPasswordURI: to.Ptr(""), - DbPort: to.Ptr("5912"), - DbUsername: to.Ptr("user"), - Hostname: to.Ptr("hostname"), - SapSid: to.Ptr("sid"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.MsSQLServerProviderInstanceProperties{ - // ProviderType: to.Ptr("MsSqlServer"), - // DbPort: to.Ptr("5912"), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("hostname"), - // SapSid: to.Ptr("sid"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusOSProviderInstances_Create.json -func ExampleProviderInstancesClient_BeginCreate_createAOsProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.PrometheusOSProviderInstanceProperties{ - ProviderType: to.Ptr("PrometheusOS"), - PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - SapSid: to.Ptr("SID"), - SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusOSProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusOS"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // SapSid: to.Ptr("SID"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusOSProviderInstances_Create_Root_Certificate.json -func ExampleProviderInstancesClient_BeginCreate_createAOsProviderWithRootCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.PrometheusOSProviderInstanceProperties{ - ProviderType: to.Ptr("PrometheusOS"), - PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - SapSid: to.Ptr("SID"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusOSProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusOS"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // SapSid: to.Ptr("SID"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create.json -func ExampleProviderInstancesClient_BeginCreate_createAPrometheusHaClusterProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.PrometheusHaClusterProviderInstanceProperties{ - ProviderType: to.Ptr("PrometheusHaCluster"), - ClusterName: to.Ptr("clusterName"), - Hostname: to.Ptr("hostname"), - PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - Sid: to.Ptr("sid"), - SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusHaClusterProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusHaCluster"), - // ClusterName: to.Ptr("clusterName"), - // Hostname: to.Ptr("hostname"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // Sid: to.Ptr("sid"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/PrometheusHaClusterProviderInstances_Create_Root_Certificate.json -func ExampleProviderInstancesClient_BeginCreate_createAPrometheusHaClusterProviderWithRootCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.PrometheusHaClusterProviderInstanceProperties{ - ProviderType: to.Ptr("PrometheusHaCluster"), - ClusterName: to.Ptr("clusterName"), - Hostname: to.Ptr("hostname"), - PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - Sid: to.Ptr("sid"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.PrometheusHaClusterProviderInstanceProperties{ - // ProviderType: to.Ptr("PrometheusHaCluster"), - // ClusterName: to.Ptr("clusterName"), - // Hostname: to.Ptr("hostname"), - // PrometheusURL: to.Ptr("http://192.168.0.0:9090/metrics"), - // Sid: to.Ptr("sid"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/ProviderInstances_Create.json -func ExampleProviderInstancesClient_BeginCreate_createASapMonitorHanaProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.HanaDbProviderInstanceProperties{ - ProviderType: to.Ptr("SapHana"), - DbName: to.Ptr("db"), - DbPassword: to.Ptr("****"), - DbPasswordURI: to.Ptr(""), - DbUsername: to.Ptr("user"), - Hostname: to.Ptr("name"), - InstanceNumber: to.Ptr("00"), - SapSid: to.Ptr("SID"), - SQLPort: to.Ptr("0000"), - SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - SSLHostNameInCertificate: to.Ptr("xyz.domain.com"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.HanaDbProviderInstanceProperties{ - // ProviderType: to.Ptr("SapHana"), - // DbName: to.Ptr("db"), - // DbPasswordURI: to.Ptr(""), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("name"), - // InstanceNumber: to.Ptr("00"), - // SapSid: to.Ptr("SID"), - // SQLPort: to.Ptr("0000"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLHostNameInCertificate: to.Ptr("xyz.domain.com"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/ProviderInstances_Create_Root_Certificate.json -func ExampleProviderInstancesClient_BeginCreate_createASapMonitorHanaProviderWithRootCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.HanaDbProviderInstanceProperties{ - ProviderType: to.Ptr("SapHana"), - DbName: to.Ptr("db"), - DbPassword: to.Ptr("****"), - DbPasswordURI: to.Ptr(""), - DbUsername: to.Ptr("user"), - Hostname: to.Ptr("name"), - InstanceNumber: to.Ptr("00"), - SapSid: to.Ptr("SID"), - SQLPort: to.Ptr("0000"), - SSLHostNameInCertificate: to.Ptr("xyz.domain.com"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.HanaDbProviderInstanceProperties{ - // ProviderType: to.Ptr("SapHana"), - // DbName: to.Ptr("db"), - // DbPasswordURI: to.Ptr(""), - // DbUsername: to.Ptr("user"), - // Hostname: to.Ptr("name"), - // InstanceNumber: to.Ptr("00"), - // SapSid: to.Ptr("SID"), - // SQLPort: to.Ptr("0000"), - // SSLHostNameInCertificate: to.Ptr("xyz.domain.com"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/NetWeaverProviderInstances_Create.json -func ExampleProviderInstancesClient_BeginCreate_createASapMonitorNetWeaverProvider() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.SapNetWeaverProviderInstanceProperties{ - ProviderType: to.Ptr("SapNetWeaver"), - SapClientID: to.Ptr("111"), - SapHostFileEntries: []*string{ - to.Ptr("127.0.0.1 name fqdn")}, - SapHostname: to.Ptr("name"), - SapInstanceNr: to.Ptr("00"), - SapPassword: to.Ptr("****"), - SapPasswordURI: to.Ptr(""), - SapPortNumber: to.Ptr("1234"), - SapSid: to.Ptr("SID"), - SapUsername: to.Ptr("username"), - SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.SapNetWeaverProviderInstanceProperties{ - // ProviderType: to.Ptr("SapNetWeaver"), - // SapClientID: to.Ptr("111"), - // SapHostFileEntries: []*string{ - // to.Ptr("127.0.0.1 name fqdn")}, - // SapHostname: to.Ptr("name"), - // SapInstanceNr: to.Ptr("00"), - // SapPasswordURI: to.Ptr(""), - // SapPortNumber: to.Ptr("1234"), - // SapSid: to.Ptr("SID"), - // SapUsername: to.Ptr("username"), - // SSLCertificateURI: to.Ptr("https://storageaccount.blob.core.windows.net/containername/filename"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceServerCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/NetWeaverProviderInstances_Create_Root_Certificate.json -func ExampleProviderInstancesClient_BeginCreate_createASapMonitorNetWeaverProviderWithRootCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armworkloads.ProviderInstance{ - Properties: &armworkloads.ProviderInstanceProperties{ - ProviderSettings: &armworkloads.SapNetWeaverProviderInstanceProperties{ - ProviderType: to.Ptr("SapNetWeaver"), - SapClientID: to.Ptr("111"), - SapHostFileEntries: []*string{ - to.Ptr("127.0.0.1 name fqdn")}, - SapHostname: to.Ptr("name"), - SapInstanceNr: to.Ptr("00"), - SapPassword: to.Ptr("****"), - SapPasswordURI: to.Ptr(""), - SapPortNumber: to.Ptr("1234"), - SapSid: to.Ptr("SID"), - SapUsername: to.Ptr("username"), - SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - }, - }, - }, 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.ProviderInstance = armworkloads.ProviderInstance{ - // Name: to.Ptr("myProviderInstance"), - // Type: to.Ptr("Microsoft.Workloads/monitors/providerInstances"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/mySapMonitor/providerInstances/myProviderInstance"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.ProviderInstanceProperties{ - // ProviderSettings: &armworkloads.SapNetWeaverProviderInstanceProperties{ - // ProviderType: to.Ptr("SapNetWeaver"), - // SapClientID: to.Ptr("111"), - // SapHostFileEntries: []*string{ - // to.Ptr("127.0.0.1 name fqdn")}, - // SapHostname: to.Ptr("name"), - // SapInstanceNr: to.Ptr("00"), - // SapPasswordURI: to.Ptr(""), - // SapPortNumber: to.Ptr("1234"), - // SapSid: to.Ptr("SID"), - // SapUsername: to.Ptr("username"), - // SSLPreference: to.Ptr(armworkloads.SSLPreferenceRootCertificate), - // }, - // ProvisioningState: to.Ptr(armworkloads.WorkloadMonitorProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/ProviderInstances_Delete.json -func ExampleProviderInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderInstancesClient().BeginDelete(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0f"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/operations/locations/westus/1e4193c3-206e-4916-b124-1da16175eb0f"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/response_types.go b/sdk/resourcemanager/workloads/armworkloads/responses.go similarity index 100% rename from sdk/resourcemanager/workloads/armworkloads/response_types.go rename to sdk/resourcemanager/workloads/armworkloads/responses.go diff --git a/sdk/resourcemanager/workloads/armworkloads/sapapplicationserverinstances_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/sapapplicationserverinstances_client_example_test.go deleted file mode 100644 index 0600b9ccb780..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/sapapplicationserverinstances_client_example_test.go +++ /dev/null @@ -1,466 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_Get.json -func ExampleSAPApplicationServerInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPApplicationServerInstancesClient().Get(ctx, "test-rg", "X00", "app01", 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.SAPApplicationServerInstance = armworkloads.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPApplicationServerProperties{ - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // VMDetails: []*armworkloads.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_Create_HA_AvSet.json -func ExampleSAPApplicationServerInstancesClient_BeginCreate_createSapApplicationServerInstancesForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloads.SAPApplicationServerInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPApplicationServerProperties{}, - }, 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.SAPApplicationServerInstance = armworkloads.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPApplicationServerProperties{ - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // LoadBalancerDetails: &armworkloads.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-loadBalancer"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeActive), - // StorageDetails: []*armworkloads.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), - // }, - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeStandby), - // StorageDetails: []*armworkloads.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_Create.json -func ExampleSAPApplicationServerInstancesClient_BeginCreate_sapApplicationServerInstancesCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloads.SAPApplicationServerInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPApplicationServerProperties{}, - }, 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.SAPApplicationServerInstance = armworkloads.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPApplicationServerProperties{ - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_Update.json -func ExampleSAPApplicationServerInstancesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginUpdate(ctx, "test-rg", "X00", "app01", armworkloads.UpdateSAPApplicationInstanceRequest{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, 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.SAPApplicationServerInstance = armworkloads.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPApplicationServerProperties{ - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // VMDetails: []*armworkloads.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_Delete.json -func ExampleSAPApplicationServerInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "app01", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_List.json -func ExampleSAPApplicationServerInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPApplicationServerInstancesClient().NewListPager("test-rg", "X00", 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.SAPApplicationServerInstanceList = armworkloads.SAPApplicationServerInstanceList{ - // Value: []*armworkloads.SAPApplicationServerInstance{ - // { - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPApplicationServerProperties{ - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // VMDetails: []*armworkloads.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("app02"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app02"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPApplicationServerProperties{ - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // VMDetails: []*armworkloads.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_StartInstance.json -func ExampleSAPApplicationServerInstancesClient_BeginStartInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "app01", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPApplicationServerInstances_StopInstance.json -func ExampleSAPApplicationServerInstancesClient_BeginStopInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "app01", &armworkloads.SAPApplicationServerInstancesClientBeginStopInstanceOptions{Body: &armworkloads.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) - 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/sapcentralinstances_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/sapcentralinstances_client_example_test.go deleted file mode 100644 index 14d114b2f046..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/sapcentralinstances_client_example_test.go +++ /dev/null @@ -1,547 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_Get.json -func ExampleSAPCentralInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPCentralInstancesClient().Get(ctx, "test-rg", "X00", "centralServer", 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.SAPCentralServerInstance = armworkloads.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloads.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloads.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloads.EnqueueServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloads.GatewayServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateDegraded), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloads.MessageServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateUnhealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_Create_HA_AvSet.json -func ExampleSAPCentralInstancesClient_BeginCreate_createSapCentralInstancesForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloads.SAPCentralServerInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPCentralServerProperties{}, - }, 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.SAPCentralServerInstance = armworkloads.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloads.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloads.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloads.EnqueueServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloads.GatewayServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // LoadBalancerDetails: &armworkloads.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-ASCS-loadBalancer"), - // }, - // MessageServerProperties: &armworkloads.MessageServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.CentralServerVirtualMachineTypePrimary), - // StorageDetails: []*armworkloads.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), - // }, - // { - // Type: to.Ptr(armworkloads.CentralServerVirtualMachineTypePrimary), - // StorageDetails: []*armworkloads.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_Create.json -func ExampleSAPCentralInstancesClient_BeginCreate_sapCentralInstancesCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloads.SAPCentralServerInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPCentralServerProperties{}, - }, 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.SAPCentralServerInstance = armworkloads.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloads.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloads.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloads.EnqueueServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloads.GatewayServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloads.MessageServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_Update.json -func ExampleSAPCentralInstancesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginUpdate(ctx, "test-rg", "X00", "centralServer", armworkloads.UpdateSAPCentralInstanceRequest{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, 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.SAPCentralServerInstance = armworkloads.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloads.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloads.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloads.EnqueueServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloads.GatewayServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloads.MessageServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_Delete.json -func ExampleSAPCentralInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginDelete(ctx, "test-rg", "X00", "centralServer", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_List.json -func ExampleSAPCentralInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPCentralInstancesClient().NewListPager("test-rg", "X00", 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.SAPCentralInstanceList = armworkloads.SAPCentralInstanceList{ - // Value: []*armworkloads.SAPCentralServerInstance{ - // { - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloads.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloads.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloads.EnqueueServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloads.GatewayServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloads.MessageServerProperties{ - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // VMDetails: []*armworkloads.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloads.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_StartInstance.json -func ExampleSAPCentralInstancesClient_BeginStartInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "centralServer", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPCentralInstances_StopInstance.json -func ExampleSAPCentralInstancesClient_BeginStopInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "centralServer", &armworkloads.SAPCentralInstancesClientBeginStopInstanceOptions{Body: &armworkloads.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](1200), - }, - }) - 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/sapdatabaseinstances_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/sapdatabaseinstances_client_example_test.go deleted file mode 100644 index d5156c3d1112..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/sapdatabaseinstances_client_example_test.go +++ /dev/null @@ -1,386 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_Get.json -func ExampleSAPDatabaseInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPDatabaseInstancesClient().Get(ctx, "test-rg", "X00", "databaseServer", 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.SAPDatabaseInstance = armworkloads.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloads.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_Create_HA_AvSet.json -func ExampleSAPDatabaseInstancesClient_BeginCreate_createSapDatabaseInstancesForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloads.SAPDatabaseInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPDatabaseProperties{}, - }, 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.SAPDatabaseInstance = armworkloads.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // LoadBalancerDetails: &armworkloads.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/db-loadBalancer"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloads.DatabaseVMDetails{ - // { - // StorageDetails: []*armworkloads.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_Create.json -func ExampleSAPDatabaseInstancesClient_BeginCreate_sapDatabaseInstancesCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloads.SAPDatabaseInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPDatabaseProperties{}, - }, 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.SAPDatabaseInstance = armworkloads.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloads.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_Update.json -func ExampleSAPDatabaseInstancesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginUpdate(ctx, "test-rg", "X00", "databaseServer", armworkloads.UpdateSAPDatabaseInstanceRequest{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, 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.SAPDatabaseInstance = armworkloads.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloads.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_Delete.json -func ExampleSAPDatabaseInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginDelete(ctx, "test-rg", "X00", "databaseServer", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_List.json -func ExampleSAPDatabaseInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPDatabaseInstancesClient().NewListPager("test-rg", "X00", 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.SAPDatabaseInstanceList = armworkloads.SAPDatabaseInstanceList{ - // Value: []*armworkloads.SAPDatabaseInstance{ - // { - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloads.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_StartInstance.json -func ExampleSAPDatabaseInstancesClient_BeginStartInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "db0", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPDatabaseInstances_StopInstance.json -func ExampleSAPDatabaseInstancesClient_BeginStopInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "db0", &armworkloads.SAPDatabaseInstancesClientBeginStopInstanceOptions{Body: &armworkloads.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) - 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/saplandscapemonitor_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/saplandscapemonitor_client_example_test.go deleted file mode 100644 index c684b983afef..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/saplandscapemonitor_client_example_test.go +++ /dev/null @@ -1,361 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/SapLandscapeMonitor_Get.json -func ExampleSapLandscapeMonitorClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapLandscapeMonitorClient().Get(ctx, "myResourceGroup", "mySapMonitor", 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.SapLandscapeMonitor = armworkloads.SapLandscapeMonitor{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/myMonitor/sapLandscapeMonitor/default"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.SapLandscapeMonitorProperties{ - // Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - // Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("Prod"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("ERP1"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // }, - // TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - // { - // Name: to.Ptr("Instance Availability"), - // Green: to.Ptr[float32](90), - // Red: to.Ptr[float32](50), - // Yellow: to.Ptr[float32](75), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/SapLandscapeMonitor_Create.json -func ExampleSapLandscapeMonitorClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapLandscapeMonitorClient().Create(ctx, "myResourceGroup", "mySapMonitor", armworkloads.SapLandscapeMonitor{ - Properties: &armworkloads.SapLandscapeMonitorProperties{ - Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - { - Name: to.Ptr("Prod"), - TopSid: []*string{ - to.Ptr("SID1"), - to.Ptr("SID2")}, - }}, - SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - { - Name: to.Ptr("ERP1"), - TopSid: []*string{ - to.Ptr("SID1"), - to.Ptr("SID2")}, - }}, - }, - TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - { - Name: to.Ptr("Instance Availability"), - Green: to.Ptr[float32](90), - Red: to.Ptr[float32](50), - Yellow: to.Ptr[float32](75), - }}, - }, - }, 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.SapLandscapeMonitor = armworkloads.SapLandscapeMonitor{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/myMonitor/sapLandscapeMonitor/default"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.SapLandscapeMonitorProperties{ - // Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - // Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("Prod"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("ERP1"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // }, - // TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - // { - // Name: to.Ptr("Instance Availability"), - // Green: to.Ptr[float32](90), - // Red: to.Ptr[float32](50), - // Yellow: to.Ptr[float32](75), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/SapLandscapeMonitor_Delete.json -func ExampleSapLandscapeMonitorClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSapLandscapeMonitorClient().Delete(ctx, "myResourceGroup", "mySapMonitor", 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/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/SapLandscapeMonitor_Update.json -func ExampleSapLandscapeMonitorClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapLandscapeMonitorClient().Update(ctx, "myResourceGroup", "mySapMonitor", armworkloads.SapLandscapeMonitor{ - Properties: &armworkloads.SapLandscapeMonitorProperties{ - Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - { - Name: to.Ptr("Prod"), - TopSid: []*string{ - to.Ptr("SID1"), - to.Ptr("SID2")}, - }}, - SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - { - Name: to.Ptr("ERP1"), - TopSid: []*string{ - to.Ptr("SID1"), - to.Ptr("SID2")}, - }}, - }, - TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - { - Name: to.Ptr("Instance Availability"), - Green: to.Ptr[float32](90), - Red: to.Ptr[float32](50), - Yellow: to.Ptr[float32](75), - }}, - }, - }, 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.SapLandscapeMonitor = armworkloads.SapLandscapeMonitor{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/myMonitor/sapLandscapeMonitor/default"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.SapLandscapeMonitorProperties{ - // Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - // Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("Prod"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("ERP1"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // }, - // TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - // { - // Name: to.Ptr("Instance Availability"), - // Green: to.Ptr[float32](90), - // Red: to.Ptr[float32](50), - // Yellow: to.Ptr[float32](75), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/SapLandscapeMonitor_List.json -func ExampleSapLandscapeMonitorClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSapLandscapeMonitorClient().List(ctx, "myResourceGroup", "mySapMonitor", 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.SapLandscapeMonitorListResult = armworkloads.SapLandscapeMonitorListResult{ - // Value: []*armworkloads.SapLandscapeMonitor{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/myMonitor/sapLandscapeMonitor/default"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.SapLandscapeMonitorProperties{ - // Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - // Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("Prod"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("ERP1"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // }, - // TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - // { - // Name: to.Ptr("Instance Availability"), - // Green: to.Ptr[float32](90), - // Red: to.Ptr[float32](50), - // Yellow: to.Ptr[float32](75), - // }}, - // }, - // }, - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Workloads/monitors/myMonitor/sapLandscapeMonitor/default"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Properties: &armworkloads.SapLandscapeMonitorProperties{ - // Grouping: &armworkloads.SapLandscapeMonitorPropertiesGrouping{ - // Landscape: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("Prod"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // SapApplication: []*armworkloads.SapLandscapeMonitorSidMapping{ - // { - // Name: to.Ptr("ERP1"), - // TopSid: []*string{ - // to.Ptr("SID1"), - // to.Ptr("SID2")}, - // }}, - // }, - // TopMetricsThresholds: []*armworkloads.SapLandscapeMonitorMetricThresholds{ - // { - // Name: to.Ptr("Instance Availability"), - // Green: to.Ptr[float32](90), - // Red: to.Ptr[float32](50), - // Yellow: to.Ptr[float32](75), - // }}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/sapvirtualinstances_client_example_test.go b/sdk/resourcemanager/workloads/armworkloads/sapvirtualinstances_client_example_test.go deleted file mode 100644 index 6d48b925b7f9..000000000000 --- a/sdk/resourcemanager/workloads/armworkloads/sapvirtualinstances_client_example_test.go +++ /dev/null @@ -1,7211 +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 armworkloads_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/workloads/armworkloads" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForDistributedSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{ - AvailabilitySetName: to.Ptr("appAvSet"), - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloads.CentralServerFullResourceNames{ - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("ascsdisk0")}, - }, - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }}, - }, - DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{ - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadata0"), - to.Ptr("hanadata1")}, - "hanaLog": { - to.Ptr("hanalog0"), - to.Ptr("hanalog1"), - to.Ptr("hanalog2")}, - "hanaShared": { - to.Ptr("hanashared0"), - to.Ptr("hanashared1")}, - "usrSap": { - to.Ptr("usrsap0")}, - }, - HostName: to.Ptr("dbhostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbnic"), - }}, - OSDiskName: to.Ptr("dbosdisk"), - VMName: to.Ptr("dbvm"), - }}, - }, - SharedStorage: &armworkloads.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("appAvSet"), - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, - // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloads.CentralServerFullResourceNames{ - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("ascsdisk0")}, - // }, - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }}, - // }, - // DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{ - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadata0"), - // to.Ptr("hanadata1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalog0"), - // to.Ptr("hanalog1"), - // to.Ptr("hanalog2")}, - // "hanaShared": []*string{ - // to.Ptr("hanashared0"), - // to.Ptr("hanashared1")}, - // "usrSap": []*string{ - // to.Ptr("usrsap0")}, - // }, - // HostName: to.Ptr("dbhostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbnic"), - // }}, - // OSDiskName: to.Ptr("dbosdisk"), - // VMName: to.Ptr("dbvm"), - // }}, - // }, - // SharedStorage: &armworkloads.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{ - AvailabilitySetName: to.Ptr("appAvSet"), - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloads.CentralServerFullResourceNames{ - AvailabilitySetName: to.Ptr("csAvSet"), - LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("ascsBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("ascsip0"), - to.Ptr("ersip0")}, - HealthProbeNames: []*string{ - to.Ptr("ascsHealthProbe"), - to.Ptr("ersHealthProbe")}, - LoadBalancerName: to.Ptr("ascslb"), - }, - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }, - { - HostName: to.Ptr("ershostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ersnic"), - }}, - OSDiskName: to.Ptr("ersosdisk"), - VMName: to.Ptr("ersvm"), - }}, - }, - DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{ - AvailabilitySetName: to.Ptr("dbAvSet"), - LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("dbBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("dbip")}, - HealthProbeNames: []*string{ - to.Ptr("dbHealthProbe")}, - LoadBalancerName: to.Ptr("dblb"), - }, - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatapr0"), - to.Ptr("hanadatapr1")}, - "hanaLog": { - to.Ptr("hanalogpr0"), - to.Ptr("hanalogpr1"), - to.Ptr("hanalogpr2")}, - "hanaShared": { - to.Ptr("hanasharedpr0"), - to.Ptr("hanasharedpr1")}, - "usrSap": { - to.Ptr("usrsappr0")}, - }, - HostName: to.Ptr("dbprhostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbprnic"), - }}, - OSDiskName: to.Ptr("dbprosdisk"), - VMName: to.Ptr("dbvmpr"), - }, - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatasr0"), - to.Ptr("hanadatasr1")}, - "hanaLog": { - to.Ptr("hanalogsr0"), - to.Ptr("hanalogsr1"), - to.Ptr("hanalogsr2")}, - "hanaShared": { - to.Ptr("hanasharedsr0"), - to.Ptr("hanasharedsr1")}, - "usrSap": { - to.Ptr("usrsapsr0")}, - }, - HostName: to.Ptr("dbsrhostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbsrnic"), - }}, - OSDiskName: to.Ptr("dbsrosdisk"), - VMName: to.Ptr("dbvmsr"), - }}, - }, - SharedStorage: &armworkloads.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("appAvSet"), - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, - // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloads.CentralServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("csAvSet"), - // LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("ascsBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("ascsip0"), - // to.Ptr("ersip0")}, - // HealthProbeNames: []*string{ - // to.Ptr("ascsHealthProbe"), - // to.Ptr("ersHealthProbe")}, - // LoadBalancerName: to.Ptr("ascslb"), - // }, - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }, - // { - // HostName: to.Ptr("ershostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ersnic"), - // }}, - // OSDiskName: to.Ptr("ersosdisk"), - // VMName: to.Ptr("ersvm"), - // }}, - // }, - // DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("dbAvSet"), - // LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("dbBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("dbip")}, - // HealthProbeNames: []*string{ - // to.Ptr("dbHealthProbe")}, - // LoadBalancerName: to.Ptr("dblb"), - // }, - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatapr0"), - // to.Ptr("hanadatapr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogpr0"), - // to.Ptr("hanalogpr1"), - // to.Ptr("hanalogpr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedpr0"), - // to.Ptr("hanasharedpr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsappr0")}, - // }, - // HostName: to.Ptr("dbprhostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbprnic"), - // }}, - // OSDiskName: to.Ptr("dbprosdisk"), - // VMName: to.Ptr("dbvmpr"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatasr0"), - // to.Ptr("hanadatasr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogsr0"), - // to.Ptr("hanalogsr1"), - // to.Ptr("hanalogsr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedsr0"), - // to.Ptr("hanasharedsr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsapsr0")}, - // }, - // HostName: to.Ptr("dbsrhostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbsrnic"), - // }}, - // OSDiskName: to.Ptr("dbsrosdisk"), - // VMName: to.Ptr("dbvmsr"), - // }}, - // }, - // SharedStorage: &armworkloads.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{ - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloads.CentralServerFullResourceNames{ - LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("ascsBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("ascsip0"), - to.Ptr("ersip0")}, - HealthProbeNames: []*string{ - to.Ptr("ascsHealthProbe"), - to.Ptr("ersHealthProbe")}, - LoadBalancerName: to.Ptr("ascslb"), - }, - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }, - { - HostName: to.Ptr("ershostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ersnic"), - }}, - OSDiskName: to.Ptr("ersosdisk"), - VMName: to.Ptr("ersvm"), - }}, - }, - DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{ - LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("dbBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("dbip")}, - HealthProbeNames: []*string{ - to.Ptr("dbHealthProbe")}, - LoadBalancerName: to.Ptr("dblb"), - }, - VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatapr0"), - to.Ptr("hanadatapr1")}, - "hanaLog": { - to.Ptr("hanalogpr0"), - to.Ptr("hanalogpr1"), - to.Ptr("hanalogpr2")}, - "hanaShared": { - to.Ptr("hanasharedpr0"), - to.Ptr("hanasharedpr1")}, - "usrSap": { - to.Ptr("usrsappr0")}, - }, - HostName: to.Ptr("dbprhostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbprnic"), - }}, - OSDiskName: to.Ptr("dbprosdisk"), - VMName: to.Ptr("dbvmpr"), - }, - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatasr0"), - to.Ptr("hanadatasr1")}, - "hanaLog": { - to.Ptr("hanalogsr0"), - to.Ptr("hanalogsr1"), - to.Ptr("hanalogsr2")}, - "hanaShared": { - to.Ptr("hanasharedsr0"), - to.Ptr("hanasharedsr1")}, - "usrSap": { - to.Ptr("usrsapsr0")}, - }, - HostName: to.Ptr("dbsrhostName"), - NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbsrnic"), - }}, - OSDiskName: to.Ptr("dbsrosdisk"), - VMName: to.Ptr("dbvmsr"), - }}, - }, - SharedStorage: &armworkloads.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{ - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, - // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloads.CentralServerFullResourceNames{ - // LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("ascsBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("ascsip0"), - // to.Ptr("ersip0")}, - // HealthProbeNames: []*string{ - // to.Ptr("ascsHealthProbe"), - // to.Ptr("ersHealthProbe")}, - // LoadBalancerName: to.Ptr("ascslb"), - // }, - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }, - // { - // HostName: to.Ptr("ershostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ersnic"), - // }}, - // OSDiskName: to.Ptr("ersosdisk"), - // VMName: to.Ptr("ersvm"), - // }}, - // }, - // DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{ - // LoadBalancer: &armworkloads.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("dbBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("dbip")}, - // HealthProbeNames: []*string{ - // to.Ptr("dbHealthProbe")}, - // LoadBalancerName: to.Ptr("dblb"), - // }, - // VirtualMachines: []*armworkloads.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatapr0"), - // to.Ptr("hanadatapr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogpr0"), - // to.Ptr("hanalogpr1"), - // to.Ptr("hanalogpr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedpr0"), - // to.Ptr("hanasharedpr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsappr0")}, - // }, - // HostName: to.Ptr("dbprhostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbprnic"), - // }}, - // OSDiskName: to.Ptr("dbprosdisk"), - // VMName: to.Ptr("dbvmpr"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatasr0"), - // to.Ptr("hanadatasr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogsr0"), - // to.Ptr("hanalogsr1"), - // to.Ptr("hanalogsr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedsr0"), - // to.Ptr("hanasharedsr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsapsr0")}, - // }, - // HostName: to.Ptr("dbsrhostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbsrnic"), - // }}, - // OSDiskName: to.Ptr("dbsrosdisk"), - // VMName: to.Ptr("dbvmsr"), - // }}, - // }, - // SharedStorage: &armworkloads.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - // CustomResourceNames: &armworkloads.SingleServerFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName), - // VirtualMachine: &armworkloads.VirtualMachineResourceNames{ - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadata0"), - // to.Ptr("hanadata1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalog0"), - // to.Ptr("hanalog1"), - // to.Ptr("hanalog2")}, - // "hanaShared": []*string{ - // to.Ptr("hanashared0"), - // to.Ptr("hanashared1")}, - // "usrSap": []*string{ - // to.Ptr("usrsap0")}, - // }, - // HostName: to.Ptr("sshostName"), - // NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ssnic"), - // }}, - // OSDiskName: to.Ptr("ssosdisk"), - // VMName: to.Ptr("ssvm"), - // }, - // }, - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDistributedSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](5), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](5), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilityZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloads.SSHConfiguration{ - PublicKeys: []*armworkloads.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForDistributedSystemRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloads.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloads.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - // "backup": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilitySetRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloads.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloads.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - // "backup": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilityZoneRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloads.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloads.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - // "backup": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationsForSingleServerSystemRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - DbDiskConfiguration: &armworkloads.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloads.DiskSKU{ - Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // DbDiskConfiguration: &armworkloads.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{ - // "backup": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloads.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloads.DiskSKU{ - // Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForDistributedSystemRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilitySetRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilityZoneRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForSingleServerSystemRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSapTransportDirectoryFileshare() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - StorageConfiguration: &armworkloads.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloads.CreateAndMountFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeCreateAndMount), - ResourceGroup: to.Ptr("rgName"), - StorageAccountName: to.Ptr("storageName"), - }, - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // StorageConfiguration: &armworkloads.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloads.CreateAndMountFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeCreateAndMount), - // ResourceGroup: to.Ptr("rgName"), - // StorageAccountName: to.Ptr("storageName"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExistingSapTransportDirectoryFileshare() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - StorageConfiguration: &armworkloads.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloads.MountFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeMount), - ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - }, - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // StorageConfiguration: &armworkloads.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloads.MountFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeMount), - // ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - // PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASapTransportDirectoryFileshare() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - StorageConfiguration: &armworkloads.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloads.SkipFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeSkip), - }, - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // StorageConfiguration: &armworkloads.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloads.SkipFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeSkip), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnADistributedSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "created by": to.Ptr("azureuser"), - }, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("{{resourcegrp}}"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnASingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("westcentralus"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistributedSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "created by": to.Ptr("azureuser"), - }, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("{{resourcegrp}}"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), - }, - }, - CentralServer: &armworkloads.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), - }, - }, - DatabaseServer: &armworkloads.DatabaseConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - NetworkConfiguration: &armworkloads.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationInProgress), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{}, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("test-rg"), - DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"), - VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - ImageReference: &armworkloads.ImageReference{ - Offer: to.Ptr("SLES-SAP"), - Publisher: to.Ptr("SUSE"), - SKU: to.Ptr("12-sp4-gen2"), - Version: to.Ptr("2022.02.01"), - }, - OSProfile: &armworkloads.OSProfile{ - AdminUsername: to.Ptr("azureappadmin"), - OSConfiguration: &armworkloads.LinuxConfiguration{ - OSType: to.Ptr(armworkloads.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloads.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloads.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), - }, - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloads.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // NetworkConfiguration: &armworkloads.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // }, - // OSSapConfiguration: &armworkloads.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationInProgress), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloads.SAPVirtualInstanceProperties{ - Configuration: &armworkloads.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Get.json -func ExampleSAPVirtualInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // }, - // SoftwareConfiguration: &armworkloads.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Update.json -func ExampleSAPVirtualInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPVirtualInstancesClient().Update(ctx, "test-rg", "X00", armworkloads.UpdateSAPVirtualInstanceRequest{ - Identity: &armworkloads.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloads.ManagedServiceIdentityTypeNone), - }, - Tags: map[string]*string{ - "key1": to.Ptr("svi1"), - }, - }, 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.SAPVirtualInstance = armworkloads.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("svi1"), - // }, - // Identity: &armworkloads.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloads.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateInfrastructureDeploymentPending), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusStarting), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json -func ExampleSAPVirtualInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginDelete(ctx, "test-rg", "X00", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json -func ExampleSAPVirtualInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPVirtualInstancesClient().NewListByResourceGroupPager("test-rg", 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.SAPVirtualInstanceList = armworkloads.SAPVirtualInstanceList{ - // Value: []*armworkloads.SAPVirtualInstance{ - // { - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // }, - // SoftwareConfiguration: &armworkloads.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // }, - // { - // Name: to.Ptr("X01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // }, - // SoftwareConfiguration: &armworkloads.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json -func ExampleSAPVirtualInstancesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPVirtualInstancesClient().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.SAPVirtualInstanceList = armworkloads.SAPVirtualInstanceList{ - // Value: []*armworkloads.SAPVirtualInstance{ - // { - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // }, - // SoftwareConfiguration: &armworkloads.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // }, - // { - // Name: to.Ptr("X01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), - // SystemData: &armworkloads.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser), - // }, - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloads.SAPVirtualInstanceProperties{ - // Configuration: &armworkloads.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloads.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloads.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloads.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{ - // ImageReference: &armworkloads.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloads.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloads.LinuxConfiguration{ - // OSType: to.Ptr(armworkloads.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloads.SSHConfiguration{ - // PublicKeys: []*armworkloads.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // }, - // SoftwareConfiguration: &armworkloads.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, - // }, - // Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloads.SAPHealthStateHealthy), - // ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Start.json -func ExampleSAPVirtualInstancesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json -func ExampleSAPVirtualInstancesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloads.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &armworkloads.SAPVirtualInstancesClientBeginStopOptions{Body: &armworkloads.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) - 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.OperationStatusResult = armworkloads.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloads/armworkloads/time_rfc3339.go b/sdk/resourcemanager/workloads/armworkloads/time_rfc3339.go index e27602cd48f3..31afe41b86fd 100644 --- a/sdk/resourcemanager/workloads/armworkloads/time_rfc3339.go +++ b/sdk/resourcemanager/workloads/armworkloads/time_rfc3339.go @@ -19,12 +19,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 +44,33 @@ 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) { + 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/workloads/sapmonitors/CHANGELOG.md b/sdk/resourcemanager/workloads/sapmonitors/CHANGELOG.md new file mode 100644 index 000000000000..a42b44f291d4 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-09) +### 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..e797fc3ace41 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/README.md @@ -0,0 +1,92 @@ +# Azure Workloads Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors) + +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.NewMonitorsClient() +``` + +## 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/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..72610ad830dd --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/ci.yml @@ -0,0 +1,28 @@ +# 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: + IncludeRelease: true + 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..506149d5e7ad --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/client_factory.go @@ -0,0 +1,68 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 +} + +// 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..df99bb8f2f02 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/constants.go @@ -0,0 +1,231 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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, + } +} + +// 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, + } +} + +// 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, + } +} + +// 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/internal.go b/sdk/resourcemanager/workloads/sapmonitors/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/internal.go @@ -0,0 +1,64 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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/workloads/sapmonitors/fake/monitors_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/monitors_server.go new file mode 100644 index 000000000000..b13bb3deef1c --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/monitors_server.go @@ -0,0 +1,353 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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.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")} + } + + var resp *http.Response + var err error + + switch method { + case "MonitorsClient.BeginCreate": + resp, err = m.dispatchBeginCreate(req) + case "MonitorsClient.BeginDelete": + resp, err = m.dispatchBeginDelete(req) + case "MonitorsClient.Get": + resp, err = m.dispatchGet(req) + case "MonitorsClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + case "MonitorsClient.NewListByResourceGroupPager": + resp, err = m.dispatchNewListByResourceGroupPager(req) + case "MonitorsClient.BeginUpdate": + resp, err = m.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +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.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are 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 +} 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..3c3270a3119a --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.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 *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 +} 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..1c818a281980 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/providerinstances_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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.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")} + } + + var resp *http.Response + var err error + + switch method { + case "ProviderInstancesClient.BeginCreate": + resp, err = p.dispatchBeginCreate(req) + case "ProviderInstancesClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "ProviderInstancesClient.Get": + resp, err = p.dispatchGet(req) + case "ProviderInstancesClient.NewListByMonitorPager": + resp, err = p.dispatchNewListByMonitorPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +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.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)} + } + 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 +} 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..321875d006fc --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/saplandscapemonitor_server.go @@ -0,0 +1,277 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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")} + } + + var resp *http.Response + var err error + + switch method { + case "SapLandscapeMonitorClient.Create": + resp, err = s.dispatchCreate(req) + case "SapLandscapeMonitorClient.Delete": + resp, err = s.dispatchDelete(req) + case "SapLandscapeMonitorClient.Get": + resp, err = s.dispatchGet(req) + case "SapLandscapeMonitorClient.NewListByMonitorPager": + resp, err = s.dispatchNewListByMonitorPager(req) + case "SapLandscapeMonitorClient.Update": + resp, err = s.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +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 +} 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..ce8b54c6997a --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/server_factory.go @@ -0,0 +1,94 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 { + MonitorsServer MonitorsServer + OperationsServer OperationsServer + ProviderInstancesServer ProviderInstancesServer + 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 + 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 "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/fake/time_rfc3339.go b/sdk/resourcemanager/workloads/sapmonitors/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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/workloads/sapmonitors/go.mod b/sdk/resourcemanager/workloads/sapmonitors/go.mod new file mode 100644 index 000000000000..9f6ab38409ad --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/workloads/sapmonitors/go.sum b/sdk/resourcemanager/workloads/sapmonitors/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/workloads/sapmonitors/interfaces.go b/sdk/resourcemanager/workloads/sapmonitors/interfaces.go new file mode 100644 index 000000000000..51acdab6a947 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/interfaces.go @@ -0,0 +1,19 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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, *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..dfa5a1cd2c8a --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/models.go @@ -0,0 +1,595 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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" + +// 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 +} + +// 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..df7afc689b6a --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/models_serde.go @@ -0,0 +1,1331 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 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 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..acb3fb5250bb --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/monitors_client.go @@ -0,0 +1,459 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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 2023-12-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, options *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", "2023-12-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/workloads/sapmonitors/operations_client.go b/sdk/resourcemanager/workloads/sapmonitors/operations_client.go new file mode 100644 index 000000000000..7ee825a96342 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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" + "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 2023-12-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.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", "2023-12-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/workloads/sapmonitors/options.go b/sdk/resourcemanager/workloads/sapmonitors/options.go new file mode 100644 index 000000000000..b140d0b80145 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/options.go @@ -0,0 +1,99 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package sapmonitors + +// MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method. +type MonitorsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. +type MonitorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MonitorsClientBeginUpdateOptions contains the optional parameters for the MonitorsClient.BeginUpdate method. +type MonitorsClientBeginUpdateOptions struct { + // Resumes the LRO 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 LRO from the provided token. + ResumeToken string +} + +// ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete +// method. +type ProviderInstancesClientBeginDeleteOptions struct { + // Resumes the LRO 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..9d0a54eb8e20 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/polymorphic_helpers.go @@ -0,0 +1,42 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 "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..430d0b84ac1f --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/providerinstances_client.go @@ -0,0 +1,350 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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..d9957340ed06 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/responses.go @@ -0,0 +1,102 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 + +// 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..ba2339db1b97 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/saplandscapemonitor_client.go @@ -0,0 +1,368 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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 2023-12-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, options *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", "2023-12-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/workloads/sapmonitors/time_rfc3339.go b/sdk/resourcemanager/workloads/sapmonitors/time_rfc3339.go new file mode 100644 index 000000000000..dc4a8880c589 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/time_rfc3339.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under 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" + "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 +}