diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md index 02b439d56211..f0e3618c7bd1 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/CHANGELOG.md @@ -1,5 +1,39 @@ # Release History +## 2.0.0 (2022-05-24) +### Breaking Changes + +- Struct `SubResource` has been removed + +### Features Added + +- New const `ProvisioningErrorCodeBadValidatorType` +- New const `ProvisioningErrorCodeNoValidatorScript` +- New const `ProvisioningErrorCodeUnsupportedValidatorType` +- New const `ProvisioningErrorCodeBadStagingResourceGroup` +- New const `RunSubStateValidating` +- New function `ImageTemplatePropertiesValidate.MarshalJSON() ([]byte, error)` +- New function `*ImageTemplatePropertiesValidate.UnmarshalJSON([]byte) error` +- New function `*ImageTemplateInVMValidator.GetImageTemplateInVMValidator() *ImageTemplateInVMValidator` +- New function `*ImageTemplatePowerShellValidator.GetImageTemplateInVMValidator() *ImageTemplateInVMValidator` +- New function `ImageTemplatePowerShellValidator.MarshalJSON() ([]byte, error)` +- New function `*ImageTemplatePowerShellValidator.UnmarshalJSON([]byte) error` +- New function `*ImageTemplateShellValidator.GetImageTemplateInVMValidator() *ImageTemplateInVMValidator` +- New function `ImageTemplateShellValidator.MarshalJSON() ([]byte, error)` +- New function `*ImageTemplateShellValidator.UnmarshalJSON([]byte) error` +- New struct `ImageTemplateInVMValidator` +- New struct `ImageTemplatePowerShellValidator` +- New struct `ImageTemplatePropertiesValidate` +- New struct `ImageTemplateShellValidator` +- New struct `ProxyResource` +- New field `SystemData` in struct `TrackedResource` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `RunOutput` +- New field `ExactStagingResourceGroup` in struct `ImageTemplateProperties` +- New field `Validate` in struct `ImageTemplateProperties` +- New field `StagingResourceGroup` in struct `ImageTemplateProperties` + + ## 1.0.0 (2022-05-18) ### Breaking Changes diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md index f7c3d2308f65..fc1dcf6dc7b5 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/imagebuilder/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/imagebuilder/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/imagebuilder/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/imagebuilder/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod index e69512498ae1..65162df1316e 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/virtualmachineimage go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum index ed5b814680ee..3f874a3bc5a6 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/go.sum @@ -1,33 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.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.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go deleted file mode 100644 index ed575d055b35..000000000000 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvirtualmachineimagebuilder_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-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() - client, err := armvirtualmachineimagebuilder.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go deleted file mode 100644 index 7a1c6aae273c..000000000000 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/ze_generated_example_virtualmachineimagetemplates_client_test.go +++ /dev/null @@ -1,309 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armvirtualmachineimagebuilder_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/virtualmachineimagebuilder/armvirtualmachineimagebuilder" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplates.json -func ExampleVirtualMachineImageTemplatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplatesByRg.json -func ExampleVirtualMachineImageTemplatesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateLinux.json -func ExampleVirtualMachineImageTemplatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myImageTemplate", - armvirtualmachineimagebuilder.ImageTemplate{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "imagetemplate_tag1": to.Ptr("IT_T1"), - "imagetemplate_tag2": to.Ptr("IT_T2"), - }, - Identity: &armvirtualmachineimagebuilder.ImageTemplateIdentity{ - Type: to.Ptr(armvirtualmachineimagebuilder.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armvirtualmachineimagebuilder.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {}, - }, - }, - Properties: &armvirtualmachineimagebuilder.ImageTemplateProperties{ - Customize: []armvirtualmachineimagebuilder.ImageTemplateCustomizerClassification{ - &armvirtualmachineimagebuilder.ImageTemplateShellCustomizer{ - Name: to.Ptr("Shell Customizer Example"), - Type: to.Ptr("Shell"), - ScriptURI: to.Ptr("https://example.com/path/to/script.sh"), - }}, - Distribute: []armvirtualmachineimagebuilder.ImageTemplateDistributorClassification{ - &armvirtualmachineimagebuilder.ImageTemplateManagedImageDistributor{ - Type: to.Ptr("ManagedImage"), - ArtifactTags: map[string]*string{ - "tagName": to.Ptr("value"), - }, - RunOutputName: to.Ptr("image_it_pir_1"), - ImageID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1"), - Location: to.Ptr("1_location"), - }}, - Source: &armvirtualmachineimagebuilder.ImageTemplateManagedImageSource{ - Type: to.Ptr("ManagedImage"), - ImageID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"), - }, - VMProfile: &armvirtualmachineimagebuilder.ImageTemplateVMProfile{ - OSDiskSizeGB: to.Ptr[int32](64), - VMSize: to.Ptr("Standard_D2s_v3"), - VnetConfig: &armvirtualmachineimagebuilder.VirtualNetworkConfig{ - SubnetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"), - }, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateToRemoveIdentities.json -func ExampleVirtualMachineImageTemplatesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myImageTemplate", - armvirtualmachineimagebuilder.ImageTemplateUpdateParameters{ - Identity: &armvirtualmachineimagebuilder.ImageTemplateIdentity{ - Type: to.Ptr(armvirtualmachineimagebuilder.ResourceIdentityTypeNone), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetImageTemplate.json -func ExampleVirtualMachineImageTemplatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myImageTemplate", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/DeleteImageTemplate.json -func ExampleVirtualMachineImageTemplatesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myImageTemplate", - 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/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/RunImageTemplate.json -func ExampleVirtualMachineImageTemplatesClient_BeginRun() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRun(ctx, - "myResourceGroup", - "myImageTemplate", - 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/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CancelImageBuild.json -func ExampleVirtualMachineImageTemplatesClient_BeginCancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCancel(ctx, - "myResourceGroup", - "myImageTemplate", - 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/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListRunOutputs.json -func ExampleVirtualMachineImageTemplatesClient_NewListRunOutputsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListRunOutputsPager("myResourceGroup", - "myImageTemplate", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetRunOutput.json -func ExampleVirtualMachineImageTemplatesClient_GetRunOutput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armvirtualmachineimagebuilder.NewVirtualMachineImageTemplatesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetRunOutput(ctx, - "myResourceGroup", - "myImageTemplate", - "myManagedImageOutput", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go index fbcb15c4be29..6fb2f86b83b3 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_constants.go @@ -10,7 +10,7 @@ package armvirtualmachineimagebuilder const ( moduleName = "armvirtualmachineimagebuilder" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // CreatedByType - The type of identity that created the resource. @@ -44,10 +44,14 @@ const ( ProvisioningErrorCodeBadSharedImageDistribute ProvisioningErrorCode = "BadSharedImageDistribute" ProvisioningErrorCodeBadSharedImageVersionSource ProvisioningErrorCode = "BadSharedImageVersionSource" ProvisioningErrorCodeBadSourceType ProvisioningErrorCode = "BadSourceType" + ProvisioningErrorCodeBadStagingResourceGroup ProvisioningErrorCode = "BadStagingResourceGroup" + ProvisioningErrorCodeBadValidatorType ProvisioningErrorCode = "BadValidatorType" ProvisioningErrorCodeNoCustomizerScript ProvisioningErrorCode = "NoCustomizerScript" + ProvisioningErrorCodeNoValidatorScript ProvisioningErrorCode = "NoValidatorScript" ProvisioningErrorCodeOther ProvisioningErrorCode = "Other" ProvisioningErrorCodeServerError ProvisioningErrorCode = "ServerError" ProvisioningErrorCodeUnsupportedCustomizerType ProvisioningErrorCode = "UnsupportedCustomizerType" + ProvisioningErrorCodeUnsupportedValidatorType ProvisioningErrorCode = "UnsupportedValidatorType" ) // PossibleProvisioningErrorCodeValues returns the possible values for the ProvisioningErrorCode const type. @@ -60,10 +64,14 @@ func PossibleProvisioningErrorCodeValues() []ProvisioningErrorCode { ProvisioningErrorCodeBadSharedImageDistribute, ProvisioningErrorCodeBadSharedImageVersionSource, ProvisioningErrorCodeBadSourceType, + ProvisioningErrorCodeBadStagingResourceGroup, + ProvisioningErrorCodeBadValidatorType, ProvisioningErrorCodeNoCustomizerScript, + ProvisioningErrorCodeNoValidatorScript, ProvisioningErrorCodeOther, ProvisioningErrorCodeServerError, ProvisioningErrorCodeUnsupportedCustomizerType, + ProvisioningErrorCodeUnsupportedValidatorType, } } @@ -137,6 +145,7 @@ const ( RunSubStateQueued RunSubState = "Queued" RunSubStateBuilding RunSubState = "Building" RunSubStateCustomizing RunSubState = "Customizing" + RunSubStateValidating RunSubState = "Validating" RunSubStateDistributing RunSubState = "Distributing" ) @@ -146,6 +155,7 @@ func PossibleRunSubStateValues() []RunSubState { RunSubStateQueued, RunSubStateBuilding, RunSubStateCustomizing, + RunSubStateValidating, RunSubStateDistributing, } } diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go index 11dfa306fab7..b25518ca261f 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models.go @@ -59,7 +59,7 @@ type ImageTemplate struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -150,6 +150,29 @@ type ImageTemplateIdentity struct { UserAssignedIdentities map[string]*ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties `json:"userAssignedIdentities,omitempty"` } +// ImageTemplateInVMValidatorClassification provides polymorphic access to related types. +// Call the interface's GetImageTemplateInVMValidator() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ImageTemplateInVMValidator, *ImageTemplatePowerShellValidator, *ImageTemplateShellValidator +type ImageTemplateInVMValidatorClassification interface { + // GetImageTemplateInVMValidator returns the ImageTemplateInVMValidator content of the underlying type. + GetImageTemplateInVMValidator() *ImageTemplateInVMValidator +} + +// ImageTemplateInVMValidator - Describes a unit of in-VM validation of image +type ImageTemplateInVMValidator struct { + // REQUIRED; The type of validation you want to use on the Image. For example, "Shell" can be shell validation + Type *string `json:"type,omitempty"` + + // Friendly Name to provide context on what this validation step does + Name *string `json:"name,omitempty"` +} + +// GetImageTemplateInVMValidator implements the ImageTemplateInVMValidatorClassification interface for type ImageTemplateInVMValidator. +func (i *ImageTemplateInVMValidator) GetImageTemplateInVMValidator() *ImageTemplateInVMValidator { + return i +} + // ImageTemplateLastRunStatus - Describes the latest status of running an image template type ImageTemplateLastRunStatus struct { // End time of the last run (UTC) @@ -204,7 +227,8 @@ func (i *ImageTemplateManagedImageDistributor) GetImageTemplateDistributor() *Im } } -// ImageTemplateManagedImageSource - Describes an image source that is a managed image in customer subscription. +// ImageTemplateManagedImageSource - Describes an image source that is a managed image in customer subscription. This image +// must reside in the same subscription and region as the Image Builder template. type ImageTemplateManagedImageSource struct { // REQUIRED; ARM resource id of the managed image in customer subscription ImageID *string `json:"imageId,omitempty"` @@ -292,6 +316,43 @@ func (i *ImageTemplatePowerShellCustomizer) GetImageTemplateCustomizer() *ImageT } } +// ImageTemplatePowerShellValidator - Runs the specified PowerShell script during the validation phase (Windows). Corresponds +// to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. +type ImageTemplatePowerShellValidator struct { + // REQUIRED; The type of validation you want to use on the Image. For example, "Shell" can be shell validation + Type *string `json:"type,omitempty"` + + // Array of PowerShell commands to execute + Inline []*string `json:"inline,omitempty"` + + // Friendly Name to provide context on what this validation step does + Name *string `json:"name,omitempty"` + + // If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true + // when the runElevated field above is set to true. + RunAsSystem *bool `json:"runAsSystem,omitempty"` + + // If specified, the PowerShell script will be run with elevated privileges + RunElevated *bool `json:"runElevated,omitempty"` + + // SHA256 checksum of the power shell script provided in the scriptUri field above + SHA256Checksum *string `json:"sha256Checksum,omitempty"` + + // URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc + ScriptURI *string `json:"scriptUri,omitempty"` + + // Valid exit codes for the PowerShell script. [Default: 0] + ValidExitCodes []*int32 `json:"validExitCodes,omitempty"` +} + +// GetImageTemplateInVMValidator implements the ImageTemplateInVMValidatorClassification interface for type ImageTemplatePowerShellValidator. +func (i *ImageTemplatePowerShellValidator) GetImageTemplateInVMValidator() *ImageTemplateInVMValidator { + return &ImageTemplateInVMValidator{ + Type: i.Type, + Name: i.Name, + } +} + // ImageTemplateProperties - Describes the properties of an image template type ImageTemplateProperties struct { // REQUIRED; The distribution targets where the image output needs to go to. @@ -300,15 +361,33 @@ type ImageTemplateProperties struct { // REQUIRED; Specifies the properties used to describe the source image. Source ImageTemplateSourceClassification `json:"source,omitempty"` - // Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + // Maximum duration to wait while building the image template (includes all customizations, validations, and distributions). + // Omit or specify 0 to use the default (4 hours). BuildTimeoutInMinutes *int32 `json:"buildTimeoutInMinutes,omitempty"` // Specifies the properties used to describe the customization steps of the image, like Image source etc Customize []ImageTemplateCustomizerClassification `json:"customize,omitempty"` + // The staging resource group id in the same subscription as the image template that will be used to build the image. If this + // field is empty, a resource group with a random name will be created. If the + // resource group specified in this field doesn't exist, it will be created with the same name. If the resource group specified + // exists, it must be empty and in the same region as the image template. The + // resource group created will be deleted during template deletion if this field is empty or the resource group specified + // doesn't exist, but if the resource group specified exists the resources created + // in the resource group will be deleted during template deletion and the resource group itself will remain. + StagingResourceGroup *string `json:"stagingResourceGroup,omitempty"` + // Describes how virtual machine is set up to build images VMProfile *ImageTemplateVMProfile `json:"vmProfile,omitempty"` + // Configuration options and list of validations to be performed on the resulting image. + Validate *ImageTemplatePropertiesValidate `json:"validate,omitempty"` + + // READ-ONLY; The staging resource group id in the same subscription as the image template that will be used to build the + // image. This read-only field differs from 'stagingResourceGroup' only if the value specified + // in the 'stagingResourceGroup' field is empty. + ExactStagingResourceGroup *string `json:"exactStagingResourceGroup,omitempty" azure:"ro"` + // READ-ONLY; State of 'run' that is currently executing or was last executed. LastRunStatus *ImageTemplateLastRunStatus `json:"lastRunStatus,omitempty" azure:"ro"` @@ -319,6 +398,23 @@ type ImageTemplateProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } +// ImageTemplatePropertiesValidate - Configuration options and list of validations to be performed on the resulting image. +type ImageTemplatePropertiesValidate struct { + // If validation fails and this field is set to false, output image(s) will not be distributed. This is the default behavior. + // If validation fails and this field is set to true, output image(s) will still + // be distributed. Please use this option with caution as it may result in bad images being distributed for use. In either + // case (true or false), the end to end image run will be reported as having failed + // in case of a validation failure. [Note: This field has no effect if validation succeeds.] + ContinueDistributeOnFailure *bool `json:"continueDistributeOnFailure,omitempty"` + + // List of validations to be performed. + InVMValidations []ImageTemplateInVMValidatorClassification `json:"inVMValidations,omitempty"` + + // If this field is set to true, the image specified in the 'source' section will directly be validated. No separate build + // will be run to generate and then validate a customized image. + SourceValidationOnly *bool `json:"sourceValidationOnly,omitempty"` +} + // ImageTemplateRestartCustomizer - Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart // provisioner type ImageTemplateRestartCustomizer struct { @@ -422,6 +518,33 @@ func (i *ImageTemplateShellCustomizer) GetImageTemplateCustomizer() *ImageTempla } } +// ImageTemplateShellValidator - Runs the specified shell script during the validation phase (Linux). Corresponds to Packer +// shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. +type ImageTemplateShellValidator struct { + // REQUIRED; The type of validation you want to use on the Image. For example, "Shell" can be shell validation + Type *string `json:"type,omitempty"` + + // Array of shell commands to execute + Inline []*string `json:"inline,omitempty"` + + // Friendly Name to provide context on what this validation step does + Name *string `json:"name,omitempty"` + + // SHA256 checksum of the shell script provided in the scriptUri field + SHA256Checksum *string `json:"sha256Checksum,omitempty"` + + // URI of the shell script to be run for validation. It can be a github link, Azure Storage URI, etc + ScriptURI *string `json:"scriptUri,omitempty"` +} + +// GetImageTemplateInVMValidator implements the ImageTemplateInVMValidatorClassification interface for type ImageTemplateShellValidator. +func (i *ImageTemplateShellValidator) GetImageTemplateInVMValidator() *ImageTemplateInVMValidator { + return &ImageTemplateInVMValidator{ + Type: i.Type, + Name: i.Name, + } +} + // ImageTemplateSourceClassification provides polymorphic access to related types. // Call the interface's GetImageTemplateSource() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -449,20 +572,20 @@ type ImageTemplateUpdateParameters struct { Tags map[string]*string `json:"tags,omitempty"` } -// ImageTemplateVMProfile - Describes the virtual machine used to build, customize and capture images +// ImageTemplateVMProfile - Describes the virtual machines used to build and validate images type ImageTemplateVMProfile struct { // Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. OSDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // Optional array of resource IDs of user assigned managed identities to be configured on the build VM. This may include the - // identity of the image template. + // Optional array of resource IDs of user assigned managed identities to be configured on the build VM and validation VM. + // This may include the identity of the image template. UserAssignedIdentities []*string `json:"userAssignedIdentities,omitempty"` // Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default - // (StandardD2dsv4). + // (StandardD1v2 for Gen1 images and StandardD2dsv4 for Gen2 images). VMSize *string `json:"vmSize,omitempty"` - // Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual + // Optional configuration of the virtual network to use to deploy the build VM and validation VM in. Omit if no specific virtual // network needs to be used. VnetConfig *VirtualNetworkConfig `json:"vnetConfig,omitempty"` } @@ -585,6 +708,22 @@ type ProvisioningError struct { ProvisioningErrorCode *ProvisioningErrorCode `json:"provisioningErrorCode,omitempty"` } +// 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} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + // 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} @@ -593,22 +732,28 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } // RunOutput - Represents an output that was created by running an image template. type RunOutput struct { - // REQUIRED; Resource name - Name *string `json:"name,omitempty"` - // The properties of the run output Properties *RunOutputProperties `json:"properties,omitempty"` - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Resource type + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -633,18 +778,6 @@ type RunOutputProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// SubResource - The Sub Resource model definition. -type SubResource struct { - // REQUIRED; Resource name - Name *string `json:"name,omitempty"` - - // READ-ONLY; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource type - Type *string `json:"type,omitempty" azure:"ro"` -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -681,6 +814,9 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -752,8 +888,8 @@ type VirtualMachineImageTemplatesClientListRunOutputsOptions struct { // VirtualNetworkConfig - Virtual Network configuration. type VirtualNetworkConfig struct { - // Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default - // (StandardD1v2 for Gen1 images and StandardD2dsv4 for Gen2 images). + // Size of the proxy virtual machine used to pass traffic to the build VM and validation VM. Omit or specify empty string + // to use the default (StandardA1v2). ProxyVMSize *string `json:"proxyVmSize,omitempty"` // Resource id of a pre-existing subnet. diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go index 664adb1a375b..95757c6804e1 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_models_serde.go @@ -312,17 +312,75 @@ func (i *ImageTemplatePowerShellCustomizer) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ImageTemplatePowerShellValidator. +func (i ImageTemplatePowerShellValidator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inline", i.Inline) + populate(objectMap, "name", i.Name) + populate(objectMap, "runAsSystem", i.RunAsSystem) + populate(objectMap, "runElevated", i.RunElevated) + populate(objectMap, "sha256Checksum", i.SHA256Checksum) + populate(objectMap, "scriptUri", i.ScriptURI) + objectMap["type"] = "PowerShell" + populate(objectMap, "validExitCodes", i.ValidExitCodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplatePowerShellValidator. +func (i *ImageTemplatePowerShellValidator) UnmarshalJSON(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 "inline": + err = unpopulate(val, "Inline", &i.Inline) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "runAsSystem": + err = unpopulate(val, "RunAsSystem", &i.RunAsSystem) + delete(rawMsg, key) + case "runElevated": + err = unpopulate(val, "RunElevated", &i.RunElevated) + delete(rawMsg, key) + case "sha256Checksum": + err = unpopulate(val, "SHA256Checksum", &i.SHA256Checksum) + delete(rawMsg, key) + case "scriptUri": + err = unpopulate(val, "ScriptURI", &i.ScriptURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "validExitCodes": + err = unpopulate(val, "ValidExitCodes", &i.ValidExitCodes) + 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 ImageTemplateProperties. func (i ImageTemplateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "buildTimeoutInMinutes", i.BuildTimeoutInMinutes) populate(objectMap, "customize", i.Customize) populate(objectMap, "distribute", i.Distribute) + populate(objectMap, "exactStagingResourceGroup", i.ExactStagingResourceGroup) populate(objectMap, "lastRunStatus", i.LastRunStatus) populate(objectMap, "provisioningError", i.ProvisioningError) populate(objectMap, "provisioningState", i.ProvisioningState) populate(objectMap, "source", i.Source) + populate(objectMap, "stagingResourceGroup", i.StagingResourceGroup) populate(objectMap, "vmProfile", i.VMProfile) + populate(objectMap, "validate", i.Validate) return json.Marshal(objectMap) } @@ -344,6 +402,9 @@ func (i *ImageTemplateProperties) UnmarshalJSON(data []byte) error { case "distribute": i.Distribute, err = unmarshalImageTemplateDistributorClassificationArray(val) delete(rawMsg, key) + case "exactStagingResourceGroup": + err = unpopulate(val, "ExactStagingResourceGroup", &i.ExactStagingResourceGroup) + delete(rawMsg, key) case "lastRunStatus": err = unpopulate(val, "LastRunStatus", &i.LastRunStatus) delete(rawMsg, key) @@ -356,9 +417,50 @@ func (i *ImageTemplateProperties) UnmarshalJSON(data []byte) error { case "source": i.Source, err = unmarshalImageTemplateSourceClassification(val) delete(rawMsg, key) + case "stagingResourceGroup": + err = unpopulate(val, "StagingResourceGroup", &i.StagingResourceGroup) + delete(rawMsg, key) case "vmProfile": err = unpopulate(val, "VMProfile", &i.VMProfile) delete(rawMsg, key) + case "validate": + err = unpopulate(val, "Validate", &i.Validate) + 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 ImageTemplatePropertiesValidate. +func (i ImageTemplatePropertiesValidate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "continueDistributeOnFailure", i.ContinueDistributeOnFailure) + populate(objectMap, "inVMValidations", i.InVMValidations) + populate(objectMap, "sourceValidationOnly", i.SourceValidationOnly) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplatePropertiesValidate. +func (i *ImageTemplatePropertiesValidate) UnmarshalJSON(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 "continueDistributeOnFailure": + err = unpopulate(val, "ContinueDistributeOnFailure", &i.ContinueDistributeOnFailure) + delete(rawMsg, key) + case "inVMValidations": + i.InVMValidations, err = unmarshalImageTemplateInVMValidatorClassificationArray(val) + delete(rawMsg, key) + case "sourceValidationOnly": + err = unpopulate(val, "SourceValidationOnly", &i.SourceValidationOnly) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -535,6 +637,49 @@ func (i *ImageTemplateShellCustomizer) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ImageTemplateShellValidator. +func (i ImageTemplateShellValidator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inline", i.Inline) + populate(objectMap, "name", i.Name) + populate(objectMap, "sha256Checksum", i.SHA256Checksum) + populate(objectMap, "scriptUri", i.ScriptURI) + objectMap["type"] = "Shell" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageTemplateShellValidator. +func (i *ImageTemplateShellValidator) UnmarshalJSON(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 "inline": + err = unpopulate(val, "Inline", &i.Inline) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "sha256Checksum": + err = unpopulate(val, "SHA256Checksum", &i.SHA256Checksum) + delete(rawMsg, key) + case "scriptUri": + err = unpopulate(val, "ScriptURI", &i.ScriptURI) + 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 ImageTemplateUpdateParameters. func (i ImageTemplateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -684,6 +829,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go index 3f04fb1d953a..44e5933a596d 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_operations_client.go @@ -50,7 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists available operations for the Microsoft.VirtualMachineImages provider // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go index eca2c7f15b0f..b4ed5d172006 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_polymorphic_helpers.go @@ -96,6 +96,45 @@ func unmarshalImageTemplateDistributorClassificationArray(rawMsg json.RawMessage return fArray, nil } +func unmarshalImageTemplateInVMValidatorClassification(rawMsg json.RawMessage) (ImageTemplateInVMValidatorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ImageTemplateInVMValidatorClassification + switch m["type"] { + case "PowerShell": + b = &ImageTemplatePowerShellValidator{} + case "Shell": + b = &ImageTemplateShellValidator{} + default: + b = &ImageTemplateInVMValidator{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalImageTemplateInVMValidatorClassificationArray(rawMsg json.RawMessage) ([]ImageTemplateInVMValidatorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ImageTemplateInVMValidatorClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalImageTemplateInVMValidatorClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + func unmarshalImageTemplateSourceClassification(rawMsg json.RawMessage) (ImageTemplateSourceClassification, error) { if rawMsg == nil { return nil, nil diff --git a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go index 8588ae8c0c38..9269d4d542fe 100644 --- a/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go +++ b/sdk/resourcemanager/virtualmachineimagebuilder/armvirtualmachineimagebuilder/zz_generated_virtualmachineimagetemplates_client.go @@ -57,7 +57,7 @@ func NewVirtualMachineImageTemplatesClient(subscriptionID string, credential azc // BeginCancel - Cancel the long running image build based on the image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientBeginCancelOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginCancel @@ -78,7 +78,7 @@ func (client *VirtualMachineImageTemplatesClient) BeginCancel(ctx context.Contex // Cancel - Cancel the long running image build based on the image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 func (client *VirtualMachineImageTemplatesClient) cancel(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginCancelOptions) (*http.Response, error) { req, err := client.cancelCreateRequest(ctx, resourceGroupName, imageTemplateName, options) if err != nil { @@ -114,7 +114,7 @@ func (client *VirtualMachineImageTemplatesClient) cancelCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,7 +122,7 @@ func (client *VirtualMachineImageTemplatesClient) cancelCreateRequest(ctx contex // BeginCreateOrUpdate - Create or update a virtual machine image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // parameters - Parameters supplied to the CreateImageTemplate operation @@ -144,7 +144,7 @@ func (client *VirtualMachineImageTemplatesClient) BeginCreateOrUpdate(ctx contex // CreateOrUpdate - Create or update a virtual machine image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 func (client *VirtualMachineImageTemplatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplate, options *VirtualMachineImageTemplatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, imageTemplateName, parameters, options) if err != nil { @@ -180,7 +180,7 @@ func (client *VirtualMachineImageTemplatesClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -188,7 +188,7 @@ func (client *VirtualMachineImageTemplatesClient) createOrUpdateCreateRequest(ct // BeginDelete - Delete a virtual machine image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginDelete @@ -209,7 +209,7 @@ func (client *VirtualMachineImageTemplatesClient) BeginDelete(ctx context.Contex // Delete - Delete a virtual machine image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 func (client *VirtualMachineImageTemplatesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, imageTemplateName, options) if err != nil { @@ -245,7 +245,7 @@ func (client *VirtualMachineImageTemplatesClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +253,7 @@ func (client *VirtualMachineImageTemplatesClient) deleteCreateRequest(ctx contex // Get - Get information about a virtual machine image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientGetOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.Get @@ -293,7 +293,7 @@ func (client *VirtualMachineImageTemplatesClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,7 +310,7 @@ func (client *VirtualMachineImageTemplatesClient) getHandleResponse(resp *http.R // GetRunOutput - Get the specified run output for the specified image template resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // runOutputName - The name of the run output @@ -355,7 +355,7 @@ func (client *VirtualMachineImageTemplatesClient) getRunOutputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -372,7 +372,7 @@ func (client *VirtualMachineImageTemplatesClient) getRunOutputHandleResponse(res // NewListPager - Gets information about the VM image templates associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // options - VirtualMachineImageTemplatesClientListOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.List // method. func (client *VirtualMachineImageTemplatesClient) NewListPager(options *VirtualMachineImageTemplatesClientListOptions) *runtime.Pager[VirtualMachineImageTemplatesClientListResponse] { @@ -415,7 +415,7 @@ func (client *VirtualMachineImageTemplatesClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -432,7 +432,7 @@ func (client *VirtualMachineImageTemplatesClient) listHandleResponse(resp *http. // NewListByResourceGroupPager - Gets information about the VM image templates associated with the specified resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // options - VirtualMachineImageTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.ListByResourceGroup // method. @@ -480,7 +480,7 @@ func (client *VirtualMachineImageTemplatesClient) listByResourceGroupCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -497,7 +497,7 @@ func (client *VirtualMachineImageTemplatesClient) listByResourceGroupHandleRespo // NewListRunOutputsPager - List all run outputs for the specified Image Template resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientListRunOutputsOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.ListRunOutputs @@ -550,7 +550,7 @@ func (client *VirtualMachineImageTemplatesClient) listRunOutputsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -567,7 +567,7 @@ func (client *VirtualMachineImageTemplatesClient) listRunOutputsHandleResponse(r // BeginRun - Create artifacts from a existing image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // options - VirtualMachineImageTemplatesClientBeginRunOptions contains the optional parameters for the VirtualMachineImageTemplatesClient.BeginRun @@ -588,7 +588,7 @@ func (client *VirtualMachineImageTemplatesClient) BeginRun(ctx context.Context, // Run - Create artifacts from a existing image template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 func (client *VirtualMachineImageTemplatesClient) run(ctx context.Context, resourceGroupName string, imageTemplateName string, options *VirtualMachineImageTemplatesClientBeginRunOptions) (*http.Response, error) { req, err := client.runCreateRequest(ctx, resourceGroupName, imageTemplateName, options) if err != nil { @@ -624,7 +624,7 @@ func (client *VirtualMachineImageTemplatesClient) runCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -632,7 +632,7 @@ func (client *VirtualMachineImageTemplatesClient) runCreateRequest(ctx context.C // BeginUpdate - Update the tags for this Virtual Machine Image Template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 // resourceGroupName - The name of the resource group. // imageTemplateName - The name of the image Template // parameters - Additional parameters for Image Template update. @@ -654,7 +654,7 @@ func (client *VirtualMachineImageTemplatesClient) BeginUpdate(ctx context.Contex // Update - Update the tags for this Virtual Machine Image Template // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-10-01 +// Generated from API version 2022-02-14 func (client *VirtualMachineImageTemplatesClient) update(ctx context.Context, resourceGroupName string, imageTemplateName string, parameters ImageTemplateUpdateParameters, options *VirtualMachineImageTemplatesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, imageTemplateName, parameters, options) if err != nil { @@ -690,7 +690,7 @@ func (client *VirtualMachineImageTemplatesClient) updateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2022-02-14") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters)