diff --git a/sdk/resourcemanager/resources/armtemplatespecs/CHANGELOG.md b/sdk/resourcemanager/resources/armtemplatespecs/CHANGELOG.md index fe114fb624e9..b7c19e59d689 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/CHANGELOG.md +++ b/sdk/resourcemanager/resources/armtemplatespecs/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.2 (2023-10-04) +### Other Changes + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/resources/armtemplatespecs/autorest.md b/sdk/resourcemanager/resources/armtemplatespecs/autorest.md index e75f3b81761e..ff792c8bfdf0 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/autorest.md +++ b/sdk/resourcemanager/resources/armtemplatespecs/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resources/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resources/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 1.1.2 package-templatespecs: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resources/armtemplatespecs/client.go b/sdk/resourcemanager/resources/armtemplatespecs/client.go index 686aae12a55a..4e01265c6db4 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/client.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs @@ -53,18 +52,21 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // - templateSpec - Template Spec supplied to the operation. // - options - ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpec TemplateSpec, options *ClientCreateOrUpdateOptions) (ClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, templateSpecName, templateSpec, options) if err != nil { return ClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -90,7 +92,10 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG reqQP.Set("api-version", "2022-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, templateSpec) + if err := runtime.MarshalAsJSON(req, templateSpec); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -110,16 +115,18 @@ func (client *Client) createOrUpdateHandleResponse(resp *http.Response) (ClientC // - templateSpecName - Name of the Template Spec. // - options - ClientDeleteOptions contains the optional parameters for the Client.Delete method. func (client *Client) Delete(ctx context.Context, resourceGroupName string, templateSpecName string, options *ClientDeleteOptions) (ClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, templateSpecName, options) if err != nil { return ClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ClientDeleteResponse{}, err } return ClientDeleteResponse{}, nil } @@ -158,18 +165,21 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // - templateSpecName - Name of the Template Spec. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, templateSpecName string, options *ClientGetOptions) (ClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, templateSpecName, options) if err != nil { return ClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -217,18 +227,21 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // - templateSpecName - Name of the Template Spec. // - options - ClientGetBuiltInOptions contains the optional parameters for the Client.GetBuiltIn method. func (client *Client) GetBuiltIn(ctx context.Context, templateSpecName string, options *ClientGetBuiltInOptions) (ClientGetBuiltInResponse, error) { + var err error req, err := client.getBuiltInCreateRequest(ctx, templateSpecName, options) if err != nil { return ClientGetBuiltInResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetBuiltInResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetBuiltInResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetBuiltInResponse{}, err } - return client.getBuiltInHandleResponse(resp) + resp, err := client.getBuiltInHandleResponse(httpResp) + return resp, err } // getBuiltInCreateRequest creates the GetBuiltIn request. @@ -457,18 +470,21 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // - templateSpecName - Name of the Template Spec. // - options - ClientUpdateOptions contains the optional parameters for the Client.Update method. func (client *Client) Update(ctx context.Context, resourceGroupName string, templateSpecName string, options *ClientUpdateOptions) (ClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, templateSpecName, options) if err != nil { return ClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -495,7 +511,10 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.TemplateSpec != nil { - return req, runtime.MarshalAsJSON(req, *options.TemplateSpec) + if err := runtime.MarshalAsJSON(req, *options.TemplateSpec); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/resources/armtemplatespecs/client_example_test.go b/sdk/resourcemanager/resources/armtemplatespecs/client_example_test.go deleted file mode 100644 index f1ce8cb77e78..000000000000 --- a/sdk/resourcemanager/resources/armtemplatespecs/client_example_test.go +++ /dev/null @@ -1,371 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtemplatespecs_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/resources/armtemplatespecs" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsCreate.json -func ExampleClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "templateSpecRG", "simpleTemplateSpec", armtemplatespecs.TemplateSpec{ - Location: to.Ptr("eastus"), - Properties: &armtemplatespecs.TemplateSpecProperties{ - Description: to.Ptr("A very simple Template Spec"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TemplateSpec = armtemplatespecs.TemplateSpec{ - // Name: to.Ptr("simpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("A very simple Template Spec"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsPatch.json -func ExampleClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Update(ctx, "templateSpecRG", "simpleTemplateSpec", &armtemplatespecs.ClientUpdateOptions{TemplateSpec: &armtemplatespecs.TemplateSpecUpdateModel{ - Tags: map[string]*string{ - "myTag": to.Ptr("My Value"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TemplateSpec = armtemplatespecs.TemplateSpec{ - // Name: to.Ptr("simpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("A very simple Template Spec"), - // }, - // Tags: map[string]*string{ - // "myTag": to.Ptr("My Value"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsGet.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "templateSpecRG", "simpleTemplateSpec", &armtemplatespecs.ClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TemplateSpec = armtemplatespecs.TemplateSpec{ - // Name: to.Ptr("simpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("A very simple Template Spec"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsDelete.json -func ExampleClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewClient().Delete(ctx, "templateSpecRG", "simpleTemplateSpec", 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/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsListBySubscription.json -func ExampleClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListBySubscriptionPager(&armtemplatespecs.ClientListBySubscriptionOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListResult = armtemplatespecs.ListResult{ - // Value: []*armtemplatespecs.TemplateSpec{ - // { - // Name: to.Ptr("simpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("A very simple Template Spec"), - // }, - // }, - // { - // Name: to.Ptr("anotherSimpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG2/providers/Microsoft.Resources/templateSpecs/anotherSimpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("westus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("Another very simple Template Spec"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsListByResourceGroup.json -func ExampleClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListByResourceGroupPager("templateSpecRG", &armtemplatespecs.ClientListByResourceGroupOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListResult = armtemplatespecs.ListResult{ - // Value: []*armtemplatespecs.TemplateSpec{ - // { - // Name: to.Ptr("simpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("A very simple Template Spec"), - // }, - // }, - // { - // Name: to.Ptr("anotherSimpleTemplateSpec"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/anotherSimpleTemplateSpec"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("westus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("Another very simple Template Spec"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecsGet.json -func ExampleClient_GetBuiltIn() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().GetBuiltIn(ctx, "nameOfTheBuiltIn", &armtemplatespecs.ClientGetBuiltInOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TemplateSpec = armtemplatespecs.TemplateSpec{ - // Name: to.Ptr("nameOfTheBuiltIn"), - // Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs"), - // ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.1974346Z"); return t}()), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("The description of the built-in template spec"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecsList.json -func ExampleClient_NewListBuiltInsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListBuiltInsPager(&armtemplatespecs.ClientListBuiltInsOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListResult = armtemplatespecs.ListResult{ - // Value: []*armtemplatespecs.TemplateSpec{ - // { - // Name: to.Ptr("nameOfBuiltIn"), - // Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs"), - // ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfBuiltIn"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.1974346Z"); return t}()), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("The description of the built-in template spec"), - // }, - // }, - // { - // Name: to.Ptr("nameOfAnotherBuiltIn"), - // Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs"), - // ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfAnotherBuiltIn"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-03T03:01:01.1282121Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-03T05:22:06.1974346Z"); return t}()), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecProperties{ - // Description: to.Ptr("The description of another built-in template spec"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/resources/armtemplatespecs/client_factory.go b/sdk/resourcemanager/resources/armtemplatespecs/client_factory.go index cd6c34073142..4811fc5a14dc 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/client_factory.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs diff --git a/sdk/resourcemanager/resources/armtemplatespecs/constants.go b/sdk/resourcemanager/resources/armtemplatespecs/constants.go index 60cb638a9cd0..970741d82ea2 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/constants.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs const ( moduleName = "armtemplatespecs" - moduleVersion = "v1.1.1" + moduleVersion = "v1.1.2" ) // CreatedByType - The type of identity that created the resource. diff --git a/sdk/resourcemanager/resources/armtemplatespecs/go.mod b/sdk/resourcemanager/resources/armtemplatespecs/go.mod index c232f8bffadf..2521c5ddff7a 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/go.mod +++ b/sdk/resourcemanager/resources/armtemplatespecs/go.mod @@ -3,14 +3,14 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtempla go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -21,9 +21,9 @@ require ( github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/resources/armtemplatespecs/go.sum b/sdk/resourcemanager/resources/armtemplatespecs/go.sum index b0f97586a165..592e81cc36bb 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/go.sum +++ b/sdk/resourcemanager/resources/armtemplatespecs/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= @@ -31,12 +31,12 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/resources/armtemplatespecs/models.go b/sdk/resourcemanager/resources/armtemplatespecs/models.go index 34482f5c7b29..de01e85770fc 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/models.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs @@ -26,52 +25,6 @@ type AzureResourceBase struct { Type *string } -// ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method. -type ClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ClientDeleteOptions contains the optional parameters for the Client.Delete method. -type ClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ClientGetBuiltInOptions contains the optional parameters for the Client.GetBuiltIn method. -type ClientGetBuiltInOptions struct { - // Allows for expansion of additional Template Spec details in the response. Optional. - Expand *TemplateSpecExpandKind -} - -// ClientGetOptions contains the optional parameters for the Client.Get method. -type ClientGetOptions struct { - // Allows for expansion of additional Template Spec details in the response. Optional. - Expand *TemplateSpecExpandKind -} - -// ClientListBuiltInsOptions contains the optional parameters for the Client.NewListBuiltInsPager method. -type ClientListBuiltInsOptions struct { - // Allows for expansion of additional Template Spec details in the response. Optional. - Expand *TemplateSpecExpandKind -} - -// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. -type ClientListByResourceGroupOptions struct { - // Allows for expansion of additional Template Spec details in the response. Optional. - Expand *TemplateSpecExpandKind -} - -// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. -type ClientListBySubscriptionOptions struct { - // Allows for expansion of additional Template Spec details in the response. Optional. - Expand *TemplateSpecExpandKind -} - -// ClientUpdateOptions contains the optional parameters for the Client.Update method. -type ClientUpdateOptions struct { - // Template Spec resource with the tags to be updated. - TemplateSpec *TemplateSpecUpdateModel -} - // Error - Template Specs error response. type Error struct { // Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows @@ -278,46 +231,6 @@ type TemplateSpecVersionUpdateModel struct { Type *string } -// TemplateSpecVersionsClientCreateOrUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.CreateOrUpdate -// method. -type TemplateSpecVersionsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// TemplateSpecVersionsClientDeleteOptions contains the optional parameters for the TemplateSpecVersionsClient.Delete method. -type TemplateSpecVersionsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// TemplateSpecVersionsClientGetBuiltInOptions contains the optional parameters for the TemplateSpecVersionsClient.GetBuiltIn -// method. -type TemplateSpecVersionsClientGetBuiltInOptions struct { - // placeholder for future optional parameters -} - -// TemplateSpecVersionsClientGetOptions contains the optional parameters for the TemplateSpecVersionsClient.Get method. -type TemplateSpecVersionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TemplateSpecVersionsClientListBuiltInsOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListBuiltInsPager -// method. -type TemplateSpecVersionsClientListBuiltInsOptions struct { - // placeholder for future optional parameters -} - -// TemplateSpecVersionsClientListOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListPager -// method. -type TemplateSpecVersionsClientListOptions struct { - // placeholder for future optional parameters -} - -// TemplateSpecVersionsClientUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.Update method. -type TemplateSpecVersionsClientUpdateOptions struct { - // Template Spec Version resource with the tags to be updated. - TemplateSpecVersionUpdateModel *TemplateSpecVersionUpdateModel -} - // TemplateSpecVersionsListResult - List of Template Specs versions type TemplateSpecVersionsListResult struct { // An array of Template Spec versions. diff --git a/sdk/resourcemanager/resources/armtemplatespecs/models_serde.go b/sdk/resourcemanager/resources/armtemplatespecs/models_serde.go index 691260439439..e74c390dac8c 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/models_serde.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs diff --git a/sdk/resourcemanager/resources/armtemplatespecs/options.go b/sdk/resourcemanager/resources/armtemplatespecs/options.go new file mode 100644 index 000000000000..b57a6f978956 --- /dev/null +++ b/sdk/resourcemanager/resources/armtemplatespecs/options.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtemplatespecs + +// ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method. +type ClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ClientDeleteOptions contains the optional parameters for the Client.Delete method. +type ClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ClientGetBuiltInOptions contains the optional parameters for the Client.GetBuiltIn method. +type ClientGetBuiltInOptions struct { + // Allows for expansion of additional Template Spec details in the response. Optional. + Expand *TemplateSpecExpandKind +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // Allows for expansion of additional Template Spec details in the response. Optional. + Expand *TemplateSpecExpandKind +} + +// ClientListBuiltInsOptions contains the optional parameters for the Client.NewListBuiltInsPager method. +type ClientListBuiltInsOptions struct { + // Allows for expansion of additional Template Spec details in the response. Optional. + Expand *TemplateSpecExpandKind +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. +type ClientListByResourceGroupOptions struct { + // Allows for expansion of additional Template Spec details in the response. Optional. + Expand *TemplateSpecExpandKind +} + +// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. +type ClientListBySubscriptionOptions struct { + // Allows for expansion of additional Template Spec details in the response. Optional. + Expand *TemplateSpecExpandKind +} + +// ClientUpdateOptions contains the optional parameters for the Client.Update method. +type ClientUpdateOptions struct { + // Template Spec resource with the tags to be updated. + TemplateSpec *TemplateSpecUpdateModel +} + +// TemplateSpecVersionsClientCreateOrUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.CreateOrUpdate +// method. +type TemplateSpecVersionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TemplateSpecVersionsClientDeleteOptions contains the optional parameters for the TemplateSpecVersionsClient.Delete method. +type TemplateSpecVersionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TemplateSpecVersionsClientGetBuiltInOptions contains the optional parameters for the TemplateSpecVersionsClient.GetBuiltIn +// method. +type TemplateSpecVersionsClientGetBuiltInOptions struct { + // placeholder for future optional parameters +} + +// TemplateSpecVersionsClientGetOptions contains the optional parameters for the TemplateSpecVersionsClient.Get method. +type TemplateSpecVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TemplateSpecVersionsClientListBuiltInsOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListBuiltInsPager +// method. +type TemplateSpecVersionsClientListBuiltInsOptions struct { + // placeholder for future optional parameters +} + +// TemplateSpecVersionsClientListOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListPager +// method. +type TemplateSpecVersionsClientListOptions struct { + // placeholder for future optional parameters +} + +// TemplateSpecVersionsClientUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.Update method. +type TemplateSpecVersionsClientUpdateOptions struct { + // Template Spec Version resource with the tags to be updated. + TemplateSpecVersionUpdateModel *TemplateSpecVersionUpdateModel +} diff --git a/sdk/resourcemanager/resources/armtemplatespecs/response_types.go b/sdk/resourcemanager/resources/armtemplatespecs/response_types.go index cf6c742478dd..0fb15d444b12 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/response_types.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/response_types.go @@ -3,14 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs // ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. type ClientCreateOrUpdateResponse struct { + // Template Spec object. TemplateSpec } @@ -21,36 +21,43 @@ type ClientDeleteResponse struct { // ClientGetBuiltInResponse contains the response from method Client.GetBuiltIn. type ClientGetBuiltInResponse struct { + // Template Spec object. TemplateSpec } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { + // Template Spec object. TemplateSpec } // ClientListBuiltInsResponse contains the response from method Client.NewListBuiltInsPager. type ClientListBuiltInsResponse struct { + // List of Template Specs. ListResult } // ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. type ClientListByResourceGroupResponse struct { + // List of Template Specs. ListResult } // ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager. type ClientListBySubscriptionResponse struct { + // List of Template Specs. ListResult } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { + // Template Spec object. TemplateSpec } // TemplateSpecVersionsClientCreateOrUpdateResponse contains the response from method TemplateSpecVersionsClient.CreateOrUpdate. type TemplateSpecVersionsClientCreateOrUpdateResponse struct { + // Template Spec Version object. TemplateSpecVersion } @@ -61,25 +68,30 @@ type TemplateSpecVersionsClientDeleteResponse struct { // TemplateSpecVersionsClientGetBuiltInResponse contains the response from method TemplateSpecVersionsClient.GetBuiltIn. type TemplateSpecVersionsClientGetBuiltInResponse struct { + // Template Spec Version object. TemplateSpecVersion } // TemplateSpecVersionsClientGetResponse contains the response from method TemplateSpecVersionsClient.Get. type TemplateSpecVersionsClientGetResponse struct { + // Template Spec Version object. TemplateSpecVersion } // TemplateSpecVersionsClientListBuiltInsResponse contains the response from method TemplateSpecVersionsClient.NewListBuiltInsPager. type TemplateSpecVersionsClientListBuiltInsResponse struct { + // List of Template Specs versions TemplateSpecVersionsListResult } // TemplateSpecVersionsClientListResponse contains the response from method TemplateSpecVersionsClient.NewListPager. type TemplateSpecVersionsClientListResponse struct { + // List of Template Specs versions TemplateSpecVersionsListResult } // TemplateSpecVersionsClientUpdateResponse contains the response from method TemplateSpecVersionsClient.Update. type TemplateSpecVersionsClientUpdateResponse struct { + // Template Spec Version object. TemplateSpecVersion } diff --git a/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client.go b/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client.go index 8a7dc82ab5e8..d1f5e665a487 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs @@ -55,18 +54,21 @@ func NewTemplateSpecVersionsClient(subscriptionID string, credential azcore.Toke // - options - TemplateSpecVersionsClientCreateOrUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.CreateOrUpdate // method. func (client *TemplateSpecVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, templateSpecVersionModel TemplateSpecVersion, options *TemplateSpecVersionsClientCreateOrUpdateOptions) (TemplateSpecVersionsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, templateSpecName, templateSpecVersion, templateSpecVersionModel, options) if err != nil { return TemplateSpecVersionsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TemplateSpecVersionsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return TemplateSpecVersionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TemplateSpecVersionsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -96,7 +98,10 @@ func (client *TemplateSpecVersionsClient) createOrUpdateCreateRequest(ctx contex reqQP.Set("api-version", "2022-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, templateSpecVersionModel) + if err := runtime.MarshalAsJSON(req, templateSpecVersionModel); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -118,16 +123,18 @@ func (client *TemplateSpecVersionsClient) createOrUpdateHandleResponse(resp *htt // - options - TemplateSpecVersionsClientDeleteOptions contains the optional parameters for the TemplateSpecVersionsClient.Delete // method. func (client *TemplateSpecVersionsClient) Delete(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientDeleteOptions) (TemplateSpecVersionsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, templateSpecName, templateSpecVersion, options) if err != nil { return TemplateSpecVersionsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TemplateSpecVersionsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return TemplateSpecVersionsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TemplateSpecVersionsClientDeleteResponse{}, err } return TemplateSpecVersionsClientDeleteResponse{}, nil } @@ -172,18 +179,21 @@ func (client *TemplateSpecVersionsClient) deleteCreateRequest(ctx context.Contex // - options - TemplateSpecVersionsClientGetOptions contains the optional parameters for the TemplateSpecVersionsClient.Get // method. func (client *TemplateSpecVersionsClient) Get(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientGetOptions) (TemplateSpecVersionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, templateSpecName, templateSpecVersion, options) if err != nil { return TemplateSpecVersionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TemplateSpecVersionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TemplateSpecVersionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TemplateSpecVersionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -234,18 +244,21 @@ func (client *TemplateSpecVersionsClient) getHandleResponse(resp *http.Response) // - options - TemplateSpecVersionsClientGetBuiltInOptions contains the optional parameters for the TemplateSpecVersionsClient.GetBuiltIn // method. func (client *TemplateSpecVersionsClient) GetBuiltIn(ctx context.Context, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientGetBuiltInOptions) (TemplateSpecVersionsClientGetBuiltInResponse, error) { + var err error req, err := client.getBuiltInCreateRequest(ctx, templateSpecName, templateSpecVersion, options) if err != nil { return TemplateSpecVersionsClientGetBuiltInResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TemplateSpecVersionsClientGetBuiltInResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TemplateSpecVersionsClientGetBuiltInResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TemplateSpecVersionsClientGetBuiltInResponse{}, err } - return client.getBuiltInHandleResponse(resp) + resp, err := client.getBuiltInHandleResponse(httpResp) + return resp, err } // getBuiltInCreateRequest creates the GetBuiltIn request. @@ -420,18 +433,21 @@ func (client *TemplateSpecVersionsClient) listBuiltInsHandleResponse(resp *http. // - options - TemplateSpecVersionsClientUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.Update // method. func (client *TemplateSpecVersionsClient) Update(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientUpdateOptions) (TemplateSpecVersionsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, templateSpecName, templateSpecVersion, options) if err != nil { return TemplateSpecVersionsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TemplateSpecVersionsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TemplateSpecVersionsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TemplateSpecVersionsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -462,7 +478,10 @@ func (client *TemplateSpecVersionsClient) updateCreateRequest(ctx context.Contex req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.TemplateSpecVersionUpdateModel != nil { - return req, runtime.MarshalAsJSON(req, *options.TemplateSpecVersionUpdateModel) + if err := runtime.MarshalAsJSON(req, *options.TemplateSpecVersionUpdateModel); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client_example_test.go b/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client_example_test.go deleted file mode 100644 index d210a05c0f70..000000000000 --- a/sdk/resourcemanager/resources/armtemplatespecs/templatespecversions_client_example_test.go +++ /dev/null @@ -1,339 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtemplatespecs_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/resources/armtemplatespecs" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsCreate.json -func ExampleTemplateSpecVersionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTemplateSpecVersionsClient().CreateOrUpdate(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", armtemplatespecs.TemplateSpecVersion{ - Location: to.Ptr("eastus"), - Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - Description: to.Ptr("This is version v1.0 of our template content"), - MainTemplate: map[string]any{ - "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": map[string]any{}, - "resources": []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.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{ - // Name: to.Ptr("v1.0"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is version v1.0 of our template content"), - // MainTemplate: map[string]any{ - // "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - // "contentVersion": "1.0.0.0", - // "parameters":map[string]any{ - // }, - // "resources":[]any{ - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsPatch.json -func ExampleTemplateSpecVersionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTemplateSpecVersionsClient().Update(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", &armtemplatespecs.TemplateSpecVersionsClientUpdateOptions{TemplateSpecVersionUpdateModel: &armtemplatespecs.TemplateSpecVersionUpdateModel{ - Tags: map[string]*string{ - "myTag": to.Ptr("My Value"), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{ - // Name: to.Ptr("v1.0"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is version v1.0 of our template content"), - // MainTemplate: map[string]any{ - // "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - // "contentVersion": "1.0.0.0", - // "parameters":map[string]any{ - // }, - // "resources":[]any{ - // }, - // }, - // }, - // Tags: map[string]*string{ - // "myTag": to.Ptr("My Value"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsGet.json -func ExampleTemplateSpecVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTemplateSpecVersionsClient().Get(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.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.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{ - // Name: to.Ptr("v1.0"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is version v1.0 of our template content"), - // MainTemplate: map[string]any{ - // "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - // "contentVersion": "1.0.0.0", - // "parameters":map[string]any{ - // }, - // "resources":[]any{ - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsDelete.json -func ExampleTemplateSpecVersionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTemplateSpecVersionsClient().Delete(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsList.json -func ExampleTemplateSpecVersionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTemplateSpecVersionsClient().NewListPager("templateSpecRG", "simpleTemplateSpec", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TemplateSpecVersionsListResult = armtemplatespecs.TemplateSpecVersionsListResult{ - // Value: []*armtemplatespecs.TemplateSpecVersion{ - // { - // Name: to.Ptr("v1.0"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is version v1.0"), - // }, - // }, - // { - // Name: to.Ptr("v2.0"), - // Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v2.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is another version (v2.0)"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecVersionsList.json -func ExampleTemplateSpecVersionsClient_NewListBuiltInsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTemplateSpecVersionsClient().NewListBuiltInsPager("nameOfTheBuiltIn", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TemplateSpecVersionsListResult = armtemplatespecs.TemplateSpecVersionsListResult{ - // Value: []*armtemplatespecs.TemplateSpecVersion{ - // { - // Name: to.Ptr("v1.0"), - // Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs/versions"), - // ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn/versions/v1.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.1075056Z"); return t}()), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is version v1.0"), - // }, - // }, - // { - // Name: to.Ptr("v2.0"), - // Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs/versions"), - // ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn/versions/v2.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.1974346Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.1974346Z"); return t}()), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is another version (v2.0)"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecVersionsGet.json -func ExampleTemplateSpecVersionsClient_GetBuiltIn() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtemplatespecs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTemplateSpecVersionsClient().GetBuiltIn(ctx, "nameOfTheBuiltIn", "v1.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.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{ - // Name: to.Ptr("v1.0"), - // Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs/versions"), - // ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn/versions/v1.0"), - // SystemData: &armtemplatespecs.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.1075056Z"); return t}()), - // }, - // Location: to.Ptr("eastus"), - // Properties: &armtemplatespecs.TemplateSpecVersionProperties{ - // Description: to.Ptr("This is version v1.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/resources/armtemplatespecs/time_rfc3339.go b/sdk/resourcemanager/resources/armtemplatespecs/time_rfc3339.go index 5412efd677f8..902da9e8f1e3 100644 --- a/sdk/resourcemanager/resources/armtemplatespecs/time_rfc3339.go +++ b/sdk/resourcemanager/resources/armtemplatespecs/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtemplatespecs