armdeploymentscripts

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 17 Imported by: 1

README

Azure Deployment Scripts Module for Go

PkgGoDev

The armdeploymentscripts module provides operations for working with Azure Deployment Scripts.

Source code

Getting started

Prerequisites

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Deployment Scripts module:

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

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Deployment Scripts. 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.

Clients

Azure Deployment Scripts modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential.

client, err := armdeploymentscripts.NewClient(<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,
    },
}
client, err := armdeploymentscripts.NewClient(<subscription ID>, cred, &options)

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Deployment Scripts 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 AzureCliScript

type AzureCliScript struct {
	// REQUIRED; Type of the script.
	Kind *ScriptType `json:"kind,omitempty"`

	// REQUIRED; The location of the ACI and the storage account for the deployment script.
	Location *string `json:"location,omitempty"`

	// REQUIRED; Properties of the Azure CLI script object.
	Properties *AzureCliScriptProperties `json:"properties,omitempty"`

	// Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported.
	Identity *ManagedServiceIdentity `json:"identity,omitempty"`

	// Resource tags.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of this resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The system metadata related to this resource.
	SystemData *SystemData `json:"systemData,omitempty" azure:"ro"`

	// READ-ONLY; Type of this resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

AzureCliScript - Object model for the Azure CLI script.

func (*AzureCliScript) GetDeploymentScript added in v0.2.0

func (a *AzureCliScript) GetDeploymentScript() *DeploymentScript

GetDeploymentScript implements the DeploymentScriptClassification interface for type AzureCliScript.

func (AzureCliScript) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AzureCliScript.

func (*AzureCliScript) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AzureCliScript.

type AzureCliScriptProperties

type AzureCliScriptProperties struct {
	// REQUIRED; Azure CLI module version to be used.
	AzCliVersion *string `json:"azCliVersion,omitempty"`

	// REQUIRED; Interval for which the service retains the script resource after it reaches a terminal state. Resource will be
	// deleted when this duration expires. Duration is based on ISO 8601 pattern (for example
	// P1D means one day).
	RetentionInterval *string `json:"retentionInterval,omitempty"`

	// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'
	Arguments *string `json:"arguments,omitempty"`

	// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.
	CleanupPreference *CleanupOptions `json:"cleanupPreference,omitempty"`

	// Container settings.
	ContainerSettings *ContainerConfiguration `json:"containerSettings,omitempty"`

	// The environment variables to pass over to the script.
	EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables,omitempty"`

	// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be
	// current time stamp or a GUID.
	ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`

	// Uri for the script. This is the entry point for the external script.
	PrimaryScriptURI *string `json:"primaryScriptUri,omitempty"`

	// Script body.
	ScriptContent *string `json:"scriptContent,omitempty"`

	// Storage Account settings.
	StorageAccountSettings *StorageAccountConfiguration `json:"storageAccountSettings,omitempty"`

	// Supporting files for the external script.
	SupportingScriptUris []*string `json:"supportingScriptUris,omitempty"`

	// Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D
	Timeout *string `json:"timeout,omitempty"`

	// READ-ONLY; List of script outputs.
	Outputs map[string]interface{} `json:"outputs,omitempty" azure:"ro"`

	// READ-ONLY; State of the script execution. This only appears in the response.
	ProvisioningState *ScriptProvisioningState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; Contains the results of script execution.
	Status *ScriptStatus `json:"status,omitempty" azure:"ro"`
}

AzureCliScriptProperties - Properties of the Azure CLI script object.

func (AzureCliScriptProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AzureCliScriptProperties.

type AzurePowerShellScript

type AzurePowerShellScript struct {
	// REQUIRED; Type of the script.
	Kind *ScriptType `json:"kind,omitempty"`

	// REQUIRED; The location of the ACI and the storage account for the deployment script.
	Location *string `json:"location,omitempty"`

	// REQUIRED; Properties of the Azure PowerShell script object.
	Properties *AzurePowerShellScriptProperties `json:"properties,omitempty"`

	// Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported.
	Identity *ManagedServiceIdentity `json:"identity,omitempty"`

	// Resource tags.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of this resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The system metadata related to this resource.
	SystemData *SystemData `json:"systemData,omitempty" azure:"ro"`

	// READ-ONLY; Type of this resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

AzurePowerShellScript - Object model for the Azure PowerShell script.

func (*AzurePowerShellScript) GetDeploymentScript added in v0.2.0

func (a *AzurePowerShellScript) GetDeploymentScript() *DeploymentScript

GetDeploymentScript implements the DeploymentScriptClassification interface for type AzurePowerShellScript.

func (AzurePowerShellScript) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AzurePowerShellScript.

func (*AzurePowerShellScript) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AzurePowerShellScript.

type AzurePowerShellScriptProperties

type AzurePowerShellScriptProperties struct {
	// REQUIRED; Azure PowerShell module version to be used.
	AzPowerShellVersion *string `json:"azPowerShellVersion,omitempty"`

	// REQUIRED; Interval for which the service retains the script resource after it reaches a terminal state. Resource will be
	// deleted when this duration expires. Duration is based on ISO 8601 pattern (for example
	// P1D means one day).
	RetentionInterval *string `json:"retentionInterval,omitempty"`

	// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'
	Arguments *string `json:"arguments,omitempty"`

	// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.
	CleanupPreference *CleanupOptions `json:"cleanupPreference,omitempty"`

	// Container settings.
	ContainerSettings *ContainerConfiguration `json:"containerSettings,omitempty"`

	// The environment variables to pass over to the script.
	EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables,omitempty"`

	// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be
	// current time stamp or a GUID.
	ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`

	// Uri for the script. This is the entry point for the external script.
	PrimaryScriptURI *string `json:"primaryScriptUri,omitempty"`

	// Script body.
	ScriptContent *string `json:"scriptContent,omitempty"`

	// Storage Account settings.
	StorageAccountSettings *StorageAccountConfiguration `json:"storageAccountSettings,omitempty"`

	// Supporting files for the external script.
	SupportingScriptUris []*string `json:"supportingScriptUris,omitempty"`

	// Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D
	Timeout *string `json:"timeout,omitempty"`

	// READ-ONLY; List of script outputs.
	Outputs map[string]interface{} `json:"outputs,omitempty" azure:"ro"`

	// READ-ONLY; State of the script execution. This only appears in the response.
	ProvisioningState *ScriptProvisioningState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; Contains the results of script execution.
	Status *ScriptStatus `json:"status,omitempty" azure:"ro"`
}

AzurePowerShellScriptProperties - Properties of the Azure PowerShell script object.

func (AzurePowerShellScriptProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AzurePowerShellScriptProperties.

type AzureResourceBase

type AzureResourceBase struct {
	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of this resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Type of this resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

AzureResourceBase - Common properties for all Azure resources.

type CleanupOptions

type CleanupOptions string

CleanupOptions - The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.

const (
	CleanupOptionsAlways       CleanupOptions = "Always"
	CleanupOptionsOnExpiration CleanupOptions = "OnExpiration"
	CleanupOptionsOnSuccess    CleanupOptions = "OnSuccess"
)

func PossibleCleanupOptionsValues

func PossibleCleanupOptionsValues() []CleanupOptions

PossibleCleanupOptionsValues returns the possible values for the CleanupOptions const type.

type Client added in v0.2.0

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

Client contains the methods for the DeploymentScripts 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) BeginCreate added in v0.2.0

func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, scriptName string, deploymentScript DeploymentScriptClassification, options *ClientBeginCreateOptions) (*runtime.Poller[ClientCreateResponse], error)

BeginCreate - Creates a deployment script. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. scriptName - Name of the deployment script. deploymentScript - Deployment script supplied to the operation. options - ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Create.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreate(ctx,
		"script-rg",
		"MyDeploymentScript",
		&armdeploymentscripts.AzurePowerShellScript{
			Identity: &armdeploymentscripts.ManagedServiceIdentity{
				Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned),
				UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{
					"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {},
				},
			},
			Kind:     to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell),
			Location: to.Ptr("westus"),
			Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{
				CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways),
				Arguments:         to.Ptr("-Location 'westus' -Name \"*rg2\""),
				RetentionInterval: to.Ptr("PT7D"),
				ScriptContent:     to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"),
				SupportingScriptUris: []*string{
					to.Ptr("https://uri1.to.supporting.script"),
					to.Ptr("https://uri2.to.supporting.script")},
				Timeout:             to.Ptr("PT1H"),
				AzPowerShellVersion: to.Ptr("1.7.0"),
			},
		},
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) Delete added in v0.2.0

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

Delete - Deletes a deployment script. When operation completes, status code 200 returned without content. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. scriptName - Name of the deployment script. options - ClientDeleteOptions contains the optional parameters for the Client.Delete method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Delete.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.Delete(ctx,
		"script-rg",
		"MyDeploymentScript",
		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, scriptName string, options *ClientGetOptions) (ClientGetResponse, error)

Get - Gets a deployment script with a given name. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. scriptName - Name of the deployment script. options - ClientGetOptions contains the optional parameters for the Client.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Get.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"script-rg",
		"MyDeploymentScript",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) GetLogs added in v0.2.0

func (client *Client) GetLogs(ctx context.Context, resourceGroupName string, scriptName string, options *ClientGetLogsOptions) (ClientGetLogsResponse, error)

GetLogs - Gets deployment script logs for a given deployment script name. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. scriptName - Name of the deployment script. options - ClientGetLogsOptions contains the optional parameters for the Client.GetLogs method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogs.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetLogs(ctx,
		"script-rg",
		"MyDeploymentScript",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) GetLogsDefault added in v0.2.0

func (client *Client) GetLogsDefault(ctx context.Context, resourceGroupName string, scriptName string, options *ClientGetLogsDefaultOptions) (ClientGetLogsDefaultResponse, error)

GetLogsDefault - Gets deployment script logs for a given deployment script name. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. scriptName - Name of the deployment script. options - ClientGetLogsDefaultOptions contains the optional parameters for the Client.GetLogsDefault method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogsDefault.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetLogsDefault(ctx,
		"script-rg",
		"MyDeploymentScript",
		&armdeploymentscripts.ClientGetLogsDefaultOptions{Tail: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*Client) NewListByResourceGroupPager added in v0.5.0

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

NewListByResourceGroupPager - Lists deployments scripts. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. options - ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_ListByResourceGroup.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListByResourceGroupPager("script-rg",
		nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*Client) NewListBySubscriptionPager added in v0.5.0

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

NewListBySubscriptionPager - Lists all deployment scripts for a given subscription. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 options - ClientListBySubscriptionOptions contains the optional parameters for the Client.ListBySubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_ListBySubscription.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListBySubscriptionPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*Client) Update added in v0.2.0

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

Update - Updates deployment script tags with specified values. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-10-01 resourceGroupName - The name of the resource group. The name is case insensitive. scriptName - Name of the deployment script. options - ClientUpdateOptions contains the optional parameters for the Client.Update method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Update.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/armdeploymentscripts"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armdeploymentscripts.NewClient("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Update(ctx,
		"script-rg",
		"MyDeploymentScript",
		&armdeploymentscripts.ClientUpdateOptions{DeploymentScript: &armdeploymentscripts.DeploymentScriptUpdateParameter{
			Tags: map[string]*string{},
		},
		})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type ClientBeginCreateOptions added in v0.2.0

type ClientBeginCreateOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method.

type ClientCreateResponse added in v0.2.0

type ClientCreateResponse struct {
	DeploymentScriptClassification
}

ClientCreateResponse contains the response from method Client.Create.

func (*ClientCreateResponse) UnmarshalJSON added in v0.4.0

func (c *ClientCreateResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ClientCreateResponse.

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 ClientGetLogsDefaultOptions added in v0.2.0

type ClientGetLogsDefaultOptions struct {
	// The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If
	// 'tail' is not provided, all available logs are shown up to container instance
	// log capacity of 4mb.
	Tail *int32
}

ClientGetLogsDefaultOptions contains the optional parameters for the Client.GetLogsDefault method.

type ClientGetLogsDefaultResponse added in v0.2.0

type ClientGetLogsDefaultResponse struct {
	ScriptLog
}

ClientGetLogsDefaultResponse contains the response from method Client.GetLogsDefault.

type ClientGetLogsOptions added in v0.2.0

type ClientGetLogsOptions struct {
}

ClientGetLogsOptions contains the optional parameters for the Client.GetLogs method.

type ClientGetLogsResponse added in v0.2.0

type ClientGetLogsResponse struct {
	ScriptLogsList
}

ClientGetLogsResponse contains the response from method Client.GetLogs.

type ClientGetOptions added in v0.2.0

type ClientGetOptions struct {
}

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

type ClientGetResponse added in v0.2.0

type ClientGetResponse struct {
	DeploymentScriptClassification
}

ClientGetResponse contains the response from method Client.Get.

func (*ClientGetResponse) UnmarshalJSON added in v0.4.0

func (c *ClientGetResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ClientGetResponse.

type ClientListByResourceGroupOptions added in v0.2.0

type ClientListByResourceGroupOptions struct {
}

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

type ClientListByResourceGroupResponse added in v0.2.0

type ClientListByResourceGroupResponse struct {
	DeploymentScriptListResult
}

ClientListByResourceGroupResponse contains the response from method Client.ListByResourceGroup.

type ClientListBySubscriptionOptions added in v0.2.0

type ClientListBySubscriptionOptions struct {
}

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

type ClientListBySubscriptionResponse added in v0.2.0

type ClientListBySubscriptionResponse struct {
	DeploymentScriptListResult
}

ClientListBySubscriptionResponse contains the response from method Client.ListBySubscription.

type ClientUpdateOptions added in v0.2.0

type ClientUpdateOptions struct {
	// Deployment script resource with the tags to be updated.
	DeploymentScript *DeploymentScriptUpdateParameter
}

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

type ClientUpdateResponse added in v0.2.0

type ClientUpdateResponse struct {
	DeploymentScriptClassification
}

ClientUpdateResponse contains the response from method Client.Update.

func (*ClientUpdateResponse) UnmarshalJSON added in v0.4.0

func (c *ClientUpdateResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ClientUpdateResponse.

type ContainerConfiguration

type ContainerConfiguration struct {
	// Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates
	// the system to generate a unique name which might end up flagging an Azure
	// Policy as non-compliant. Use 'containerGroupName' when you have an Azure Policy that expects a specific naming convention
	// or when you want to fully control the name. 'containerGroupName' property must
	// be between 1 and 63 characters long, must contain only lowercase letters, numbers, and dashes and it cannot start or end
	// with a dash and consecutive dashes are not allowed. To specify a
	// 'containerGroupName', add the following object to properties: { "containerSettings": { "containerGroupName": "contoso-container"
	// } }. If you do not want to specify a 'containerGroupName' then do not
	// add 'containerSettings' property.
	ContainerGroupName *string `json:"containerGroupName,omitempty"`
}

ContainerConfiguration - Settings to customize ACI container instance.

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 DeploymentScript

type DeploymentScript struct {
	// REQUIRED; Type of the script.
	Kind *ScriptType `json:"kind,omitempty"`

	// REQUIRED; The location of the ACI and the storage account for the deployment script.
	Location *string `json:"location,omitempty"`

	// Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported.
	Identity *ManagedServiceIdentity `json:"identity,omitempty"`

	// Resource tags.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of this resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The system metadata related to this resource.
	SystemData *SystemData `json:"systemData,omitempty" azure:"ro"`

	// READ-ONLY; Type of this resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

DeploymentScript - Deployment script object.

func (*DeploymentScript) GetDeploymentScript

func (d *DeploymentScript) GetDeploymentScript() *DeploymentScript

GetDeploymentScript implements the DeploymentScriptClassification interface for type DeploymentScript.

func (DeploymentScript) MarshalJSON added in v0.2.0

func (d DeploymentScript) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DeploymentScript.

type DeploymentScriptClassification

type DeploymentScriptClassification interface {
	// GetDeploymentScript returns the DeploymentScript content of the underlying type.
	GetDeploymentScript() *DeploymentScript
}

DeploymentScriptClassification provides polymorphic access to related types. Call the interface's GetDeploymentScript() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *AzureCliScript, *AzurePowerShellScript, *DeploymentScript

type DeploymentScriptListResult

type DeploymentScriptListResult struct {
	// An array of deployment scripts.
	Value []DeploymentScriptClassification `json:"value,omitempty"`

	// READ-ONLY; The URL to use for getting the next set of results.
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`
}

DeploymentScriptListResult - List of deployment scripts.

func (*DeploymentScriptListResult) UnmarshalJSON

func (d *DeploymentScriptListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentScriptListResult.

type DeploymentScriptPropertiesBase

type DeploymentScriptPropertiesBase struct {
	// The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.
	CleanupPreference *CleanupOptions `json:"cleanupPreference,omitempty"`

	// Container settings.
	ContainerSettings *ContainerConfiguration `json:"containerSettings,omitempty"`

	// Storage Account settings.
	StorageAccountSettings *StorageAccountConfiguration `json:"storageAccountSettings,omitempty"`

	// READ-ONLY; List of script outputs.
	Outputs map[string]interface{} `json:"outputs,omitempty" azure:"ro"`

	// READ-ONLY; State of the script execution. This only appears in the response.
	ProvisioningState *ScriptProvisioningState `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; Contains the results of script execution.
	Status *ScriptStatus `json:"status,omitempty" azure:"ro"`
}

DeploymentScriptPropertiesBase - Common properties for the deployment script.

func (DeploymentScriptPropertiesBase) MarshalJSON

func (d DeploymentScriptPropertiesBase) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DeploymentScriptPropertiesBase.

type DeploymentScriptUpdateParameter

type DeploymentScriptUpdateParameter struct {
	// Resource tags to be updated.
	Tags map[string]*string `json:"tags,omitempty"`

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of this resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Type of this resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

DeploymentScriptUpdateParameter - Deployment script parameters to be updated.

func (DeploymentScriptUpdateParameter) MarshalJSON

func (d DeploymentScriptUpdateParameter) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DeploymentScriptUpdateParameter.

type EnvironmentVariable

type EnvironmentVariable struct {
	// REQUIRED; The name of the environment variable.
	Name *string `json:"name,omitempty"`

	// The value of the secure environment variable.
	SecureValue *string `json:"secureValue,omitempty"`

	// The value of the environment variable.
	Value *string `json:"value,omitempty"`
}

EnvironmentVariable - The environment variable to pass to the script in the container instance.

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 `json:"error,omitempty"`
}

Error - Deployment scripts error response.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info interface{} `json:"info,omitempty" azure:"ro"`

	// READ-ONLY; The additional info type.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ErrorAdditionalInfo - The resource management error additional info.

type ErrorResponse

type ErrorResponse struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; The error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; The error details.
	Details []*ErrorResponse `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; The error message.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The error target.
	Target *string `json:"target,omitempty" azure:"ro"`
}

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.

type LogProperties

type LogProperties struct {
	// READ-ONLY; Script execution logs in text format.
	Log *string `json:"log,omitempty" azure:"ro"`
}

LogProperties - Script log properties.

type ManagedServiceIdentity

type ManagedServiceIdentity struct {
	// Type of the managed identity.
	Type *ManagedServiceIdentityType `json:"type,omitempty"`

	// The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed
	// identity.
	UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities,omitempty"`

	// READ-ONLY; ID of the Azure Active Directory.
	TenantID *string `json:"tenantId,omitempty" azure:"ro"`
}

ManagedServiceIdentity - Managed identity generic object.

func (ManagedServiceIdentity) MarshalJSON

func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity.

type ManagedServiceIdentityType

type ManagedServiceIdentityType string

ManagedServiceIdentityType - Type of the managed identity.

const (
	ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned"
)

func PossibleManagedServiceIdentityTypeValues

func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType

PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type.

type ScriptConfigurationBase

type ScriptConfigurationBase struct {
	// REQUIRED; Interval for which the service retains the script resource after it reaches a terminal state. Resource will be
	// deleted when this duration expires. Duration is based on ISO 8601 pattern (for example
	// P1D means one day).
	RetentionInterval *string `json:"retentionInterval,omitempty"`

	// Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'
	Arguments *string `json:"arguments,omitempty"`

	// The environment variables to pass over to the script.
	EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables,omitempty"`

	// Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be
	// current time stamp or a GUID.
	ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`

	// Uri for the script. This is the entry point for the external script.
	PrimaryScriptURI *string `json:"primaryScriptUri,omitempty"`

	// Script body.
	ScriptContent *string `json:"scriptContent,omitempty"`

	// Supporting files for the external script.
	SupportingScriptUris []*string `json:"supportingScriptUris,omitempty"`

	// Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D
	Timeout *string `json:"timeout,omitempty"`
}

ScriptConfigurationBase - Common configuration settings for both Azure PowerShell and Azure CLI scripts.

func (ScriptConfigurationBase) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ScriptConfigurationBase.

type ScriptLog

type ScriptLog struct {
	// Script log properties.
	Properties *LogProperties `json:"properties,omitempty"`

	// READ-ONLY; String Id used to locate any resource on Azure.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; Name of this resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Type of this resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ScriptLog - Script execution log object.

type ScriptLogsList

type ScriptLogsList struct {
	// Deployment scripts logs.
	Value []*ScriptLog `json:"value,omitempty"`
}

ScriptLogsList - Deployment script execution logs.

type ScriptProvisioningState

type ScriptProvisioningState string

ScriptProvisioningState - State of the script execution. This only appears in the response.

const (
	ScriptProvisioningStateCanceled              ScriptProvisioningState = "Canceled"
	ScriptProvisioningStateCreating              ScriptProvisioningState = "Creating"
	ScriptProvisioningStateFailed                ScriptProvisioningState = "Failed"
	ScriptProvisioningStateProvisioningResources ScriptProvisioningState = "ProvisioningResources"
	ScriptProvisioningStateRunning               ScriptProvisioningState = "Running"
	ScriptProvisioningStateSucceeded             ScriptProvisioningState = "Succeeded"
)

func PossibleScriptProvisioningStateValues

func PossibleScriptProvisioningStateValues() []ScriptProvisioningState

PossibleScriptProvisioningStateValues returns the possible values for the ScriptProvisioningState const type.

type ScriptStatus

type ScriptStatus struct {
	// Error that is relayed from the script execution.
	Error *ErrorResponse `json:"error,omitempty"`

	// READ-ONLY; ACI resource Id.
	ContainerInstanceID *string `json:"containerInstanceId,omitempty" azure:"ro"`

	// READ-ONLY; End time of the script execution.
	EndTime *time.Time `json:"endTime,omitempty" azure:"ro"`

	// READ-ONLY; Time the deployment script resource will expire.
	ExpirationTime *time.Time `json:"expirationTime,omitempty" azure:"ro"`

	// READ-ONLY; Start time of the script execution.
	StartTime *time.Time `json:"startTime,omitempty" azure:"ro"`

	// READ-ONLY; Storage account resource Id.
	StorageAccountID *string `json:"storageAccountId,omitempty" azure:"ro"`
}

ScriptStatus - Generic object modeling results of script execution.

func (ScriptStatus) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ScriptStatus.

func (*ScriptStatus) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ScriptStatus.

type ScriptType

type ScriptType string

ScriptType - Type of the script.

const (
	ScriptTypeAzureCLI        ScriptType = "AzureCLI"
	ScriptTypeAzurePowerShell ScriptType = "AzurePowerShell"
)

func PossibleScriptTypeValues

func PossibleScriptTypeValues() []ScriptType

PossibleScriptTypeValues returns the possible values for the ScriptType const type.

type StorageAccountConfiguration

type StorageAccountConfiguration struct {
	// The storage account access key.
	StorageAccountKey *string `json:"storageAccountKey,omitempty"`

	// The storage account name.
	StorageAccountName *string `json:"storageAccountName,omitempty"`
}

StorageAccountConfiguration - Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage

type SystemData

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// The type of identity that created the resource.
	CreatedByType *CreatedByType `json:"createdByType,omitempty"`

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"`

	// The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"`
}

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 UserAssignedIdentity

type UserAssignedIdentity struct {
	// READ-ONLY; Client App Id associated with this identity.
	ClientID *string `json:"clientId,omitempty" azure:"ro"`

	// READ-ONLY; Azure Active Directory principal ID associated with this identity.
	PrincipalID *string `json:"principalId,omitempty" azure:"ro"`
}

UserAssignedIdentity - User-assigned managed identity.

Jump to

Keyboard shortcuts

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