armtemplatespecs

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 14 Imported by: 2

README

Azure Template Specs Module for Go

PkgGoDev

The armtemplatespecs module provides operations for working with Azure Template Specs.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Template Specs module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Template Specs. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Client Factory

Azure Template Specs module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armtemplatespecs.NewClientFactory(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armtemplatespecs.NewClientFactory(<subscription ID>, cred, &options)

Clients

A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.

client := clientFactory.NewClient()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Template Specs label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureResourceBase

type AzureResourceBase struct {
	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string

	// READ-ONLY; Name of this resource.
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; Type of this resource.
	Type *string
}

AzureResourceBase - Common properties for all Azure resources.

func (AzureResourceBase) MarshalJSON

func (a AzureResourceBase) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AzureResourceBase.

func (*AzureResourceBase) UnmarshalJSON added in v1.1.0

func (a *AzureResourceBase) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceBase.

type Client added in v0.2.0

type Client struct {
	// contains filtered or unexported fields
}

Client contains the methods for the TemplateSpecs group. Don't use this type directly, use NewClient() instead.

func NewClient added in v0.2.0

func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error)

NewClient creates a new instance of Client with the specified values.

  • subscriptionID - Subscription Id which forms part of the URI for every service call.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*Client) CreateOrUpdate added in v0.2.0

func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpec TemplateSpec, options *ClientCreateOrUpdateOptions) (ClientCreateOrUpdateResponse, error)

CreateOrUpdate - Creates or updates a Template Spec. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • templateSpec - Template Spec supplied to the operation.
  • options - ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsCreate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "templateSpecRG", "simpleTemplateSpec", armtemplatespecs.TemplateSpec{
		Location: to.Ptr("eastus"),
		Properties: &armtemplatespecs.TemplateSpecProperties{
			Description: to.Ptr("A very simple Template Spec"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpec = armtemplatespecs.TemplateSpec{
	// 	Name: to.Ptr("simpleTemplateSpec"),
	// 	Type: to.Ptr("Microsoft.Resources/templateSpecs"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		CreatedBy: to.Ptr("string"),
	// 		CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("string"),
	// 		LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecProperties{
	// 		Description: to.Ptr("A very simple Template Spec"),
	// 	},
	// }
}
Output:

func (*Client) Delete added in v0.2.0

func (client *Client) Delete(ctx context.Context, resourceGroupName string, templateSpecName string, options *ClientDeleteOptions) (ClientDeleteResponse, error)

Delete - Deletes a Template Spec by name. When operation completes, status code 200 returned without content. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • options - ClientDeleteOptions contains the optional parameters for the Client.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsDelete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewClient().Delete(ctx, "templateSpecRG", "simpleTemplateSpec", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*Client) Get added in v0.2.0

func (client *Client) Get(ctx context.Context, resourceGroupName string, templateSpecName string, options *ClientGetOptions) (ClientGetResponse, error)

Get - Gets a Template Spec with a given name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • options - ClientGetOptions contains the optional parameters for the Client.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Get(ctx, "templateSpecRG", "simpleTemplateSpec", &armtemplatespecs.ClientGetOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpec = armtemplatespecs.TemplateSpec{
	// 	Name: to.Ptr("simpleTemplateSpec"),
	// 	Type: to.Ptr("Microsoft.Resources/templateSpecs"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		CreatedBy: to.Ptr("string"),
	// 		CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("string"),
	// 		LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecProperties{
	// 		Description: to.Ptr("A very simple Template Spec"),
	// 	},
	// }
}
Output:

func (*Client) GetBuiltIn added in v1.0.0

func (client *Client) GetBuiltIn(ctx context.Context, templateSpecName string, options *ClientGetBuiltInOptions) (ClientGetBuiltInResponse, error)

GetBuiltIn - Gets a built-in Template Spec with a given name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • templateSpecName - Name of the Template Spec.
  • options - ClientGetBuiltInOptions contains the optional parameters for the Client.GetBuiltIn method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecsGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().GetBuiltIn(ctx, "nameOfTheBuiltIn", &armtemplatespecs.ClientGetBuiltInOptions{Expand: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpec = armtemplatespecs.TemplateSpec{
	// 	Name: to.Ptr("nameOfTheBuiltIn"),
	// 	Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs"),
	// 	ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.107Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.197Z"); return t}()),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecProperties{
	// 		Description: to.Ptr("The description of the built-in template spec"),
	// 	},
	// }
}
Output:

func (*Client) NewListBuiltInsPager added in v1.0.0

func (client *Client) NewListBuiltInsPager(options *ClientListBuiltInsOptions) *runtime.Pager[ClientListBuiltInsResponse]

NewListBuiltInsPager - Lists built-in Template Specs.

Generated from API version 2022-02-01

  • options - ClientListBuiltInsOptions contains the optional parameters for the Client.NewListBuiltInsPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListBuiltInsPager(&armtemplatespecs.ClientListBuiltInsOptions{Expand: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ListResult = armtemplatespecs.ListResult{
		// 	Value: []*armtemplatespecs.TemplateSpec{
		// 		{
		// 			Name: to.Ptr("nameOfBuiltIn"),
		// 			Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs"),
		// 			ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfBuiltIn"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.107Z"); return t}()),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.197Z"); return t}()),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecProperties{
		// 				Description: to.Ptr("The description of the built-in template spec"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("nameOfAnotherBuiltIn"),
		// 			Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs"),
		// 			ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfAnotherBuiltIn"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-03T03:01:01.128Z"); return t}()),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-03T05:22:06.197Z"); return t}()),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecProperties{
		// 				Description: to.Ptr("The description of another built-in template spec"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*Client) NewListByResourceGroupPager added in v0.4.0

func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse]

NewListByResourceGroupPager - Lists all the Template Specs within the specified resource group.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsListByResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListByResourceGroupPager("templateSpecRG", &armtemplatespecs.ClientListByResourceGroupOptions{Expand: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ListResult = armtemplatespecs.ListResult{
		// 	Value: []*armtemplatespecs.TemplateSpec{
		// 		{
		// 			Name: to.Ptr("simpleTemplateSpec"),
		// 			Type: to.Ptr("Microsoft.Resources/templateSpecs"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
		// 				CreatedBy: to.Ptr("string"),
		// 				CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("string"),
		// 				LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecProperties{
		// 				Description: to.Ptr("A very simple Template Spec"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("anotherSimpleTemplateSpec"),
		// 			Type: to.Ptr("Microsoft.Resources/templateSpecs"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/anotherSimpleTemplateSpec"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T01:01:01.107Z"); return t}()),
		// 				CreatedBy: to.Ptr("string"),
		// 				CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T02:03:01.197Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("string"),
		// 				LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 			},
		// 			Location: to.Ptr("westus"),
		// 			Properties: &armtemplatespecs.TemplateSpecProperties{
		// 				Description: to.Ptr("Another very simple Template Spec"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*Client) NewListBySubscriptionPager added in v0.4.0

func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse]

NewListBySubscriptionPager - Lists all the Template Specs within the specified subscriptions.

Generated from API version 2022-02-01

  • options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsListBySubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListBySubscriptionPager(&armtemplatespecs.ClientListBySubscriptionOptions{Expand: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ListResult = armtemplatespecs.ListResult{
		// 	Value: []*armtemplatespecs.TemplateSpec{
		// 		{
		// 			Name: to.Ptr("simpleTemplateSpec"),
		// 			Type: to.Ptr("Microsoft.Resources/templateSpecs"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
		// 				CreatedBy: to.Ptr("string"),
		// 				CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("string"),
		// 				LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecProperties{
		// 				Description: to.Ptr("A very simple Template Spec"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("anotherSimpleTemplateSpec"),
		// 			Type: to.Ptr("Microsoft.Resources/templateSpecs"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG2/providers/Microsoft.Resources/templateSpecs/anotherSimpleTemplateSpec"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T01:01:01.107Z"); return t}()),
		// 				CreatedBy: to.Ptr("string"),
		// 				CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T02:03:01.197Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("string"),
		// 				LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 			},
		// 			Location: to.Ptr("westus"),
		// 			Properties: &armtemplatespecs.TemplateSpecProperties{
		// 				Description: to.Ptr("Another very simple Template Spec"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*Client) Update added in v0.2.0

func (client *Client) Update(ctx context.Context, resourceGroupName string, templateSpecName string, options *ClientUpdateOptions) (ClientUpdateResponse, error)

Update - Updates Template Spec tags with specified values. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • options - ClientUpdateOptions contains the optional parameters for the Client.Update method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecsPatch.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Update(ctx, "templateSpecRG", "simpleTemplateSpec", &armtemplatespecs.ClientUpdateOptions{TemplateSpec: &armtemplatespecs.TemplateSpecUpdateModel{
		Tags: map[string]*string{
			"myTag": to.Ptr("My Value"),
		},
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpec = armtemplatespecs.TemplateSpec{
	// 	Name: to.Ptr("simpleTemplateSpec"),
	// 	Type: to.Ptr("Microsoft.Resources/templateSpecs"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		CreatedBy: to.Ptr("string"),
	// 		CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("string"),
	// 		LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecProperties{
	// 		Description: to.Ptr("A very simple Template Spec"),
	// 	},
	// 	Tags: map[string]*string{
	// 		"myTag": to.Ptr("My Value"),
	// 	},
	// }
}
Output:

type ClientCreateOrUpdateOptions added in v0.2.0

type ClientCreateOrUpdateOptions struct {
}

ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method.

type ClientCreateOrUpdateResponse added in v0.2.0

type ClientCreateOrUpdateResponse struct {
	// Template Spec object.
	TemplateSpec
}

ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate.

type ClientDeleteOptions added in v0.2.0

type ClientDeleteOptions struct {
}

ClientDeleteOptions contains the optional parameters for the Client.Delete method.

type ClientDeleteResponse added in v0.2.0

type ClientDeleteResponse struct {
}

ClientDeleteResponse contains the response from method Client.Delete.

type ClientFactory added in v1.1.0

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v1.1.0

func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

  • subscriptionID - Subscription Id which forms part of the URI for every service call.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewClient added in v1.1.0

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

func (*ClientFactory) NewTemplateSpecVersionsClient added in v1.1.0

func (c *ClientFactory) NewTemplateSpecVersionsClient() *TemplateSpecVersionsClient

NewTemplateSpecVersionsClient creates a new instance of TemplateSpecVersionsClient.

type ClientGetBuiltInOptions added in v1.0.0

type ClientGetBuiltInOptions struct {
	// Allows for expansion of additional Template Spec details in the response. Optional.
	Expand *TemplateSpecExpandKind
}

ClientGetBuiltInOptions contains the optional parameters for the Client.GetBuiltIn method.

type ClientGetBuiltInResponse added in v1.0.0

type ClientGetBuiltInResponse struct {
	// Template Spec object.
	TemplateSpec
}

ClientGetBuiltInResponse contains the response from method Client.GetBuiltIn.

type ClientGetOptions added in v0.2.0

type ClientGetOptions struct {
	// Allows for expansion of additional Template Spec details in the response. Optional.
	Expand *TemplateSpecExpandKind
}

ClientGetOptions contains the optional parameters for the Client.Get method.

type ClientGetResponse added in v0.2.0

type ClientGetResponse struct {
	// Template Spec object.
	TemplateSpec
}

ClientGetResponse contains the response from method Client.Get.

type ClientListBuiltInsOptions added in v1.0.0

type ClientListBuiltInsOptions struct {
	// Allows for expansion of additional Template Spec details in the response. Optional.
	Expand *TemplateSpecExpandKind
}

ClientListBuiltInsOptions contains the optional parameters for the Client.NewListBuiltInsPager method.

type ClientListBuiltInsResponse added in v1.0.0

type ClientListBuiltInsResponse struct {
	// List of Template Specs.
	ListResult
}

ClientListBuiltInsResponse contains the response from method Client.NewListBuiltInsPager.

type ClientListByResourceGroupOptions added in v0.2.0

type ClientListByResourceGroupOptions struct {
	// Allows for expansion of additional Template Spec details in the response. Optional.
	Expand *TemplateSpecExpandKind
}

ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method.

type ClientListByResourceGroupResponse added in v0.2.0

type ClientListByResourceGroupResponse struct {
	// List of Template Specs.
	ListResult
}

ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager.

type ClientListBySubscriptionOptions added in v0.2.0

type ClientListBySubscriptionOptions struct {
	// Allows for expansion of additional Template Spec details in the response. Optional.
	Expand *TemplateSpecExpandKind
}

ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method.

type ClientListBySubscriptionResponse added in v0.2.0

type ClientListBySubscriptionResponse struct {
	// List of Template Specs.
	ListResult
}

ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager.

type ClientUpdateOptions added in v0.2.0

type ClientUpdateOptions struct {
	// Template Spec resource with the tags to be updated.
	TemplateSpec *TemplateSpecUpdateModel
}

ClientUpdateOptions contains the optional parameters for the Client.Update method.

type ClientUpdateResponse added in v0.2.0

type ClientUpdateResponse struct {
	// Template Spec object.
	TemplateSpec
}

ClientUpdateResponse contains the response from method Client.Update.

type CreatedByType

type CreatedByType string

CreatedByType - The type of identity that created the resource.

const (
	CreatedByTypeApplication     CreatedByType = "Application"
	CreatedByTypeKey             CreatedByType = "Key"
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	CreatedByTypeUser            CreatedByType = "User"
)

func PossibleCreatedByTypeValues

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type Error added in v0.2.0

type Error struct {
	// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows
	// the OData error response format.)
	Error *ErrorResponse
}

Error - Template Specs error response.

func (Error) MarshalJSON added in v1.1.0

func (e Error) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Error.

func (*Error) UnmarshalJSON added in v1.1.0

func (e *Error) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Error.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info any

	// READ-ONLY; The additional info type.
	Type *string
}

ErrorAdditionalInfo - The resource management error additional info.

func (ErrorAdditionalInfo) MarshalJSON added in v1.1.0

func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo.

func (*ErrorAdditionalInfo) UnmarshalJSON added in v1.1.0

func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo.

type ErrorResponse

type ErrorResponse struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo

	// READ-ONLY; The error code.
	Code *string

	// READ-ONLY; The error details.
	Details []*ErrorResponse

	// READ-ONLY; The error message.
	Message *string

	// READ-ONLY; The error target.
	Target *string
}

ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)

func (ErrorResponse) MarshalJSON

func (e ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v1.1.0

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type LinkedTemplateArtifact

type LinkedTemplateArtifact struct {
	// REQUIRED; A filesystem safe relative path of the artifact.
	Path *string

	// REQUIRED; The Azure Resource Manager template.
	Template any
}

LinkedTemplateArtifact - Represents a Template Spec artifact containing an embedded Azure Resource Manager template for use as a linked template.

func (LinkedTemplateArtifact) MarshalJSON added in v1.1.0

func (l LinkedTemplateArtifact) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LinkedTemplateArtifact.

func (*LinkedTemplateArtifact) UnmarshalJSON added in v1.1.0

func (l *LinkedTemplateArtifact) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LinkedTemplateArtifact.

type ListResult added in v0.2.0

type ListResult struct {
	// An array of Template Specs.
	Value []*TemplateSpec

	// READ-ONLY; The URL to use for getting the next set of results.
	NextLink *string
}

ListResult - List of Template Specs.

func (ListResult) MarshalJSON added in v0.2.0

func (l ListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ListResult.

func (*ListResult) UnmarshalJSON added in v1.1.0

func (l *ListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ListResult.

type SystemData

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time

	// The identity that created the resource.
	CreatedBy *string

	// The type of identity that created the resource.
	CreatedByType *CreatedByType

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time

	// The identity that last modified the resource.
	LastModifiedBy *string

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType
}

SystemData - Metadata pertaining to creation and last modification of the resource.

func (SystemData) MarshalJSON

func (s SystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON

func (s *SystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

type TemplateSpec

type TemplateSpec struct {
	// REQUIRED; The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported
	// Azure locations.
	Location *string

	// Template Spec properties.
	Properties *TemplateSpecProperties

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string

	// READ-ONLY; Name of this resource.
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; Type of this resource.
	Type *string
}

TemplateSpec - Template Spec object.

func (TemplateSpec) MarshalJSON

func (t TemplateSpec) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpec.

func (*TemplateSpec) UnmarshalJSON added in v1.1.0

func (t *TemplateSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpec.

type TemplateSpecExpandKind

type TemplateSpecExpandKind string
const (
	// TemplateSpecExpandKindVersions - Includes version information with the Template Spec.
	TemplateSpecExpandKindVersions TemplateSpecExpandKind = "versions"
)

func PossibleTemplateSpecExpandKindValues

func PossibleTemplateSpecExpandKindValues() []TemplateSpecExpandKind

PossibleTemplateSpecExpandKindValues returns the possible values for the TemplateSpecExpandKind const type.

type TemplateSpecProperties

type TemplateSpecProperties struct {
	// Template Spec description.
	Description *string

	// Template Spec display name.
	DisplayName *string

	// The Template Spec metadata. Metadata is an open-ended object and is typically a collection of key-value pairs.
	Metadata any

	// READ-ONLY; High-level information about the versions within this Template Spec. The keys are the version names. Only populated
	// if the $expand query parameter is set to 'versions'.
	Versions map[string]*TemplateSpecVersionInfo
}

TemplateSpecProperties - Template Spec properties.

func (TemplateSpecProperties) MarshalJSON

func (t TemplateSpecProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecProperties.

func (*TemplateSpecProperties) UnmarshalJSON added in v1.1.0

func (t *TemplateSpecProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecProperties.

type TemplateSpecUpdateModel

type TemplateSpecUpdateModel struct {
	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string

	// READ-ONLY; Name of this resource.
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; Type of this resource.
	Type *string
}

TemplateSpecUpdateModel - Template Spec properties to be updated (only tags are currently supported).

func (TemplateSpecUpdateModel) MarshalJSON

func (t TemplateSpecUpdateModel) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecUpdateModel.

func (*TemplateSpecUpdateModel) UnmarshalJSON added in v1.1.0

func (t *TemplateSpecUpdateModel) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecUpdateModel.

type TemplateSpecVersion

type TemplateSpecVersion struct {
	// REQUIRED; The location of the Template Spec Version. It must match the location of the parent Template Spec.
	Location *string

	// REQUIRED; Template Spec Version properties.
	Properties *TemplateSpecVersionProperties

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string

	// READ-ONLY; Name of this resource.
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; Type of this resource.
	Type *string
}

TemplateSpecVersion - Template Spec Version object.

func (TemplateSpecVersion) MarshalJSON

func (t TemplateSpecVersion) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecVersion.

func (*TemplateSpecVersion) UnmarshalJSON added in v1.1.0

func (t *TemplateSpecVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecVersion.

type TemplateSpecVersionInfo

type TemplateSpecVersionInfo struct {
	// READ-ONLY; Template Spec version description.
	Description *string

	// READ-ONLY; The timestamp of when the version was created.
	TimeCreated *time.Time

	// READ-ONLY; The timestamp of when the version was last modified.
	TimeModified *time.Time
}

TemplateSpecVersionInfo - High-level information about a Template Spec version.

func (TemplateSpecVersionInfo) MarshalJSON

func (t TemplateSpecVersionInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecVersionInfo.

func (*TemplateSpecVersionInfo) UnmarshalJSON

func (t *TemplateSpecVersionInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecVersionInfo.

type TemplateSpecVersionProperties

type TemplateSpecVersionProperties struct {
	// Template Spec version description.
	Description *string

	// An array of linked template artifacts.
	LinkedTemplates []*LinkedTemplateArtifact

	// The main Azure Resource Manager template content.
	MainTemplate any

	// The version metadata. Metadata is an open-ended object and is typically a collection of key-value pairs.
	Metadata any

	// The Azure Resource Manager template UI definition content.
	UIFormDefinition any
}

TemplateSpecVersionProperties - Template Spec Version properties.

func (TemplateSpecVersionProperties) MarshalJSON

func (t TemplateSpecVersionProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecVersionProperties.

func (*TemplateSpecVersionProperties) UnmarshalJSON added in v1.1.0

func (t *TemplateSpecVersionProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecVersionProperties.

type TemplateSpecVersionUpdateModel

type TemplateSpecVersionUpdateModel struct {
	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string

	// READ-ONLY; Name of this resource.
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; Type of this resource.
	Type *string
}

TemplateSpecVersionUpdateModel - Template Spec Version properties to be updated (only tags are currently supported).

func (TemplateSpecVersionUpdateModel) MarshalJSON

func (t TemplateSpecVersionUpdateModel) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecVersionUpdateModel.

func (*TemplateSpecVersionUpdateModel) UnmarshalJSON added in v1.1.0

func (t *TemplateSpecVersionUpdateModel) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecVersionUpdateModel.

type TemplateSpecVersionsClient

type TemplateSpecVersionsClient struct {
	// contains filtered or unexported fields
}

TemplateSpecVersionsClient contains the methods for the TemplateSpecVersions group. Don't use this type directly, use NewTemplateSpecVersionsClient() instead.

func NewTemplateSpecVersionsClient

func NewTemplateSpecVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TemplateSpecVersionsClient, error)

NewTemplateSpecVersionsClient creates a new instance of TemplateSpecVersionsClient with the specified values.

  • subscriptionID - Subscription Id which forms part of the URI for every service call.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*TemplateSpecVersionsClient) CreateOrUpdate

func (client *TemplateSpecVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, templateSpecVersionModel TemplateSpecVersion, options *TemplateSpecVersionsClientCreateOrUpdateOptions) (TemplateSpecVersionsClientCreateOrUpdateResponse, error)

CreateOrUpdate - Creates or updates a Template Spec version. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • templateSpecVersion - The version of the Template Spec.
  • templateSpecVersionModel - Template Spec Version supplied to the operation.
  • options - TemplateSpecVersionsClientCreateOrUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsCreate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTemplateSpecVersionsClient().CreateOrUpdate(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", armtemplatespecs.TemplateSpecVersion{
		Location: to.Ptr("eastus"),
		Properties: &armtemplatespecs.TemplateSpecVersionProperties{
			Description: to.Ptr("This is version v1.0 of our template content"),
			MainTemplate: map[string]any{
				"$schema":        "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
				"contentVersion": "1.0.0.0",
				"parameters":     map[string]any{},
				"resources":      []any{},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{
	// 	Name: to.Ptr("v1.0"),
	// 	Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		CreatedBy: to.Ptr("string"),
	// 		CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("string"),
	// 		LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecVersionProperties{
	// 		Description: to.Ptr("This is version v1.0 of our template content"),
	// 		MainTemplate: map[string]any{
	// 			"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
	// 			"contentVersion": "1.0.0.0",
	// 			"parameters":map[string]any{
	// 			},
	// 			"resources":[]any{
	// 			},
	// 		},
	// 	},
	// }
}
Output:

func (*TemplateSpecVersionsClient) Delete

func (client *TemplateSpecVersionsClient) Delete(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientDeleteOptions) (TemplateSpecVersionsClientDeleteResponse, error)

Delete - Deletes a specific version from a Template Spec. When operation completes, status code 200 returned without content. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • templateSpecVersion - The version of the Template Spec.
  • options - TemplateSpecVersionsClientDeleteOptions contains the optional parameters for the TemplateSpecVersionsClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsDelete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewTemplateSpecVersionsClient().Delete(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*TemplateSpecVersionsClient) Get

func (client *TemplateSpecVersionsClient) Get(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientGetOptions) (TemplateSpecVersionsClientGetResponse, error)

Get - Gets a Template Spec version from a specific Template Spec. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • templateSpecVersion - The version of the Template Spec.
  • options - TemplateSpecVersionsClientGetOptions contains the optional parameters for the TemplateSpecVersionsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTemplateSpecVersionsClient().Get(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{
	// 	Name: to.Ptr("v1.0"),
	// 	Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		CreatedBy: to.Ptr("string"),
	// 		CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("string"),
	// 		LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecVersionProperties{
	// 		Description: to.Ptr("This is version v1.0 of our template content"),
	// 		MainTemplate: map[string]any{
	// 			"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
	// 			"contentVersion": "1.0.0.0",
	// 			"parameters":map[string]any{
	// 			},
	// 			"resources":[]any{
	// 			},
	// 		},
	// 	},
	// }
}
Output:

func (*TemplateSpecVersionsClient) GetBuiltIn added in v1.0.0

GetBuiltIn - Gets a Template Spec version from a specific built-in Template Spec. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • templateSpecName - Name of the Template Spec.
  • templateSpecVersion - The version of the Template Spec.
  • options - TemplateSpecVersionsClientGetBuiltInOptions contains the optional parameters for the TemplateSpecVersionsClient.GetBuiltIn method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecVersionsGet.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTemplateSpecVersionsClient().GetBuiltIn(ctx, "nameOfTheBuiltIn", "v1.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{
	// 	Name: to.Ptr("v1.0"),
	// 	Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs/versions"),
	// 	ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn/versions/v1.0"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.107Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.107Z"); return t}()),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecVersionProperties{
	// 		Description: to.Ptr("This is version v1.0"),
	// 	},
	// }
}
Output:

func (*TemplateSpecVersionsClient) NewListBuiltInsPager added in v1.0.0

NewListBuiltInsPager - Lists all the Template Spec versions in the specified built-in Template Spec.

Generated from API version 2022-02-01

  • templateSpecName - Name of the Template Spec.
  • options - TemplateSpecVersionsClientListBuiltInsOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListBuiltInsPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/BuiltInTemplateSpecVersionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTemplateSpecVersionsClient().NewListBuiltInsPager("nameOfTheBuiltIn", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.TemplateSpecVersionsListResult = armtemplatespecs.TemplateSpecVersionsListResult{
		// 	Value: []*armtemplatespecs.TemplateSpecVersion{
		// 		{
		// 			Name: to.Ptr("v1.0"),
		// 			Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs/versions"),
		// 			ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn/versions/v1.0"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.107Z"); return t}()),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-01T01:01:01.107Z"); return t}()),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecVersionProperties{
		// 				Description: to.Ptr("This is version v1.0"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("v2.0"),
		// 			Type: to.Ptr("Microsoft.Resources/builtInTemplateSpecs/versions"),
		// 			ID: to.Ptr("/providers/Microsoft.Resources/builtInTemplateSpecs/nameOfTheBuiltIn/versions/v2.0"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.197Z"); return t}()),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-02T02:03:01.197Z"); return t}()),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecVersionProperties{
		// 				Description: to.Ptr("This is another version (v2.0)"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*TemplateSpecVersionsClient) NewListPager added in v0.4.0

func (client *TemplateSpecVersionsClient) NewListPager(resourceGroupName string, templateSpecName string, options *TemplateSpecVersionsClientListOptions) *runtime.Pager[TemplateSpecVersionsClientListResponse]

NewListPager - Lists all the Template Spec versions in the specified Template Spec.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • options - TemplateSpecVersionsClientListOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTemplateSpecVersionsClient().NewListPager("templateSpecRG", "simpleTemplateSpec", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.TemplateSpecVersionsListResult = armtemplatespecs.TemplateSpecVersionsListResult{
		// 	Value: []*armtemplatespecs.TemplateSpecVersion{
		// 		{
		// 			Name: to.Ptr("v1.0"),
		// 			Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
		// 				CreatedBy: to.Ptr("string"),
		// 				CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("string"),
		// 				LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecVersionProperties{
		// 				Description: to.Ptr("This is version v1.0"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("v2.0"),
		// 			Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v2.0"),
		// 			SystemData: &armtemplatespecs.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.107Z"); return t}()),
		// 				CreatedBy: to.Ptr("string"),
		// 				CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.197Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("string"),
		// 				LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
		// 			},
		// 			Location: to.Ptr("eastus"),
		// 			Properties: &armtemplatespecs.TemplateSpecVersionProperties{
		// 				Description: to.Ptr("This is another version (v2.0)"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*TemplateSpecVersionsClient) Update

func (client *TemplateSpecVersionsClient) Update(ctx context.Context, resourceGroupName string, templateSpecName string, templateSpecVersion string, options *TemplateSpecVersionsClientUpdateOptions) (TemplateSpecVersionsClientUpdateResponse, error)

Update - Updates Template Spec Version tags with specified values. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2022-02-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • templateSpecName - Name of the Template Spec.
  • templateSpecVersion - The version of the Template Spec.
  • options - TemplateSpecVersionsClientUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.Update method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-02-01/examples/TemplateSpecVersionsPatch.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armtemplatespecs"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armtemplatespecs.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTemplateSpecVersionsClient().Update(ctx, "templateSpecRG", "simpleTemplateSpec", "v1.0", &armtemplatespecs.TemplateSpecVersionsClientUpdateOptions{TemplateSpecVersionUpdateModel: &armtemplatespecs.TemplateSpecVersionUpdateModel{
		Tags: map[string]*string{
			"myTag": to.Ptr("My Value"),
		},
	},
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.TemplateSpecVersion = armtemplatespecs.TemplateSpecVersion{
	// 	Name: to.Ptr("v1.0"),
	// 	Type: to.Ptr("Microsoft.Resources/templateSpecs/versions"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/templateSpecRG/providers/Microsoft.Resources/templateSpecs/simpleTemplateSpec/versions/v1.0"),
	// 	SystemData: &armtemplatespecs.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.107Z"); return t}()),
	// 		CreatedBy: to.Ptr("string"),
	// 		CreatedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T02:03:01.197Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("string"),
	// 		LastModifiedByType: to.Ptr(armtemplatespecs.CreatedByTypeApplication),
	// 	},
	// 	Location: to.Ptr("eastus"),
	// 	Properties: &armtemplatespecs.TemplateSpecVersionProperties{
	// 		Description: to.Ptr("This is version v1.0 of our template content"),
	// 		MainTemplate: map[string]any{
	// 			"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
	// 			"contentVersion": "1.0.0.0",
	// 			"parameters":map[string]any{
	// 			},
	// 			"resources":[]any{
	// 			},
	// 		},
	// 	},
	// 	Tags: map[string]*string{
	// 		"myTag": to.Ptr("My Value"),
	// 	},
	// }
}
Output:

type TemplateSpecVersionsClientCreateOrUpdateOptions added in v0.2.0

type TemplateSpecVersionsClientCreateOrUpdateOptions struct {
}

TemplateSpecVersionsClientCreateOrUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.CreateOrUpdate method.

type TemplateSpecVersionsClientCreateOrUpdateResponse added in v0.2.0

type TemplateSpecVersionsClientCreateOrUpdateResponse struct {
	// Template Spec Version object.
	TemplateSpecVersion
}

TemplateSpecVersionsClientCreateOrUpdateResponse contains the response from method TemplateSpecVersionsClient.CreateOrUpdate.

type TemplateSpecVersionsClientDeleteOptions added in v0.2.0

type TemplateSpecVersionsClientDeleteOptions struct {
}

TemplateSpecVersionsClientDeleteOptions contains the optional parameters for the TemplateSpecVersionsClient.Delete method.

type TemplateSpecVersionsClientDeleteResponse added in v0.2.0

type TemplateSpecVersionsClientDeleteResponse struct {
}

TemplateSpecVersionsClientDeleteResponse contains the response from method TemplateSpecVersionsClient.Delete.

type TemplateSpecVersionsClientGetBuiltInOptions added in v1.0.0

type TemplateSpecVersionsClientGetBuiltInOptions struct {
}

TemplateSpecVersionsClientGetBuiltInOptions contains the optional parameters for the TemplateSpecVersionsClient.GetBuiltIn method.

type TemplateSpecVersionsClientGetBuiltInResponse added in v1.0.0

type TemplateSpecVersionsClientGetBuiltInResponse struct {
	// Template Spec Version object.
	TemplateSpecVersion
}

TemplateSpecVersionsClientGetBuiltInResponse contains the response from method TemplateSpecVersionsClient.GetBuiltIn.

type TemplateSpecVersionsClientGetOptions added in v0.2.0

type TemplateSpecVersionsClientGetOptions struct {
}

TemplateSpecVersionsClientGetOptions contains the optional parameters for the TemplateSpecVersionsClient.Get method.

type TemplateSpecVersionsClientGetResponse added in v0.2.0

type TemplateSpecVersionsClientGetResponse struct {
	// Template Spec Version object.
	TemplateSpecVersion
}

TemplateSpecVersionsClientGetResponse contains the response from method TemplateSpecVersionsClient.Get.

type TemplateSpecVersionsClientListBuiltInsOptions added in v1.0.0

type TemplateSpecVersionsClientListBuiltInsOptions struct {
}

TemplateSpecVersionsClientListBuiltInsOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListBuiltInsPager method.

type TemplateSpecVersionsClientListBuiltInsResponse added in v1.0.0

type TemplateSpecVersionsClientListBuiltInsResponse struct {
	// List of Template Specs versions
	TemplateSpecVersionsListResult
}

TemplateSpecVersionsClientListBuiltInsResponse contains the response from method TemplateSpecVersionsClient.NewListBuiltInsPager.

type TemplateSpecVersionsClientListOptions added in v0.2.0

type TemplateSpecVersionsClientListOptions struct {
}

TemplateSpecVersionsClientListOptions contains the optional parameters for the TemplateSpecVersionsClient.NewListPager method.

type TemplateSpecVersionsClientListResponse added in v0.2.0

type TemplateSpecVersionsClientListResponse struct {
	// List of Template Specs versions
	TemplateSpecVersionsListResult
}

TemplateSpecVersionsClientListResponse contains the response from method TemplateSpecVersionsClient.NewListPager.

type TemplateSpecVersionsClientUpdateOptions added in v0.2.0

type TemplateSpecVersionsClientUpdateOptions struct {
	// Template Spec Version resource with the tags to be updated.
	TemplateSpecVersionUpdateModel *TemplateSpecVersionUpdateModel
}

TemplateSpecVersionsClientUpdateOptions contains the optional parameters for the TemplateSpecVersionsClient.Update method.

type TemplateSpecVersionsClientUpdateResponse added in v0.2.0

type TemplateSpecVersionsClientUpdateResponse struct {
	// Template Spec Version object.
	TemplateSpecVersion
}

TemplateSpecVersionsClientUpdateResponse contains the response from method TemplateSpecVersionsClient.Update.

type TemplateSpecVersionsListResult

type TemplateSpecVersionsListResult struct {
	// An array of Template Spec versions.
	Value []*TemplateSpecVersion

	// READ-ONLY; The URL to use for getting the next set of results.
	NextLink *string
}

TemplateSpecVersionsListResult - List of Template Specs versions

func (TemplateSpecVersionsListResult) MarshalJSON

func (t TemplateSpecVersionsListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TemplateSpecVersionsListResult.

func (*TemplateSpecVersionsListResult) UnmarshalJSON added in v1.1.0

func (t *TemplateSpecVersionsListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TemplateSpecVersionsListResult.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL