From 89fac2da077dd6cde82e1c2edee7ac7c6a2409f9 Mon Sep 17 00:00:00 2001 From: Catalina Peralta Date: Tue, 1 Dec 2020 09:37:10 -0800 Subject: [PATCH 1/3] Adding resources e2e samples --- go.mod | 5 +- go.sum | 23 ++ sdk/resources/example_deployments_test.go | 143 +++++++++ sdk/resources/parameters.json | 32 ++ sdk/resources/template.json | 353 ++++++++++++++++++++++ 5 files changed, 554 insertions(+), 2 deletions(-) create mode 100644 sdk/resources/example_deployments_test.go create mode 100644 sdk/resources/parameters.json create mode 100644 sdk/resources/template.json diff --git a/go.mod b/go.mod index 0410cc2b9..de63b2aa4 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,9 @@ require ( github.com/Azure/azure-event-hubs-go v1.3.0 github.com/Azure/azure-pipeline-go v0.1.9 // indirect github.com/Azure/azure-sdk-for-go v48.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/arm/resources/2020-06-01/armresources v0.1.0 + github.com/Azure/azure-sdk-for-go/sdk/armcore v0.5.1 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.6.0 github.com/Azure/azure-storage-blob-go v0.0.0-20181023070848-cf01652132cc github.com/Azure/go-autorest/autorest v0.11.10 github.com/Azure/go-autorest/autorest/adal v0.9.5 @@ -22,6 +25,4 @@ require ( github.com/marstr/randname v0.0.0-20181206212954-d5b0f288ab8c github.com/pkg/errors v0.8.1 github.com/satori/go.uuid v1.2.0 - golang.org/x/net v0.0.0-20190520210107-018c4d40a106 // indirect - golang.org/x/sys v0.0.0-20190520201301-c432e742b0af // indirect ) diff --git a/go.sum b/go.sum index d7dd578ec..d9e22f0d2 100644 --- a/go.sum +++ b/go.sum @@ -24,6 +24,19 @@ github.com/Azure/azure-sdk-for-go v46.4.0+incompatible h1:fCN6Pi+tEiEwFa8RSmtVlF github.com/Azure/azure-sdk-for-go v46.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v48.0.0+incompatible h1:adRBpSbkY3IAgqBA83nSDN8yXDsy48zJNPqSwZabDNQ= github.com/Azure/azure-sdk-for-go v48.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v49.0.0+incompatible h1:rvYYNgKNBwoxUaBFmd/+TpW3qrd805EHBBvUp5FmFso= +github.com/Azure/azure-sdk-for-go/sdk/arm/resources/2020-06-01/armresources v0.1.0 h1:lukRorBGhLmNospZsyC4ZBmKFSPjFm0EP2zhnURENSQ= +github.com/Azure/azure-sdk-for-go/sdk/arm/resources/2020-06-01/armresources v0.1.0/go.mod h1:BLfFIsqo/B2o7zUM/QbeTe9uu4FMpBjARi20XbmrOq8= +github.com/Azure/azure-sdk-for-go/sdk/armcore v0.5.1 h1:VGqJCzGuqWjTvMspLSaWHiP1vUOA0lAdjoPXjhltfQQ= +github.com/Azure/azure-sdk-for-go/sdk/armcore v0.5.1/go.mod h1:+sBBoB6bha/qi//hAzfa4dd8EWRKBNYzSJjb9IccpXM= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.1/go.mod h1:pElNP+u99BvCZD+0jOlhI9OC/NB2IDTOTGZOZH0Qhq8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.4 h1:7MfvHEWKfjZSKQNWERlXpHwCRoceEuQef/fB8CWmnQA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.4/go.mod h1:pElNP+u99BvCZD+0jOlhI9OC/NB2IDTOTGZOZH0Qhq8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.6.0 h1:ksvSe0GxLR0H4narxWihjuz2a90JsmrUELJM9qulh+0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.6.0/go.mod h1:BfjVb0eeNKsOveaOBnAgUv6nSq5hwScOz7mCm9lqUx8= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.0 h1:HG1ggl8L3ZkV/Ydanf7lKr5kkhhPGCpWdnr1J6v7cO4= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.0/go.mod h1:k4KbFSunV/+0hOHL1vyFaPsiYQ1Vmvy1TBpmtvCDLZM= +github.com/Azure/azure-sdk-for-go/sdk/to v0.1.2/go.mod h1:UL/d4lvWAzSJUuX+19uKdN0ktyjoOyQhgY+HWNgtIYI= github.com/Azure/azure-storage-blob-go v0.0.0-20181023070848-cf01652132cc h1:BElWmFfsryQD72OcovStKpkIcd4e9ozSkdsTNQDSHGk= github.com/Azure/azure-storage-blob-go v0.0.0-20181023070848-cf01652132cc/go.mod h1:oGfmITT1V6x//CswqY2gtAHND+xIP64/qL7a5QJix0Y= github.com/Azure/go-autorest v11.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= @@ -176,6 +189,8 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -219,6 +234,8 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -237,6 +254,9 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190520210107-018c4d40a106 h1:EZofHp/BzEf3j39/+7CX1JvH0WaPG+ikBrqAdAPf+GM= golang.org/x/net v0.0.0-20190520210107-018c4d40a106/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -254,9 +274,12 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190520201301-c432e742b0af h1:NXfmMfXz6JqGfG3ikSxcz2N93j6DgScr19Oo2uwFu88= golang.org/x/sys v0.0.0-20190520201301-c432e742b0af/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/sdk/resources/example_deployments_test.go b/sdk/resources/example_deployments_test.go new file mode 100644 index 000000000..8cb6304ec --- /dev/null +++ b/sdk/resources/example_deployments_test.go @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +package resources + +import ( + "context" + "encoding/json" + "io/ioutil" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/arm/resources/2020-06-01/armresources" + "github.com/Azure/azure-sdk-for-go/sdk/armcore" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" +) + +// func ExampleDeploymentsClient_BeginCreateOrUpdate() { +func CreateOrUpdateDeployment(template string, parameters string) (*armresources.DeploymentExtended, error) { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + return nil, err + } + client := armresources.NewDeploymentsClient(armcore.NewDefaultConnection(cred, nil), "") + data, err := ioutil.ReadFile(template) + if err != nil { + return nil, err + } + contents := make(map[string]interface{}) + if err := json.Unmarshal(data, &contents); err != nil { + return nil, err + } + data, err = ioutil.ReadFile(parameters) + if err != nil { + return nil, err + } + params := make(map[string]interface{}) + if err := json.Unmarshal(data, ¶ms); err != nil { + return nil, err + } + poller, err := client.BeginCreateOrUpdate( + context.Background(), + "", + "", + armresources.Deployment{ + Properties: &armresources.DeploymentProperties{ + Template: contents, + Parameters: params, + Mode: armresources.DeploymentModeIncremental.ToPtr(), + }, + }, + nil, + ) + if err != nil { + return nil, err + } + resp, err := poller.PollUntilDone(context.Background(), 5*time.Second) + if err != nil { + return nil, err + } + return resp.DeploymentExtended, nil +} + +// func ExampleDeploymentsClient_BeginValidate() { +func ValidateDeployment(template string, parameters string) (*armresources.DeploymentValidateResult, error) { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + return nil, err + } + client := armresources.NewDeploymentsClient(armcore.NewDefaultConnection(cred, nil), "") + data, err := ioutil.ReadFile(template) + if err != nil { + return nil, err + } + contents := make(map[string]interface{}) + if err := json.Unmarshal(data, &contents); err != nil { + return nil, err + } + data, err = ioutil.ReadFile(parameters) + if err != nil { + return nil, err + } + params := make(map[string]interface{}) + if err := json.Unmarshal(data, ¶ms); err != nil { + return nil, err + } + poller, err := client.BeginValidate( + context.Background(), + "", + "", + armresources.Deployment{ + Properties: &armresources.DeploymentProperties{ + Mode: armresources.DeploymentModeIncremental.ToPtr(), + Parameters: params, + Template: contents, + }, + }, + nil, + ) + if err != nil { + return nil, err + } + resp, err := poller.PollUntilDone(context.Background(), 5*time.Second) + if err != nil { + return nil, err + } + return resp.DeploymentValidateResult, nil +} + +// func ExampleDeploymentsClient_Get() { +func GetDeployment(id string) (*armresources.DeploymentExtended, error) { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + return nil, err + } + client := armresources.NewDeploymentsClient(armcore.NewDefaultConnection(cred, nil), "") + dep, err := client.Get(context.Background(), "", id, nil) + if err != nil { + return nil, err + } + return dep.DeploymentExtended, nil +} + +func ExampleDeploymentsClient() { + depValid, err := ValidateDeployment("template.json", "parameters.json") + if err != nil { + log.Fatalf("failed to validate deployment: %v", err) + } + log.Print("validated deployment") + if depValid.Error != nil { + log.Fatalf("deployment validation failed: %v", depValid.Error.Message) + } + dep, err := CreateOrUpdateDeployment("template.json", "parameters.json") + if err != nil { + log.Fatalf("failed to create deployment: %v", err) + } + log.Print("created deployment") + depCheck, err := GetDeployment(*dep.Name) + if err != nil { + log.Fatalf("failed to get deployment: %v", err) + } + log.Printf("retreived deployment. Deployment ID: %v", *depCheck.ID) +} diff --git a/sdk/resources/parameters.json b/sdk/resources/parameters.json new file mode 100644 index 000000000..9f3e57743 --- /dev/null +++ b/sdk/resources/parameters.json @@ -0,0 +1,32 @@ +{ + "virtualNetworks_GoQSVM_vnet_name": { + "value": "QuickstartVnet" + }, + "virtualMachines_QuickstartVM_name": { + "value": "QuickstartVM" + }, + "networkInterfaces_quickstartvm_name": { + "value": "QuickstartNIC" + }, + "publicIPAddresses_QuickstartVM_ip_name": { + "value": "QuickstartIP" + }, + "networkSecurityGroups_QuickstartVM_nsg_name": { + "value": "QuickstartNSG" + }, + "subnets_default_name": { + "value": "QuickstartSubnet" + }, + "securityRules_default_allow_ssh_name": { + "value": "qsuser" + }, + "osDisk_name": { + "value": "_OsDisk_1_2e3ae1ad37414eaca81b432401fcdd75" + }, + "vm_user": { + "value": "quickstart" + }, + "vm_password": { + "value": "NoSoupForYou!1" + } +} diff --git a/sdk/resources/template.json b/sdk/resources/template.json new file mode 100644 index 000000000..82920b834 --- /dev/null +++ b/sdk/resources/template.json @@ -0,0 +1,353 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "virtualNetworks_GoQSVM_vnet_name": { + "defaultValue": null, + "type": "String" + }, + "virtualMachines_QuickstartVM_name": { + "defaultValue": null, + "type": "String" + }, + "networkInterfaces_quickstartvm_name": { + "defaultValue": null, + "type": "String" + }, + "publicIPAddresses_QuickstartVM_ip_name": { + "defaultValue": null, + "type": "String" + }, + "networkSecurityGroups_QuickstartVM_nsg_name": { + "defaultValue": null, + "type": "String" + }, + "subnets_default_name": { + "defaultValue": null, + "type": "String" + }, + "securityRules_default_allow_ssh_name": { + "defaultValue": null, + "type": "String" + }, + "osDisk_name": { + "defaultvalue": null, + "type": "String" + }, + "vm_user": { + "defaultValue": null, + "type":"String" + }, + "vm_password": { + "defaultValue": null, + "type": "String" + } + }, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines", + "name": "[parameters('virtualMachines_QuickstartVM_name')]", + "apiVersion": "2017-03-30", + "location": "eastus", + "scale": null, + "properties": { + "hardwareProfile": { + "vmSize": "Standard_B1s" + }, + "storageProfile": { + "imageReference": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "16.04-LTS", + "version": "latest" + }, + "osDisk": { + "osType": "Linux", + "name": "[concat(parameters('virtualMachines_QuickstartVM_name'), parameters('osDisk_name'))]", + "createOption": "FromImage", + "caching": "ReadWrite", + "managedDisk": { + "storageAccountType": "Premium_LRS" + }, + "diskSizeGB": 30 + }, + "dataDisks": [] + }, + "osProfile": { + "computerName": "[parameters('virtualMachines_QuickstartVM_name')]", + "adminUsername": "[parameters('vm_user')]", + "adminPassword": "[parameters('vm_password')]", + "linuxConfiguration": { + "disablePasswordAuthentication": false + }, + "secrets": [] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_quickstartvm_name'))]" + } + ] + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_quickstartvm_name'))]" + ] + }, + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[parameters('networkInterfaces_quickstartvm_name')]", + "apiVersion": "2017-06-01", + "location": "eastus", + "scale": null, + "properties": { + "provisioningState": "Succeeded", + "resourceGuid": "d25c4596-2f13-4758-bccb-35cde6369ed6", + "ipConfigurations": [ + { + "name": "ipconfig1", + "etag": "W/\"ce7de133-36d6-45a0-901e-a76a1ae65cc5\"", + "properties": { + "provisioningState": "Succeeded", + "privateIPAddress": "10.0.0.4", + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_QuickstartVM_ip_name'))]" + }, + "subnet": { + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_GoQSVM_vnet_name'), parameters('subnets_default_name'))]" + }, + "primary": true, + "privateIPAddressVersion": "IPv4" + } + } + ], + "dnsSettings": { + "dnsServers": [], + "appliedDnsServers": [], + "internalDomainNameSuffix": "w2dmkj1zjdbelhvojagffco4ja.bx.internal.cloudapp.net" + }, + "macAddress": "00-0D-3A-1C-E3-A9", + "enableAcceleratedNetworking": false, + "enableIPForwarding": false, + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_QuickstartVM_nsg_name'))]" + }, + "primary": true, + "virtualMachine": { + "id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_QuickstartVM_name'))]" + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_QuickstartVM_ip_name'))]", + "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_GoQSVM_vnet_name'), parameters('subnets_default_name'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_QuickstartVM_nsg_name'))]" + ] + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[parameters('networkSecurityGroups_QuickstartVM_nsg_name')]", + "apiVersion": "2017-06-01", + "location": "eastus", + "scale": null, + "properties": { + "provisioningState": "Succeeded", + "resourceGuid": "6c8dc2b9-7688-4907-a483-c33308540c85", + "securityRules": [ + ], + "defaultSecurityRules": [ + { + "name": "AllowVnetInBound", + "etag": "W/\"578e9cf5-4d23-40cc-aed4-4ed9646b52df\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow inbound traffic from all VMs in VNET", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "VirtualNetwork", + "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", + "priority": 65000, + "direction": "Inbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + } + }, + { + "name": "AllowAzureLoadBalancerInBound", + "etag": "W/\"578e9cf5-4d23-40cc-aed4-4ed9646b52df\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow inbound traffic from azure load balancer", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "AzureLoadBalancer", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 65001, + "direction": "Inbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + } + }, + { + "name": "DenyAllInBound", + "etag": "W/\"578e9cf5-4d23-40cc-aed4-4ed9646b52df\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Deny all inbound traffic", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 65500, + "direction": "Inbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + } + }, + { + "name": "AllowVnetOutBound", + "etag": "W/\"578e9cf5-4d23-40cc-aed4-4ed9646b52df\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow outbound traffic from all VMs to all VMs in VNET", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "VirtualNetwork", + "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", + "priority": 65000, + "direction": "Outbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + } + }, + { + "name": "AllowInternetOutBound", + "etag": "W/\"578e9cf5-4d23-40cc-aed4-4ed9646b52df\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow outbound traffic from all VMs to Internet", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "Internet", + "access": "Allow", + "priority": 65001, + "direction": "Outbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + } + }, + { + "name": "DenyAllOutBound", + "etag": "W/\"578e9cf5-4d23-40cc-aed4-4ed9646b52df\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Deny all outbound traffic", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 65500, + "direction": "Outbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + } + } + ] + }, + "dependsOn": [] + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[parameters('publicIPAddresses_QuickstartVM_ip_name')]", + "apiVersion": "2017-06-01", + "location": "eastus", + "scale": null, + "properties": { + "provisioningState": "Succeeded", + "resourceGuid": "48b2c96b-40e6-4378-973c-fd9b7b066c2c", + "ipAddress": "40.121.193.102", + "publicIPAddressVersion": "IPv4", + "publicIPAllocationMethod": "Dynamic", + "idleTimeoutInMinutes": 4 + }, + "dependsOn": [] + }, + { + "type": "Microsoft.Network/virtualNetworks", + "name": "[parameters('virtualNetworks_GoQSVM_vnet_name')]", + "apiVersion": "2017-06-01", + "location": "eastus", + "scale": null, + "properties": { + "provisioningState": "Succeeded", + "resourceGuid": "27c506b7-4879-45c2-9eae-480c5289de48", + "addressSpace": { + "addressPrefixes": [ + "10.0.0.0/24" + ] + }, + "subnets": [ + { + "name": "[parameters('subnets_default_name')]", + "etag": "W/\"2d36bb91-8d73-4836-b61b-658cb73debbc\"", + "properties": { + "provisioningState": "Succeeded", + "addressPrefix": "10.0.0.0/24" + } + } + ], + "virtualNetworkPeerings": [] + }, + "dependsOn": [] + }, + { + "type": "Microsoft.Network/networkSecurityGroups/securityRules", + "name": "[concat(parameters('networkSecurityGroups_QuickstartVM_nsg_name'), '/', parameters('securityRules_default_allow_ssh_name'))]", + "apiVersion": "2017-06-01", + "scale": null, + "properties": { + "provisioningState": "Succeeded", + "protocol": "TCP", + "sourcePortRange": "*", + "destinationPortRange": "22", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 1000, + "direction": "Inbound", + "sourceAddressPrefixes": [], + "destinationAddressPrefixes": [] + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_QuickstartVM_nsg_name'))]" + ] + }, + { + "type": "Microsoft.Network/virtualNetworks/subnets", + "name": "[concat(parameters('virtualNetworks_GoQSVM_vnet_name'), '/', parameters('subnets_default_name'))]", + "apiVersion": "2017-06-01", + "scale": null, + "properties": { + "provisioningState": "Succeeded", + "addressPrefix": "10.0.0.0/24" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_GoQSVM_vnet_name'))]" + ] + } + ] + } + \ No newline at end of file From 926f25c230522f44a5a46f8cfbc429fcec3ea2d7 Mon Sep 17 00:00:00 2001 From: Catalina Peralta Date: Tue, 1 Dec 2020 09:40:20 -0800 Subject: [PATCH 2/3] remove commented code --- sdk/resources/example_deployments_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/sdk/resources/example_deployments_test.go b/sdk/resources/example_deployments_test.go index 8cb6304ec..caf32d561 100644 --- a/sdk/resources/example_deployments_test.go +++ b/sdk/resources/example_deployments_test.go @@ -15,7 +15,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" ) -// func ExampleDeploymentsClient_BeginCreateOrUpdate() { func CreateOrUpdateDeployment(template string, parameters string) (*armresources.DeploymentExtended, error) { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +60,6 @@ func CreateOrUpdateDeployment(template string, parameters string) (*armresources return resp.DeploymentExtended, nil } -// func ExampleDeploymentsClient_BeginValidate() { func ValidateDeployment(template string, parameters string) (*armresources.DeploymentValidateResult, error) { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -107,7 +105,6 @@ func ValidateDeployment(template string, parameters string) (*armresources.Deplo return resp.DeploymentValidateResult, nil } -// func ExampleDeploymentsClient_Get() { func GetDeployment(id string) (*armresources.DeploymentExtended, error) { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { From e4c1d01e2d0786b1d5df8f9031ec7ea95f904bc4 Mon Sep 17 00:00:00 2001 From: Catalina Peralta Date: Tue, 1 Dec 2020 09:52:38 -0800 Subject: [PATCH 3/3] add newline --- sdk/resources/template.json | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/resources/template.json b/sdk/resources/template.json index 82920b834..9c363e4eb 100644 --- a/sdk/resources/template.json +++ b/sdk/resources/template.json @@ -350,4 +350,3 @@ } ] } - \ No newline at end of file