armchaos

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 15 Imported by: 1

README

Azure Chaos Module for Go

PkgGoDev

The armchaos module provides operations for working with Azure Chaos. This package is currently in Beta and is not yet fully supported.

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 Chaos module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Chaos. 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 Chaos 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 := armchaos.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 := armchaos.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.NewCapabilitiesClient()

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 Chaos 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 ActionStatus

type ActionStatus struct {
	// READ-ONLY; The id of the action status.
	ActionID *string

	// READ-ONLY; The name of the action status.
	ActionName *string

	// READ-ONLY; String that represents the end time of the action.
	EndTime *time.Time

	// READ-ONLY; String that represents the start time of the action.
	StartTime *time.Time

	// READ-ONLY; The status of the action.
	Status *string

	// READ-ONLY; The array of targets.
	Targets []*ExperimentExecutionActionTargetDetailsProperties
}

ActionStatus - Model that represents the an action and its status.

func (ActionStatus) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ActionStatus.

func (*ActionStatus) UnmarshalJSON added in v0.5.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ActionStatus.

type ActionType

type ActionType string

ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.

const (
	ActionTypeInternal ActionType = "Internal"
)

func PossibleActionTypeValues

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type BranchStatus

type BranchStatus struct {
	// READ-ONLY; The array of actions.
	Actions []*ActionStatus

	// READ-ONLY; The id of the branch status.
	BranchID *string

	// READ-ONLY; The name of the branch status.
	BranchName *string

	// READ-ONLY; The status of the branch.
	Status *string
}

BranchStatus - Model that represents the a list of actions and action statuses.

func (BranchStatus) MarshalJSON

func (b BranchStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type BranchStatus.

func (*BranchStatus) UnmarshalJSON added in v0.6.0

func (b *BranchStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type BranchStatus.

type CapabilitiesClient

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

CapabilitiesClient contains the methods for the Capabilities group. Don't use this type directly, use NewCapabilitiesClient() instead.

func NewCapabilitiesClient

func NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapabilitiesClient, error)

NewCapabilitiesClient creates a new instance of CapabilitiesClient with the specified values.

  • subscriptionID - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*CapabilitiesClient) CreateOrUpdate

func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability Capability, options *CapabilitiesClientCreateOrUpdateOptions) (CapabilitiesClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create or update a Capability resource that extends a Target resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • capabilityName - String that represents a Capability resource name.
  • capability - Capability resource to be created or updated.
  • options - CapabilitiesClientCreateOrUpdateOptions contains the optional parameters for the CapabilitiesClient.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateCapability.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapabilitiesClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", armchaos.Capability{
		Properties: &armchaos.CapabilityProperties{},
	}, 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.Capability = armchaos.Capability{
	// 	Name: to.Ptr("Shutdown-1.0"),
	// 	Type: to.Ptr("Microsoft.Chaos/targets/capabilities"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"),
	// 	Properties: &armchaos.CapabilityProperties{
	// 		Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."),
	// 		ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"),
	// 		Publisher: to.Ptr("Microsoft"),
	// 		TargetType: to.Ptr("VirtualMachine"),
	// 		Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
	// 	},
	// 	SystemData: &armchaos.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()),
	// 	},
	// }
}
Output:

func (*CapabilitiesClient) Delete

func (client *CapabilitiesClient) Delete(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, options *CapabilitiesClientDeleteOptions) (CapabilitiesClientDeleteResponse, error)

Delete - Delete a Capability that extends a Target resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • capabilityName - String that represents a Capability resource name.
  • options - CapabilitiesClientDeleteOptions contains the optional parameters for the CapabilitiesClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewCapabilitiesClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*CapabilitiesClient) Get

func (client *CapabilitiesClient) Get(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, options *CapabilitiesClientGetOptions) (CapabilitiesClientGetResponse, error)

Get - Get a Capability resource that extends a Target resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • capabilityName - String that represents a Capability resource name.
  • options - CapabilitiesClientGetOptions contains the optional parameters for the CapabilitiesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapabilitiesClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.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.Capability = armchaos.Capability{
	// 	Name: to.Ptr("Shutdown-1.0"),
	// 	Type: to.Ptr("Microsoft.Chaos/targets/capabilities"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"),
	// 	Properties: &armchaos.CapabilityProperties{
	// 		Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."),
	// 		ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"),
	// 		Publisher: to.Ptr("Microsoft"),
	// 		TargetType: to.Ptr("VirtualMachine"),
	// 		Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
	// 	},
	// 	SystemData: &armchaos.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()),
	// 	},
	// }
}
Output:

func (*CapabilitiesClient) NewListPager added in v0.4.0

func (client *CapabilitiesClient) NewListPager(resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *CapabilitiesClientListOptions) *runtime.Pager[CapabilitiesClientListResponse]

NewListPager - Get a list of Capability resources that extend a Target resource..

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • options - CapabilitiesClientListOptions contains the optional parameters for the CapabilitiesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilities.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapabilitiesClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", &armchaos.CapabilitiesClientListOptions{ContinuationToken: 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.CapabilityListResult = armchaos.CapabilityListResult{
		// 	Value: []*armchaos.Capability{
		// 		{
		// 			Name: to.Ptr("Shutdown-1.0"),
		// 			Type: to.Ptr("Microsoft.Chaos/targets/capabilities"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"),
		// 			Properties: &armchaos.CapabilityProperties{
		// 				Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."),
		// 				ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"),
		// 				Publisher: to.Ptr("Microsoft"),
		// 				TargetType: to.Ptr("VirtualMachine"),
		// 				Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
		// 			},
		// 			SystemData: &armchaos.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

type CapabilitiesClientCreateOrUpdateOptions added in v0.2.0

type CapabilitiesClientCreateOrUpdateOptions struct {
}

CapabilitiesClientCreateOrUpdateOptions contains the optional parameters for the CapabilitiesClient.CreateOrUpdate method.

type CapabilitiesClientCreateOrUpdateResponse added in v0.2.0

type CapabilitiesClientCreateOrUpdateResponse struct {
	// Model that represents a Capability resource.
	Capability
}

CapabilitiesClientCreateOrUpdateResponse contains the response from method CapabilitiesClient.CreateOrUpdate.

type CapabilitiesClientDeleteOptions added in v0.2.0

type CapabilitiesClientDeleteOptions struct {
}

CapabilitiesClientDeleteOptions contains the optional parameters for the CapabilitiesClient.Delete method.

type CapabilitiesClientDeleteResponse added in v0.2.0

type CapabilitiesClientDeleteResponse struct {
}

CapabilitiesClientDeleteResponse contains the response from method CapabilitiesClient.Delete.

type CapabilitiesClientGetOptions added in v0.2.0

type CapabilitiesClientGetOptions struct {
}

CapabilitiesClientGetOptions contains the optional parameters for the CapabilitiesClient.Get method.

type CapabilitiesClientGetResponse added in v0.2.0

type CapabilitiesClientGetResponse struct {
	// Model that represents a Capability resource.
	Capability
}

CapabilitiesClientGetResponse contains the response from method CapabilitiesClient.Get.

type CapabilitiesClientListOptions added in v0.2.0

type CapabilitiesClientListOptions struct {
	// String that sets the continuation token.
	ContinuationToken *string
}

CapabilitiesClientListOptions contains the optional parameters for the CapabilitiesClient.NewListPager method.

type CapabilitiesClientListResponse added in v0.2.0

type CapabilitiesClientListResponse struct {
	// Model that represents a list of Capability resources and a link for pagination.
	CapabilityListResult
}

CapabilitiesClientListResponse contains the response from method CapabilitiesClient.NewListPager.

type Capability

type Capability struct {
	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The properties of a capability resource.
	Properties *CapabilityProperties

	// READ-ONLY; The standard system metadata of a resource type.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Capability - Model that represents a Capability resource.

func (Capability) MarshalJSON

func (c Capability) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Capability.

func (*Capability) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Capability.

type CapabilityListResult

type CapabilityListResult struct {
	// READ-ONLY; URL to retrieve the next page of Capability resources.
	NextLink *string

	// READ-ONLY; List of Capability resources.
	Value []*Capability
}

CapabilityListResult - Model that represents a list of Capability resources and a link for pagination.

func (CapabilityListResult) MarshalJSON

func (c CapabilityListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapabilityListResult.

func (*CapabilityListResult) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityListResult.

type CapabilityProperties

type CapabilityProperties struct {
	// READ-ONLY; Localized string of the description.
	Description *string

	// READ-ONLY; URL to retrieve JSON schema of the Capability parameters.
	ParametersSchema *string

	// READ-ONLY; String of the Publisher that this Capability extends.
	Publisher *string

	// READ-ONLY; String of the Target Type that this Capability extends.
	TargetType *string

	// READ-ONLY; String of the URN for this Capability Type.
	Urn *string
}

CapabilityProperties - Model that represents the Capability properties model.

func (CapabilityProperties) MarshalJSON added in v0.6.0

func (c CapabilityProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapabilityProperties.

func (*CapabilityProperties) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityProperties.

type CapabilityType

type CapabilityType struct {
	// Location of the Capability Type resource.
	Location *string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The properties of the capability type resource.
	Properties *CapabilityTypeProperties

	// READ-ONLY; The system metadata properties of the capability type resource.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

CapabilityType - Model that represents a Capability Type resource.

func (CapabilityType) MarshalJSON

func (c CapabilityType) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapabilityType.

func (*CapabilityType) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityType.

type CapabilityTypeListResult

type CapabilityTypeListResult struct {
	// READ-ONLY; URL to retrieve the next page of Capability Type resources.
	NextLink *string

	// READ-ONLY; List of Capability Type resources.
	Value []*CapabilityType
}

CapabilityTypeListResult - Model that represents a list of Capability Type resources and a link for pagination.

func (CapabilityTypeListResult) MarshalJSON

func (c CapabilityTypeListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapabilityTypeListResult.

func (*CapabilityTypeListResult) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityTypeListResult.

type CapabilityTypeProperties

type CapabilityTypeProperties struct {
	// Control plane actions necessary to execute capability type.
	AzureRbacActions []*string

	// Data plane actions necessary to execute capability type.
	AzureRbacDataActions []*string

	// Runtime properties of this Capability Type.
	RuntimeProperties *CapabilityTypePropertiesRuntimeProperties

	// READ-ONLY; Localized string of the description.
	Description *string

	// READ-ONLY; Localized string of the display name.
	DisplayName *string

	// READ-ONLY; String of the kind of this Capability Type.
	Kind *string

	// READ-ONLY; URL to retrieve JSON schema of the Capability Type parameters.
	ParametersSchema *string

	// READ-ONLY; String of the Publisher that this Capability Type extends.
	Publisher *string

	// READ-ONLY; String of the Target Type that this Capability Type extends.
	TargetType *string

	// READ-ONLY; String of the URN for this Capability Type.
	Urn *string
}

CapabilityTypeProperties - Model that represents the Capability Type properties model.

func (CapabilityTypeProperties) MarshalJSON added in v0.6.0

func (c CapabilityTypeProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CapabilityTypeProperties.

func (*CapabilityTypeProperties) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityTypeProperties.

type CapabilityTypePropertiesRuntimeProperties added in v0.7.0

type CapabilityTypePropertiesRuntimeProperties struct {
	// READ-ONLY; String of the kind of the resource's action type (continuous or discrete).
	Kind *string
}

CapabilityTypePropertiesRuntimeProperties - Runtime properties of this Capability Type.

func (CapabilityTypePropertiesRuntimeProperties) MarshalJSON added in v0.7.0

MarshalJSON implements the json.Marshaller interface for type CapabilityTypePropertiesRuntimeProperties.

func (*CapabilityTypePropertiesRuntimeProperties) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityTypePropertiesRuntimeProperties.

type CapabilityTypesClient

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

CapabilityTypesClient contains the methods for the CapabilityTypes group. Don't use this type directly, use NewCapabilityTypesClient() instead.

func NewCapabilityTypesClient

func NewCapabilityTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapabilityTypesClient, error)

NewCapabilityTypesClient creates a new instance of CapabilityTypesClient with the specified values.

  • subscriptionID - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*CapabilityTypesClient) Get

func (client *CapabilityTypesClient) Get(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (CapabilityTypesClientGetResponse, error)

Get - Get a Capability Type resource for given Target Type and location. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • locationName - String that represents a Location resource name.
  • targetTypeName - String that represents a Target Type resource name.
  • capabilityTypeName - String that represents a Capability Type resource name.
  • options - CapabilityTypesClientGetOptions contains the optional parameters for the CapabilityTypesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapabilityType.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewCapabilityTypesClient().Get(ctx, "westus2", "Microsoft-VirtualMachine", "Shutdown-1.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.CapabilityType = armchaos.CapabilityType{
	// 	Name: to.Ptr("Shutdown-1.0"),
	// 	Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"),
	// 	Properties: &armchaos.CapabilityTypeProperties{
	// 		Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."),
	// 		DisplayName: to.Ptr("Shutdown VM"),
	// 		Kind: to.Ptr("fault"),
	// 		ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"),
	// 		Publisher: to.Ptr("Microsoft"),
	// 		RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{
	// 			Kind: to.Ptr("continuous"),
	// 		},
	// 		TargetType: to.Ptr("VirtualMachine"),
	// 		Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
	// 	},
	// }
}
Output:

func (*CapabilityTypesClient) NewListPager added in v0.4.0

func (client *CapabilityTypesClient) NewListPager(locationName string, targetTypeName string, options *CapabilityTypesClientListOptions) *runtime.Pager[CapabilityTypesClientListResponse]

NewListPager - Get a list of Capability Type resources for given Target Type and location.

Generated from API version 2024-01-01

  • locationName - String that represents a Location resource name.
  • targetTypeName - String that represents a Target Type resource name.
  • options - CapabilityTypesClientListOptions contains the optional parameters for the CapabilityTypesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilityTypes.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewCapabilityTypesClient().NewListPager("westus2", "Microsoft-VirtualMachine", &armchaos.CapabilityTypesClientListOptions{ContinuationToken: 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.CapabilityTypeListResult = armchaos.CapabilityTypeListResult{
		// 	Value: []*armchaos.CapabilityType{
		// 		{
		// 			Name: to.Ptr("Shutdown-1.0"),
		// 			Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"),
		// 			Properties: &armchaos.CapabilityTypeProperties{
		// 				Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."),
		// 				DisplayName: to.Ptr("Shutdown VM"),
		// 				Kind: to.Ptr("fault"),
		// 				ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"),
		// 				Publisher: to.Ptr("Microsoft"),
		// 				RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{
		// 					Kind: to.Ptr("continuous"),
		// 				},
		// 				TargetType: to.Ptr("VirtualMachine"),
		// 				Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type CapabilityTypesClientGetOptions added in v0.2.0

type CapabilityTypesClientGetOptions struct {
}

CapabilityTypesClientGetOptions contains the optional parameters for the CapabilityTypesClient.Get method.

type CapabilityTypesClientGetResponse added in v0.2.0

type CapabilityTypesClientGetResponse struct {
	// Model that represents a Capability Type resource.
	CapabilityType
}

CapabilityTypesClientGetResponse contains the response from method CapabilityTypesClient.Get.

type CapabilityTypesClientListOptions added in v0.2.0

type CapabilityTypesClientListOptions struct {
	// String that sets the continuation token.
	ContinuationToken *string
}

CapabilityTypesClientListOptions contains the optional parameters for the CapabilityTypesClient.NewListPager method.

type CapabilityTypesClientListResponse added in v0.2.0

type CapabilityTypesClientListResponse struct {
	// Model that represents a list of Capability Type resources and a link for pagination.
	CapabilityTypeListResult
}

CapabilityTypesClientListResponse contains the response from method CapabilityTypesClient.NewListPager.

type ClientFactory added in v0.6.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 v0.6.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 - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewCapabilitiesClient added in v0.6.0

func (c *ClientFactory) NewCapabilitiesClient() *CapabilitiesClient

NewCapabilitiesClient creates a new instance of CapabilitiesClient.

func (*ClientFactory) NewCapabilityTypesClient added in v0.6.0

func (c *ClientFactory) NewCapabilityTypesClient() *CapabilityTypesClient

NewCapabilityTypesClient creates a new instance of CapabilityTypesClient.

func (*ClientFactory) NewExperimentsClient added in v0.6.0

func (c *ClientFactory) NewExperimentsClient() *ExperimentsClient

NewExperimentsClient creates a new instance of ExperimentsClient.

func (*ClientFactory) NewOperationStatusesClient added in v1.0.0

func (c *ClientFactory) NewOperationStatusesClient() *OperationStatusesClient

NewOperationStatusesClient creates a new instance of OperationStatusesClient.

func (*ClientFactory) NewOperationsClient added in v0.6.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewTargetTypesClient added in v0.6.0

func (c *ClientFactory) NewTargetTypesClient() *TargetTypesClient

NewTargetTypesClient creates a new instance of TargetTypesClient.

func (*ClientFactory) NewTargetsClient added in v0.6.0

func (c *ClientFactory) NewTargetsClient() *TargetsClient

NewTargetsClient creates a new instance of TargetsClient.

type ContinuousAction added in v0.2.0

type ContinuousAction struct {
	// REQUIRED; ISO8601 formatted string that represents a duration.
	Duration *string

	// REQUIRED; String that represents a Capability URN.
	Name *string

	// REQUIRED; List of key value pairs.
	Parameters []*KeyValuePair

	// REQUIRED; String that represents a selector.
	SelectorID *string

	// REQUIRED; Enum that discriminates between action models.
	Type *string
}

ContinuousAction - Model that represents a continuous action.

func (*ContinuousAction) GetExperimentAction added in v1.0.0

func (c *ContinuousAction) GetExperimentAction() *ExperimentAction

GetExperimentAction implements the ExperimentActionClassification interface for type ContinuousAction.

func (ContinuousAction) MarshalJSON added in v0.2.0

func (c ContinuousAction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ContinuousAction.

func (*ContinuousAction) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousAction.

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

type DelayAction struct {
	// REQUIRED; ISO8601 formatted string that represents a duration.
	Duration *string

	// REQUIRED; String that represents a Capability URN.
	Name *string

	// REQUIRED; Enum that discriminates between action models.
	Type *string
}

DelayAction - Model that represents a delay action.

func (*DelayAction) GetExperimentAction added in v1.0.0

func (d *DelayAction) GetExperimentAction() *ExperimentAction

GetExperimentAction implements the ExperimentActionClassification interface for type DelayAction.

func (DelayAction) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type DelayAction.

func (*DelayAction) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type DelayAction.

type DiscreteAction added in v0.2.0

type DiscreteAction struct {
	// REQUIRED; String that represents a Capability URN.
	Name *string

	// REQUIRED; List of key value pairs.
	Parameters []*KeyValuePair

	// REQUIRED; String that represents a selector.
	SelectorID *string

	// REQUIRED; Enum that discriminates between action models.
	Type *string
}

DiscreteAction - Model that represents a discrete action.

func (*DiscreteAction) GetExperimentAction added in v1.0.0

func (d *DiscreteAction) GetExperimentAction() *ExperimentAction

GetExperimentAction implements the ExperimentActionClassification interface for type DiscreteAction.

func (DiscreteAction) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type DiscreteAction.

func (*DiscreteAction) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type DiscreteAction.

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 v0.6.0

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

MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo.

func (*ErrorAdditionalInfo) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo.

type ErrorDetail

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

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

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

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

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

ErrorDetail - The error detail.

func (ErrorDetail) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ErrorDetail.

func (*ErrorDetail) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail.

type ErrorResponse

type ErrorResponse struct {
	// The error object.
	Error *ErrorDetail
}

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

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

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type Experiment

type Experiment struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// REQUIRED; The properties of the experiment resource.
	Properties *ExperimentProperties

	// The identity of the experiment resource.
	Identity *ResourceIdentity

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The system metadata of the experiment resource.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Experiment - Model that represents a Experiment resource.

func (Experiment) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Experiment.

func (*Experiment) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Experiment.

type ExperimentAction added in v1.0.0

type ExperimentAction struct {
	// REQUIRED; String that represents a Capability URN.
	Name *string

	// REQUIRED; Enum that discriminates between action models.
	Type *string
}

ExperimentAction - Model that represents the base action model. 9 total per experiment.

func (*ExperimentAction) GetExperimentAction added in v1.0.0

func (e *ExperimentAction) GetExperimentAction() *ExperimentAction

GetExperimentAction implements the ExperimentActionClassification interface for type ExperimentAction.

func (ExperimentAction) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentAction.

func (*ExperimentAction) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentAction.

type ExperimentActionClassification added in v1.0.0

type ExperimentActionClassification interface {
	// GetExperimentAction returns the ExperimentAction content of the underlying type.
	GetExperimentAction() *ExperimentAction
}

ExperimentActionClassification provides polymorphic access to related types. Call the interface's GetExperimentAction() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *ContinuousAction, *DelayAction, *DiscreteAction, *ExperimentAction

type ExperimentBranch added in v1.0.0

type ExperimentBranch struct {
	// REQUIRED; List of actions.
	Actions []ExperimentActionClassification

	// REQUIRED; String of the branch name.
	Name *string
}

ExperimentBranch - Model that represents a branch in the step. 9 total per experiment.

func (ExperimentBranch) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentBranch.

func (*ExperimentBranch) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentBranch.

type ExperimentExecution added in v1.0.0

type ExperimentExecution struct {
	// The properties of experiment execution status.
	Properties *ExperimentExecutionProperties

	// READ-ONLY; String of the fully qualified resource ID.
	ID *string

	// READ-ONLY; String of the resource name.
	Name *string

	// READ-ONLY; String of the resource type.
	Type *string
}

ExperimentExecution - Model that represents the execution of a Experiment.

func (ExperimentExecution) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentExecution.

func (*ExperimentExecution) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecution.

type ExperimentExecutionActionTargetDetailsError

type ExperimentExecutionActionTargetDetailsError struct {
	// READ-ONLY; The error code.
	Code *string

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

ExperimentExecutionActionTargetDetailsError - Model that represents the Experiment action target details error model.

func (ExperimentExecutionActionTargetDetailsError) MarshalJSON added in v0.6.0

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionActionTargetDetailsError.

func (*ExperimentExecutionActionTargetDetailsError) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionActionTargetDetailsError.

type ExperimentExecutionActionTargetDetailsProperties

type ExperimentExecutionActionTargetDetailsProperties struct {
	// READ-ONLY; The error of the action.
	Error *ExperimentExecutionActionTargetDetailsError

	// READ-ONLY; The status of the execution.
	Status *string

	// READ-ONLY; The target for the action.
	Target *string

	// READ-ONLY; String that represents the completed date time.
	TargetCompletedTime *time.Time

	// READ-ONLY; String that represents the failed date time.
	TargetFailedTime *time.Time
}

ExperimentExecutionActionTargetDetailsProperties - Model that represents the Experiment action target details properties model.

func (ExperimentExecutionActionTargetDetailsProperties) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionActionTargetDetailsProperties.

func (*ExperimentExecutionActionTargetDetailsProperties) UnmarshalJSON

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionActionTargetDetailsProperties.

type ExperimentExecutionDetails

type ExperimentExecutionDetails struct {
	// READ-ONLY; String of the fully qualified resource ID.
	ID *string

	// READ-ONLY; String of the resource name.
	Name *string

	// READ-ONLY; The properties of the experiment execution details.
	Properties *ExperimentExecutionDetailsProperties

	// READ-ONLY; String of the resource type.
	Type *string
}

ExperimentExecutionDetails - Model that represents the execution details of an Experiment.

func (ExperimentExecutionDetails) MarshalJSON added in v0.6.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionDetails.

func (*ExperimentExecutionDetails) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionDetails.

type ExperimentExecutionDetailsProperties

type ExperimentExecutionDetailsProperties struct {
	// READ-ONLY; The reason why the execution failed.
	FailureReason *string

	// READ-ONLY; String that represents the last action date time.
	LastActionAt *time.Time

	// READ-ONLY; The information of the experiment run.
	RunInformation *ExperimentExecutionDetailsPropertiesRunInformation

	// READ-ONLY; String that represents the start date time.
	StartedAt *time.Time

	// READ-ONLY; The status of the execution.
	Status *string

	// READ-ONLY; String that represents the stop date time.
	StoppedAt *time.Time
}

ExperimentExecutionDetailsProperties - Model that represents the extended properties of an experiment execution.

func (ExperimentExecutionDetailsProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionDetailsProperties.

func (*ExperimentExecutionDetailsProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionDetailsProperties.

type ExperimentExecutionDetailsPropertiesRunInformation

type ExperimentExecutionDetailsPropertiesRunInformation struct {
	// READ-ONLY; The steps of the experiment run.
	Steps []*StepStatus
}

ExperimentExecutionDetailsPropertiesRunInformation - The information of the experiment run.

func (ExperimentExecutionDetailsPropertiesRunInformation) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionDetailsPropertiesRunInformation.

func (*ExperimentExecutionDetailsPropertiesRunInformation) UnmarshalJSON added in v0.6.0

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionDetailsPropertiesRunInformation.

type ExperimentExecutionListResult added in v1.0.0

type ExperimentExecutionListResult struct {
	// READ-ONLY; URL to retrieve the next page of Experiment executions.
	NextLink *string

	// READ-ONLY; List of Experiment executions.
	Value []*ExperimentExecution
}

ExperimentExecutionListResult - Model that represents a list of Experiment executions and a link for pagination.

func (ExperimentExecutionListResult) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionListResult.

func (*ExperimentExecutionListResult) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionListResult.

type ExperimentExecutionProperties added in v1.0.0

type ExperimentExecutionProperties struct {
	// READ-ONLY; String that represents the start date time.
	StartedAt *time.Time

	// READ-ONLY; The status of the execution.
	Status *string

	// READ-ONLY; String that represents the stop date time.
	StoppedAt *time.Time
}

ExperimentExecutionProperties - Model that represents the execution properties of an Experiment.

func (ExperimentExecutionProperties) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionProperties.

func (*ExperimentExecutionProperties) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionProperties.

type ExperimentListResult

type ExperimentListResult struct {
	// READ-ONLY; URL to retrieve the next page of Experiment resources.
	NextLink *string

	// READ-ONLY; List of Experiment resources.
	Value []*Experiment
}

ExperimentListResult - Model that represents a list of Experiment resources and a link for pagination.

func (ExperimentListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExperimentListResult.

func (*ExperimentListResult) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentListResult.

type ExperimentProperties

type ExperimentProperties struct {
	// REQUIRED; List of selectors.
	Selectors []TargetSelectorClassification

	// REQUIRED; List of steps.
	Steps []*ExperimentStep

	// READ-ONLY; Most recent provisioning state for the given experiment resource.
	ProvisioningState *ProvisioningState
}

ExperimentProperties - Model that represents the Experiment properties model.

func (ExperimentProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExperimentProperties.

func (*ExperimentProperties) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentProperties.

type ExperimentStep added in v1.0.0

type ExperimentStep struct {
	// REQUIRED; List of branches.
	Branches []*ExperimentBranch

	// REQUIRED; String of the step name.
	Name *string
}

ExperimentStep - Model that represents a step in the Experiment resource.

func (ExperimentStep) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentStep.

func (*ExperimentStep) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentStep.

type ExperimentUpdate added in v0.7.0

type ExperimentUpdate struct {
	// The identity of the experiment resource.
	Identity *ResourceIdentity

	// The tags of the experiment resource.
	Tags map[string]*string
}

ExperimentUpdate - Describes an experiment update.

func (ExperimentUpdate) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type ExperimentUpdate.

func (*ExperimentUpdate) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentUpdate.

type ExperimentsClient

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

ExperimentsClient contains the methods for the Experiments group. Don't use this type directly, use NewExperimentsClient() instead.

func NewExperimentsClient

func NewExperimentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExperimentsClient, error)

NewExperimentsClient creates a new instance of ExperimentsClient with the specified values.

  • subscriptionID - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ExperimentsClient) BeginCancel

func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*runtime.Poller[ExperimentsClientCancelResponse], error)

BeginCancel - Cancel a running Experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • options - ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewExperimentsClient().BeginCancel(ctx, "exampleRG", "exampleExperiment", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*ExperimentsClient) BeginCreateOrUpdate

func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExperimentsClientCreateOrUpdateResponse], error)

BeginCreateOrUpdate - Create or update a Experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • experiment - Experiment resource to be created or updated.
  • options - ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.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/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewExperimentsClient().BeginCreateOrUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.Experiment{
		Location: to.Ptr("eastus2euap"),
		Identity: &armchaos.ResourceIdentity{
			Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned),
		},
		Properties: &armchaos.ExperimentProperties{
			Selectors: []armchaos.TargetSelectorClassification{
				&armchaos.TargetListSelector{
					Type: to.Ptr(armchaos.SelectorTypeList),
					ID:   to.Ptr("selector1"),
					Targets: []*armchaos.TargetReference{
						{
							Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget),
							ID:   to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"),
						}},
				}},
			Steps: []*armchaos.ExperimentStep{
				{
					Name: to.Ptr("step1"),
					Branches: []*armchaos.ExperimentBranch{
						{
							Name: to.Ptr("branch1"),
							Actions: []armchaos.ExperimentActionClassification{
								&armchaos.ContinuousAction{
									Name:     to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
									Type:     to.Ptr("continuous"),
									Duration: to.Ptr("PT10M"),
									Parameters: []*armchaos.KeyValuePair{
										{
											Key:   to.Ptr("abruptShutdown"),
											Value: to.Ptr("false"),
										}},
									SelectorID: to.Ptr("selector1"),
								}},
						}},
				}},
		},
	}, 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)
	}
	// 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.Experiment = armchaos.Experiment{
	// 	Name: to.Ptr("exampleExperiment"),
	// 	Type: to.Ptr("Microsoft.Chaos/experiments"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"),
	// 	Location: to.Ptr("eastus2euap"),
	// 	Identity: &armchaos.ResourceIdentity{
	// 		Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned),
	// 		PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"),
	// 		TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"),
	// 	},
	// 	Properties: &armchaos.ExperimentProperties{
	// 		ProvisioningState: to.Ptr(armchaos.ProvisioningStateSucceeded),
	// 		Selectors: []armchaos.TargetSelectorClassification{
	// 			&armchaos.TargetListSelector{
	// 				Type: to.Ptr(armchaos.SelectorTypeList),
	// 				ID: to.Ptr("selector1"),
	// 				Targets: []*armchaos.TargetReference{
	// 					{
	// 						Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget),
	// 						ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"),
	// 				}},
	// 		}},
	// 		Steps: []*armchaos.ExperimentStep{
	// 			{
	// 				Name: to.Ptr("step1"),
	// 				Branches: []*armchaos.ExperimentBranch{
	// 					{
	// 						Name: to.Ptr("branch1"),
	// 						Actions: []armchaos.ExperimentActionClassification{
	// 							&armchaos.ContinuousAction{
	// 								Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"),
	// 								Type: to.Ptr("continuous"),
	// 								Duration: to.Ptr("PT10M"),
	// 								Parameters: []*armchaos.KeyValuePair{
	// 									{
	// 										Key: to.Ptr("abruptShutdown"),
	// 										Value: to.Ptr("false"),
	// 								}},
	// 								SelectorID: to.Ptr("selector1"),
	// 						}},
	// 				}},
	// 		}},
	// 	},
	// 	SystemData: &armchaos.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 		CreatedBy: to.Ptr("User"),
	// 		CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("User"),
	// 		LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
	// 	},
	// }
}
Output:

func (*ExperimentsClient) BeginDelete added in v1.0.0

func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*runtime.Poller[ExperimentsClientDeleteResponse], error)

BeginDelete - Delete a Experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • options - ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewExperimentsClient().BeginDelete(ctx, "exampleRG", "exampleExperiment", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*ExperimentsClient) BeginStart added in v1.0.0

func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*runtime.Poller[ExperimentsClientStartResponse], error)

BeginStart - Start a Experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • options - ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewExperimentsClient().BeginStart(ctx, "exampleRG", "exampleExperiment", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*ExperimentsClient) BeginUpdate added in v1.0.0

func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*runtime.Poller[ExperimentsClientUpdateResponse], error)

BeginUpdate - The operation to update an experiment. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • experiment - Parameters supplied to the Update experiment operation.
  • options - ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.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/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewExperimentsClient().BeginUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.ExperimentUpdate{
		Identity: &armchaos.ResourceIdentity{
			Type: to.Ptr(armchaos.ResourceIdentityTypeUserAssigned),
			UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{
				"/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": {},
			},
		},
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
			"key2": to.Ptr("value2"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*ExperimentsClient) ExecutionDetails added in v1.0.0

func (client *ExperimentsClient) ExecutionDetails(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientExecutionDetailsOptions) (ExperimentsClientExecutionDetailsResponse, error)

ExecutionDetails - Execution details of an experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • executionID - GUID that represents a Experiment execution detail.
  • options - ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExperimentsClient().ExecutionDetails(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", 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.ExperimentExecutionDetails = armchaos.ExperimentExecutionDetails{
	// 	Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"),
	// 	Type: to.Ptr("Microsoft.Chaos/experiments/executions/getExecutionDetails"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333/getExecutionDetails"),
	// 	Properties: &armchaos.ExperimentExecutionDetailsProperties{
	// 		StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()),
	// 		Status: to.Ptr("failed"),
	// 		StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()),
	// 		FailureReason: to.Ptr("Dependency failure"),
	// 		LastActionAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()),
	// 		RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{
	// 			Steps: []*armchaos.StepStatus{
	// 				{
	// 					Branches: []*armchaos.BranchStatus{
	// 						{
	// 							Actions: []*armchaos.ActionStatus{
	// 								{
	// 									ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"),
	// 									ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"),
	// 									EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:13.627Z"); return t}()),
	// 									StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:13.627Z"); return t}()),
	// 									Status: to.Ptr("failed"),
	// 									Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{
	// 										{
	// 											Status: to.Ptr("succeeded"),
	// 											Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"),
	// 											TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55.000Z"); return t}()),
	// 											TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55.000Z"); return t}()),
	// 										},
	// 										{
	// 											Status: to.Ptr("failed"),
	// 											Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"),
	// 											TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55.000Z"); return t}()),
	// 											TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55.000Z"); return t}()),
	// 									}},
	// 							}},
	// 							BranchID: to.Ptr("FirstBranch"),
	// 							BranchName: to.Ptr("FirstBranch"),
	// 							Status: to.Ptr("failed"),
	// 					}},
	// 					Status: to.Ptr("failed"),
	// 					StepID: to.Ptr("FirstStep"),
	// 					StepName: to.Ptr("FirstStep"),
	// 			}},
	// 		},
	// 	},
	// }
}
Output:

func (*ExperimentsClient) Get

func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (ExperimentsClientGetResponse, error)

Get - Get a Experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • options - ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExperimentsClient().Get(ctx, "exampleRG", "exampleExperiment", 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.Experiment = armchaos.Experiment{
	// 	Name: to.Ptr("exampleExperiment"),
	// 	Type: to.Ptr("Microsoft.Chaos/experiments"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"),
	// 	Location: to.Ptr("centraluseuap"),
	// 	Identity: &armchaos.ResourceIdentity{
	// 		Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned),
	// 		PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"),
	// 		TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"),
	// 	},
	// 	Properties: &armchaos.ExperimentProperties{
	// 		Selectors: []armchaos.TargetSelectorClassification{
	// 			&armchaos.TargetListSelector{
	// 				Type: to.Ptr(armchaos.SelectorTypeList),
	// 				ID: to.Ptr("selector1"),
	// 				Targets: []*armchaos.TargetReference{
	// 					{
	// 						Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget),
	// 						ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"),
	// 				}},
	// 		}},
	// 		Steps: []*armchaos.ExperimentStep{
	// 			{
	// 				Name: to.Ptr("step1"),
	// 				Branches: []*armchaos.ExperimentBranch{
	// 					{
	// 						Name: to.Ptr("branch1"),
	// 						Actions: []armchaos.ExperimentActionClassification{
	// 							&armchaos.ContinuousAction{
	// 								Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"),
	// 								Type: to.Ptr("continuous"),
	// 								Duration: to.Ptr("PT10M"),
	// 								Parameters: []*armchaos.KeyValuePair{
	// 									{
	// 										Key: to.Ptr("abruptShutdown"),
	// 										Value: to.Ptr("false"),
	// 								}},
	// 								SelectorID: to.Ptr("selector1"),
	// 						}},
	// 				}},
	// 		}},
	// 	},
	// 	SystemData: &armchaos.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 		CreatedBy: to.Ptr("User"),
	// 		CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 		LastModifiedBy: to.Ptr("User"),
	// 		LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
	// 	},
	// }
}
Output:

func (*ExperimentsClient) GetExecution added in v1.0.0

func (client *ExperimentsClient) GetExecution(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientGetExecutionOptions) (ExperimentsClientGetExecutionResponse, error)

GetExecution - Get an execution of an Experiment resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • executionID - GUID that represents a Experiment execution detail.
  • options - ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewExperimentsClient().GetExecution(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", 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.ExperimentExecution = armchaos.ExperimentExecution{
	// 	Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"),
	// 	Type: to.Ptr("Microsoft.Chaos/experiments/executions"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333"),
	// 	Properties: &armchaos.ExperimentExecutionProperties{
	// 		StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()),
	// 		Status: to.Ptr("failed"),
	// 		StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()),
	// 	},
	// }
}
Output:

func (*ExperimentsClient) NewListAllExecutionsPager added in v1.0.0

func (client *ExperimentsClient) NewListAllExecutionsPager(resourceGroupName string, experimentName string, options *ExperimentsClientListAllExecutionsOptions) *runtime.Pager[ExperimentsClientListAllExecutionsResponse]

NewListAllExecutionsPager - Get a list of executions of an Experiment resource.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • experimentName - String that represents a Experiment resource name.
  • options - ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewExperimentsClient().NewListAllExecutionsPager("exampleRG", "exampleExperiment", 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.ExperimentExecutionListResult = armchaos.ExperimentExecutionListResult{
		// 	Value: []*armchaos.ExperimentExecution{
		// 		{
		// 			Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"),
		// 			Type: to.Ptr("Microsoft.Chaos/experiments/executions"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/"),
		// 			Properties: &armchaos.ExperimentExecutionProperties{
		// 				StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()),
		// 				Status: to.Ptr("failed"),
		// 				StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"),
		// 			Type: to.Ptr("Microsoft.Chaos/experiments/executions"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/14d98367-52ef-4596-be4f-53fc81bbfc33"),
		// 			Properties: &armchaos.ExperimentExecutionProperties{
		// 				StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()),
		// 				Status: to.Ptr("success"),
		// 				StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*ExperimentsClient) NewListAllPager added in v0.4.0

NewListAllPager - Get a list of Experiment resources in a subscription.

Generated from API version 2024-01-01

  • options - ExperimentsClientListAllOptions contains the optional parameters for the ExperimentsClient.NewListAllPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewExperimentsClient().NewListAllPager(&armchaos.ExperimentsClientListAllOptions{Running: nil,
		ContinuationToken: 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.ExperimentListResult = armchaos.ExperimentListResult{
		// 	Value: []*armchaos.Experiment{
		// 		{
		// 			Name: to.Ptr("exampleExperiment"),
		// 			Type: to.Ptr("Microsoft.Chaos/experiments"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"),
		// 			Location: to.Ptr("centraluseuap"),
		// 			Identity: &armchaos.ResourceIdentity{
		// 				Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned),
		// 				PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"),
		// 				TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"),
		// 			},
		// 			Properties: &armchaos.ExperimentProperties{
		// 				Selectors: []armchaos.TargetSelectorClassification{
		// 					&armchaos.TargetListSelector{
		// 						Type: to.Ptr(armchaos.SelectorTypeList),
		// 						ID: to.Ptr("selector1"),
		// 						Targets: []*armchaos.TargetReference{
		// 							{
		// 								Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget),
		// 								ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"),
		// 						}},
		// 				}},
		// 				Steps: []*armchaos.ExperimentStep{
		// 					{
		// 						Name: to.Ptr("step1"),
		// 						Branches: []*armchaos.ExperimentBranch{
		// 							{
		// 								Name: to.Ptr("branch1"),
		// 								Actions: []armchaos.ExperimentActionClassification{
		// 									&armchaos.ContinuousAction{
		// 										Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"),
		// 										Type: to.Ptr("continuous"),
		// 										Duration: to.Ptr("PT10M"),
		// 										Parameters: []*armchaos.KeyValuePair{
		// 											{
		// 												Key: to.Ptr("abruptShutdown"),
		// 												Value: to.Ptr("false"),
		// 										}},
		// 										SelectorID: to.Ptr("selector1"),
		// 								}},
		// 						}},
		// 				}},
		// 			},
		// 			SystemData: &armchaos.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
		// 				CreatedBy: to.Ptr("User"),
		// 				CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("User"),
		// 				LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*ExperimentsClient) NewListPager added in v0.4.0

func (client *ExperimentsClient) NewListPager(resourceGroupName string, options *ExperimentsClientListOptions) *runtime.Pager[ExperimentsClientListResponse]

NewListPager - Get a list of Experiment resources in a resource group.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • options - ExperimentsClientListOptions contains the optional parameters for the ExperimentsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewExperimentsClient().NewListPager("exampleRG", &armchaos.ExperimentsClientListOptions{Running: nil,
		ContinuationToken: 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.ExperimentListResult = armchaos.ExperimentListResult{
		// 	Value: []*armchaos.Experiment{
		// 		{
		// 			Name: to.Ptr("exampleExperiment"),
		// 			Type: to.Ptr("Microsoft.Chaos/experiments"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"),
		// 			Location: to.Ptr("centraluseuap"),
		// 			Identity: &armchaos.ResourceIdentity{
		// 				Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned),
		// 				PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"),
		// 				TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"),
		// 			},
		// 			Properties: &armchaos.ExperimentProperties{
		// 				Selectors: []armchaos.TargetSelectorClassification{
		// 					&armchaos.TargetListSelector{
		// 						Type: to.Ptr(armchaos.SelectorTypeList),
		// 						ID: to.Ptr("selector1"),
		// 						Targets: []*armchaos.TargetReference{
		// 							{
		// 								Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget),
		// 								ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"),
		// 						}},
		// 				}},
		// 				Steps: []*armchaos.ExperimentStep{
		// 					{
		// 						Name: to.Ptr("step1"),
		// 						Branches: []*armchaos.ExperimentBranch{
		// 							{
		// 								Name: to.Ptr("branch1"),
		// 								Actions: []armchaos.ExperimentActionClassification{
		// 									&armchaos.ContinuousAction{
		// 										Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"),
		// 										Type: to.Ptr("continuous"),
		// 										Duration: to.Ptr("PT10M"),
		// 										Parameters: []*armchaos.KeyValuePair{
		// 											{
		// 												Key: to.Ptr("abruptShutdown"),
		// 												Value: to.Ptr("false"),
		// 										}},
		// 										SelectorID: to.Ptr("selector1"),
		// 								}},
		// 						}},
		// 				}},
		// 			},
		// 			SystemData: &armchaos.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
		// 				CreatedBy: to.Ptr("User"),
		// 				CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
		// 				LastModifiedBy: to.Ptr("User"),
		// 				LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")),
		// 			},
		// 	}},
		// }
	}
}
Output:

type ExperimentsClientBeginCancelOptions added in v0.2.0

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

ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method.

type ExperimentsClientBeginCreateOrUpdateOptions added in v0.2.0

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

ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate method.

type ExperimentsClientBeginDeleteOptions added in v1.0.0

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

ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method.

type ExperimentsClientBeginStartOptions added in v1.0.0

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

ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method.

type ExperimentsClientBeginUpdateOptions added in v1.0.0

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

ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method.

type ExperimentsClientCancelResponse added in v0.2.0

type ExperimentsClientCancelResponse struct {
}

ExperimentsClientCancelResponse contains the response from method ExperimentsClient.BeginCancel.

type ExperimentsClientCreateOrUpdateResponse added in v0.2.0

type ExperimentsClientCreateOrUpdateResponse struct {
	// Model that represents a Experiment resource.
	Experiment
}

ExperimentsClientCreateOrUpdateResponse contains the response from method ExperimentsClient.BeginCreateOrUpdate.

type ExperimentsClientDeleteResponse added in v0.2.0

type ExperimentsClientDeleteResponse struct {
}

ExperimentsClientDeleteResponse contains the response from method ExperimentsClient.BeginDelete.

type ExperimentsClientExecutionDetailsOptions added in v1.0.0

type ExperimentsClientExecutionDetailsOptions struct {
}

ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails method.

type ExperimentsClientExecutionDetailsResponse added in v1.0.0

type ExperimentsClientExecutionDetailsResponse struct {
	// Model that represents the execution details of an Experiment.
	ExperimentExecutionDetails
}

ExperimentsClientExecutionDetailsResponse contains the response from method ExperimentsClient.ExecutionDetails.

type ExperimentsClientGetExecutionOptions added in v1.0.0

type ExperimentsClientGetExecutionOptions struct {
}

ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution method.

type ExperimentsClientGetExecutionResponse added in v1.0.0

type ExperimentsClientGetExecutionResponse struct {
	// Model that represents the execution of a Experiment.
	ExperimentExecution
}

ExperimentsClientGetExecutionResponse contains the response from method ExperimentsClient.GetExecution.

type ExperimentsClientGetOptions added in v0.2.0

type ExperimentsClientGetOptions struct {
}

ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method.

type ExperimentsClientGetResponse added in v0.2.0

type ExperimentsClientGetResponse struct {
	// Model that represents a Experiment resource.
	Experiment
}

ExperimentsClientGetResponse contains the response from method ExperimentsClient.Get.

type ExperimentsClientListAllExecutionsOptions added in v1.0.0

type ExperimentsClientListAllExecutionsOptions struct {
}

ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager method.

type ExperimentsClientListAllExecutionsResponse added in v1.0.0

type ExperimentsClientListAllExecutionsResponse struct {
	// Model that represents a list of Experiment executions and a link for pagination.
	ExperimentExecutionListResult
}

ExperimentsClientListAllExecutionsResponse contains the response from method ExperimentsClient.NewListAllExecutionsPager.

type ExperimentsClientListAllOptions added in v0.2.0

type ExperimentsClientListAllOptions struct {
	// String that sets the continuation token.
	ContinuationToken *string

	// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then
	// the results will not be filtered.
	Running *bool
}

ExperimentsClientListAllOptions contains the optional parameters for the ExperimentsClient.NewListAllPager method.

type ExperimentsClientListAllResponse added in v0.2.0

type ExperimentsClientListAllResponse struct {
	// Model that represents a list of Experiment resources and a link for pagination.
	ExperimentListResult
}

ExperimentsClientListAllResponse contains the response from method ExperimentsClient.NewListAllPager.

type ExperimentsClientListOptions added in v0.2.0

type ExperimentsClientListOptions struct {
	// String that sets the continuation token.
	ContinuationToken *string

	// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then
	// the results will not be filtered.
	Running *bool
}

ExperimentsClientListOptions contains the optional parameters for the ExperimentsClient.NewListPager method.

type ExperimentsClientListResponse added in v0.2.0

type ExperimentsClientListResponse struct {
	// Model that represents a list of Experiment resources and a link for pagination.
	ExperimentListResult
}

ExperimentsClientListResponse contains the response from method ExperimentsClient.NewListPager.

type ExperimentsClientStartResponse added in v0.2.0

type ExperimentsClientStartResponse struct {
}

ExperimentsClientStartResponse contains the response from method ExperimentsClient.BeginStart.

type ExperimentsClientUpdateResponse added in v0.7.0

type ExperimentsClientUpdateResponse struct {
	// Model that represents a Experiment resource.
	Experiment
}

ExperimentsClientUpdateResponse contains the response from method ExperimentsClient.BeginUpdate.

type FilterType added in v0.7.0

type FilterType string

FilterType - Enum that discriminates between filter types. Currently only Simple type is supported.

const (
	FilterTypeSimple FilterType = "Simple"
)

func PossibleFilterTypeValues added in v0.7.0

func PossibleFilterTypeValues() []FilterType

PossibleFilterTypeValues returns the possible values for the FilterType const type.

type KeyValuePair added in v0.2.0

type KeyValuePair struct {
	// REQUIRED; The name of the setting for the action.
	Key *string

	// REQUIRED; The value of the setting for the action.
	Value *string
}

KeyValuePair - A map to describe the settings of an action.

func (KeyValuePair) MarshalJSON added in v0.6.0

func (k KeyValuePair) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type KeyValuePair.

func (*KeyValuePair) UnmarshalJSON added in v0.6.0

func (k *KeyValuePair) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type KeyValuePair.

type Operation

type Operation struct {
	// Localized display information for this particular operation.
	Display *OperationDisplay

	// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
	ActionType *ActionType

	// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane
	// operations.
	IsDataAction *bool

	// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write",
	// "Microsoft.Compute/virtualMachines/capture/action"
	Name *string

	// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
	// value is "user,system"
	Origin *Origin
}

Operation - Details of a REST API operation, returned from the Resource Provider Operations API

func (Operation) MarshalJSON added in v0.6.0

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v0.6.0

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
	Description *string

	// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual
	// Machine", "Restart Virtual Machine".
	Operation *string

	// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
	// Compute".
	Provider *string

	// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job
	// Schedule Collections".
	Resource *string
}

OperationDisplay - Localized display information for this particular operation.

func (OperationDisplay) MarshalJSON added in v0.6.0

func (o OperationDisplay) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v0.6.0

func (o *OperationDisplay) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// READ-ONLY; URL to get the next set of operation list results (if there are any).
	NextLink *string

	// READ-ONLY; List of operations supported by the resource provider
	Value []*Operation
}

OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.

func (OperationListResult) MarshalJSON

func (o OperationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON added in v0.6.0

func (o *OperationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type OperationStatus added in v1.0.0

type OperationStatus struct {
	// The end time of the operation.
	EndTime *string

	// The error object.
	Error *ErrorDetail

	// The operation Id.
	ID *string

	// The operation name.
	Name *string

	// The start time of the operation.
	StartTime *string

	// The status of the operation.
	Status *string
}

OperationStatus - The status of operation.

func (OperationStatus) MarshalJSON added in v1.0.0

func (o OperationStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationStatus.

func (*OperationStatus) UnmarshalJSON added in v1.0.0

func (o *OperationStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus.

type OperationStatusesClient added in v1.0.0

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

OperationStatusesClient contains the methods for the OperationStatuses group. Don't use this type directly, use NewOperationStatusesClient() instead.

func NewOperationStatusesClient added in v1.0.0

func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error)

NewOperationStatusesClient creates a new instance of OperationStatusesClient with the specified values.

  • subscriptionID - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*OperationStatusesClient) Get added in v1.0.0

Get - Get the status of a long running azure asynchronous operation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • location - The name of the Azure region.
  • asyncOperationID - The operation Id.
  • options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewOperationStatusesClient().Get(ctx, "West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", 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.OperationStatus = armchaos.OperationStatus{
	// 	Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"),
	// 	EndTime: to.Ptr("2017-01-01T16:13:13.933Z"),
	// 	ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/locations/westus/operationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"),
	// 	StartTime: to.Ptr("2017-01-01T13:13:13.933Z"),
	// 	Status: to.Ptr("Succeeded"),
	// }
}
Output:

type OperationStatusesClientGetOptions added in v1.0.0

type OperationStatusesClientGetOptions struct {
}

OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method.

type OperationStatusesClientGetResponse added in v1.0.0

type OperationStatusesClientGetResponse struct {
	// The status of operation.
	OperationStatus
}

OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get.

type OperationsClient

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

OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.

func NewOperationsClient

func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

NewOperationsClient creates a new instance of OperationsClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*OperationsClient) NewListAllPager added in v0.4.0

NewListAllPager - Get a list all available Operations.

Generated from API version 2024-01-01

  • options - OperationsClientListAllOptions contains the optional parameters for the OperationsClient.NewListAllPager method.

type OperationsClientListAllOptions added in v0.2.0

type OperationsClientListAllOptions struct {
}

OperationsClientListAllOptions contains the optional parameters for the OperationsClient.NewListAllPager method.

type OperationsClientListAllResponse added in v0.2.0

type OperationsClientListAllResponse struct {
	// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
	OperationListResult
}

OperationsClientListAllResponse contains the response from method OperationsClient.NewListAllPager.

type Origin

type Origin string

Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"

const (
	OriginSystem     Origin = "system"
	OriginUser       Origin = "user"
	OriginUserSystem Origin = "user,system"
)

func PossibleOriginValues

func PossibleOriginValues() []Origin

PossibleOriginValues returns the possible values for the Origin const type.

type ProvisioningState added in v1.0.0

type ProvisioningState string

ProvisioningState - Current provisioning state for a given Azure Chaos resource.

const (
	ProvisioningStateCanceled  ProvisioningState = "Canceled"
	ProvisioningStateCreating  ProvisioningState = "Creating"
	ProvisioningStateDeleting  ProvisioningState = "Deleting"
	ProvisioningStateFailed    ProvisioningState = "Failed"
	ProvisioningStateSucceeded ProvisioningState = "Succeeded"
	ProvisioningStateUpdating  ProvisioningState = "Updating"
)

func PossibleProvisioningStateValues added in v1.0.0

func PossibleProvisioningStateValues() []ProvisioningState

PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.

type Resource

type Resource struct {
	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Resource - Common fields that are returned in the response for all Azure Resource Manager resources

func (Resource) MarshalJSON

func (r Resource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v0.6.0

func (r *Resource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type ResourceIdentity

type ResourceIdentity struct {
	// REQUIRED; String of the resource identity type.
	Type *ResourceIdentityType

	// The list of user identities associated with the Experiment. The user identity dictionary key references will be ARM resource
	// ids in the form:
	// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
	UserAssignedIdentities map[string]*UserAssignedIdentity

	// READ-ONLY; GUID that represents the principal ID of this resource identity.
	PrincipalID *string

	// READ-ONLY; GUID that represents the tenant ID of this resource identity.
	TenantID *string
}

ResourceIdentity - The identity of a resource.

func (ResourceIdentity) MarshalJSON added in v0.6.0

func (r ResourceIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceIdentity.

func (*ResourceIdentity) UnmarshalJSON added in v0.6.0

func (r *ResourceIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity.

type ResourceIdentityType

type ResourceIdentityType string

ResourceIdentityType - String of the resource identity type.

const (
	ResourceIdentityTypeNone           ResourceIdentityType = "None"
	ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned"
	ResourceIdentityTypeUserAssigned   ResourceIdentityType = "UserAssigned"
)

func PossibleResourceIdentityTypeValues

func PossibleResourceIdentityTypeValues() []ResourceIdentityType

PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type.

type SelectorType

type SelectorType string

SelectorType - Enum of the selector type.

const (
	SelectorTypeList  SelectorType = "List"
	SelectorTypeQuery SelectorType = "Query"
)

func PossibleSelectorTypeValues

func PossibleSelectorTypeValues() []SelectorType

PossibleSelectorTypeValues returns the possible values for the SelectorType const type.

type StepStatus

type StepStatus struct {
	// READ-ONLY; The array of branches.
	Branches []*BranchStatus

	// READ-ONLY; The value of the status of the step.
	Status *string

	// READ-ONLY; The id of the step.
	StepID *string

	// READ-ONLY; The name of the step.
	StepName *string
}

StepStatus - Model that represents the a list of branches and branch statuses.

func (StepStatus) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type StepStatus.

func (*StepStatus) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type StepStatus.

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 Target

type Target struct {
	// REQUIRED; The properties of the target resource.
	Properties map[string]any

	// Location of the target resource.
	Location *string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The system metadata of the target resource.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Target - Model that represents a Target resource.

func (Target) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Target.

func (*Target) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Target.

type TargetFilter added in v1.0.0

type TargetFilter struct {
	// REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported.
	Type *FilterType
}

TargetFilter - Model that represents available filter types that can be applied to a targets list.

func (*TargetFilter) GetTargetFilter added in v1.0.0

func (t *TargetFilter) GetTargetFilter() *TargetFilter

GetTargetFilter implements the TargetFilterClassification interface for type TargetFilter.

func (TargetFilter) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type TargetFilter.

func (*TargetFilter) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetFilter.

type TargetFilterClassification added in v1.0.0

type TargetFilterClassification interface {
	// GetTargetFilter returns the TargetFilter content of the underlying type.
	GetTargetFilter() *TargetFilter
}

TargetFilterClassification provides polymorphic access to related types. Call the interface's GetTargetFilter() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *TargetFilter, *TargetSimpleFilter

type TargetListResult

type TargetListResult struct {
	// READ-ONLY; URL to retrieve the next page of Target resources.
	NextLink *string

	// READ-ONLY; List of Target resources.
	Value []*Target
}

TargetListResult - Model that represents a list of Target resources and a link for pagination.

func (TargetListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type TargetListResult.

func (*TargetListResult) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetListResult.

type TargetListSelector added in v1.0.0

type TargetListSelector struct {
	// REQUIRED; String of the selector ID.
	ID *string

	// REQUIRED; List of Target references.
	Targets []*TargetReference

	// REQUIRED; Enum of the selector type.
	Type *SelectorType

	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]any

	// Model that represents available filter types that can be applied to a targets list.
	Filter TargetFilterClassification
}

TargetListSelector - Model that represents a list selector.

func (*TargetListSelector) GetTargetSelector added in v1.0.0

func (t *TargetListSelector) GetTargetSelector() *TargetSelector

GetTargetSelector implements the TargetSelectorClassification interface for type TargetListSelector.

func (TargetListSelector) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type TargetListSelector.

func (*TargetListSelector) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetListSelector.

type TargetQuerySelector added in v1.0.0

type TargetQuerySelector struct {
	// REQUIRED; String of the selector ID.
	ID *string

	// REQUIRED; Azure Resource Graph (ARG) Query Language query for target resources.
	QueryString *string

	// REQUIRED; Subscription id list to scope resource query.
	SubscriptionIDs []*string

	// REQUIRED; Enum of the selector type.
	Type *SelectorType

	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]any

	// Model that represents available filter types that can be applied to a targets list.
	Filter TargetFilterClassification
}

TargetQuerySelector - Model that represents a query selector.

func (*TargetQuerySelector) GetTargetSelector added in v1.0.0

func (t *TargetQuerySelector) GetTargetSelector() *TargetSelector

GetTargetSelector implements the TargetSelectorClassification interface for type TargetQuerySelector.

func (TargetQuerySelector) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type TargetQuerySelector.

func (*TargetQuerySelector) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetQuerySelector.

type TargetReference

type TargetReference struct {
	// REQUIRED; String of the resource ID of a Target resource.
	ID *string

	// REQUIRED; Enum of the Target reference type.
	Type *TargetReferenceType
}

TargetReference - Model that represents a reference to a Target in the selector.

func (TargetReference) MarshalJSON added in v0.6.0

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

MarshalJSON implements the json.Marshaller interface for type TargetReference.

func (*TargetReference) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetReference.

type TargetReferenceType added in v0.7.0

type TargetReferenceType string

TargetReferenceType - Enum of the Target reference type.

const (
	TargetReferenceTypeChaosTarget TargetReferenceType = "ChaosTarget"
)

func PossibleTargetReferenceTypeValues added in v0.7.0

func PossibleTargetReferenceTypeValues() []TargetReferenceType

PossibleTargetReferenceTypeValues returns the possible values for the TargetReferenceType const type.

type TargetSelector added in v1.0.0

type TargetSelector struct {
	// REQUIRED; String of the selector ID.
	ID *string

	// REQUIRED; Enum of the selector type.
	Type *SelectorType

	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]any

	// Model that represents available filter types that can be applied to a targets list.
	Filter TargetFilterClassification
}

TargetSelector - Model that represents a selector in the Experiment resource.

func (*TargetSelector) GetTargetSelector added in v1.0.0

func (t *TargetSelector) GetTargetSelector() *TargetSelector

GetTargetSelector implements the TargetSelectorClassification interface for type TargetSelector.

func (TargetSelector) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type TargetSelector.

func (*TargetSelector) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetSelector.

type TargetSelectorClassification added in v1.0.0

type TargetSelectorClassification interface {
	// GetTargetSelector returns the TargetSelector content of the underlying type.
	GetTargetSelector() *TargetSelector
}

TargetSelectorClassification provides polymorphic access to related types. Call the interface's GetTargetSelector() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *TargetListSelector, *TargetQuerySelector, *TargetSelector

type TargetSimpleFilter added in v1.0.0

type TargetSimpleFilter struct {
	// REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported.
	Type *FilterType

	// Model that represents the Simple filter parameters.
	Parameters *TargetSimpleFilterParameters
}

TargetSimpleFilter - Model that represents a simple target filter.

func (*TargetSimpleFilter) GetTargetFilter added in v1.0.0

func (t *TargetSimpleFilter) GetTargetFilter() *TargetFilter

GetTargetFilter implements the TargetFilterClassification interface for type TargetSimpleFilter.

func (TargetSimpleFilter) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type TargetSimpleFilter.

func (*TargetSimpleFilter) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetSimpleFilter.

type TargetSimpleFilterParameters added in v1.0.0

type TargetSimpleFilterParameters struct {
	// List of Azure availability zones to filter targets by.
	Zones []*string
}

TargetSimpleFilterParameters - Model that represents the Simple filter parameters.

func (TargetSimpleFilterParameters) MarshalJSON added in v1.0.0

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

MarshalJSON implements the json.Marshaller interface for type TargetSimpleFilterParameters.

func (*TargetSimpleFilterParameters) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetSimpleFilterParameters.

type TargetType

type TargetType struct {
	// REQUIRED; The properties of the target type resource.
	Properties *TargetTypeProperties

	// Location of the Target Type resource.
	Location *string

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The system metadata properties of the target type resource.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

TargetType - Model that represents a Target Type resource.

func (TargetType) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type TargetType.

func (*TargetType) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetType.

type TargetTypeListResult

type TargetTypeListResult struct {
	// READ-ONLY; URL to retrieve the next page of Target Type resources.
	NextLink *string

	// READ-ONLY; List of Target Type resources.
	Value []*TargetType
}

TargetTypeListResult - Model that represents a list of Target Type resources and a link for pagination.

func (TargetTypeListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type TargetTypeListResult.

func (*TargetTypeListResult) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetTypeListResult.

type TargetTypeProperties

type TargetTypeProperties struct {
	// READ-ONLY; Localized string of the description.
	Description *string

	// READ-ONLY; Localized string of the display name.
	DisplayName *string

	// READ-ONLY; URL to retrieve JSON schema of the Target Type properties.
	PropertiesSchema *string

	// READ-ONLY; List of resource types this Target Type can extend.
	ResourceTypes []*string
}

TargetTypeProperties - Model that represents the base Target Type properties model.

func (TargetTypeProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type TargetTypeProperties.

func (*TargetTypeProperties) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TargetTypeProperties.

type TargetTypesClient

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

TargetTypesClient contains the methods for the TargetTypes group. Don't use this type directly, use NewTargetTypesClient() instead.

func NewTargetTypesClient

func NewTargetTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetTypesClient, error)

NewTargetTypesClient creates a new instance of TargetTypesClient with the specified values.

  • subscriptionID - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*TargetTypesClient) Get

func (client *TargetTypesClient) Get(ctx context.Context, locationName string, targetTypeName string, options *TargetTypesClientGetOptions) (TargetTypesClientGetResponse, error)

Get - Get a Target Type resources for given location. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • locationName - String that represents a Location resource name.
  • targetTypeName - String that represents a Target Type resource name.
  • options - TargetTypesClientGetOptions contains the optional parameters for the TargetTypesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTargetTypesClient().Get(ctx, "westus2", "Microsoft-Agent", 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.TargetType = armchaos.TargetType{
	// 	Name: to.Ptr("Microsoft-Agent"),
	// 	Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"),
	// 	Location: to.Ptr("centraluseuap"),
	// 	Properties: &armchaos.TargetTypeProperties{
	// 		Description: to.Ptr("A target represents Chaos Agent."),
	// 		DisplayName: to.Ptr("Chaos Agent"),
	// 		PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"),
	// 		ResourceTypes: []*string{
	// 			to.Ptr("Microsoft.Compute/virtualMachines"),
	// 			to.Ptr("Microsoft.Compute/virtualMachineScaleSets")},
	// 		},
	// 	}
}
Output:

func (*TargetTypesClient) NewListPager added in v0.4.0

NewListPager - Get a list of Target Type resources for given location.

Generated from API version 2024-01-01

  • locationName - String that represents a Location resource name.
  • options - TargetTypesClientListOptions contains the optional parameters for the TargetTypesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTargetTypesClient().NewListPager("westus2", &armchaos.TargetTypesClientListOptions{ContinuationToken: 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.TargetTypeListResult = armchaos.TargetTypeListResult{
		// 	Value: []*armchaos.TargetType{
		// 		{
		// 			Name: to.Ptr("Microsoft-Agent"),
		// 			Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"),
		// 			Location: to.Ptr("centraluseuap"),
		// 			Properties: &armchaos.TargetTypeProperties{
		// 				Description: to.Ptr("A target represents Chaos Agent."),
		// 				DisplayName: to.Ptr("Chaos Agent"),
		// 				PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"),
		// 				ResourceTypes: []*string{
		// 					to.Ptr("Microsoft.Compute/virtualMachines"),
		// 					to.Ptr("Microsoft.Compute/virtualMachineScaleSets")},
		// 				},
		// 		}},
		// 	}
	}
}
Output:

type TargetTypesClientGetOptions added in v0.2.0

type TargetTypesClientGetOptions struct {
}

TargetTypesClientGetOptions contains the optional parameters for the TargetTypesClient.Get method.

type TargetTypesClientGetResponse added in v0.2.0

type TargetTypesClientGetResponse struct {
	// Model that represents a Target Type resource.
	TargetType
}

TargetTypesClientGetResponse contains the response from method TargetTypesClient.Get.

type TargetTypesClientListOptions added in v0.2.0

type TargetTypesClientListOptions struct {
	// String that sets the continuation token.
	ContinuationToken *string
}

TargetTypesClientListOptions contains the optional parameters for the TargetTypesClient.NewListPager method.

type TargetTypesClientListResponse added in v0.2.0

type TargetTypesClientListResponse struct {
	// Model that represents a list of Target Type resources and a link for pagination.
	TargetTypeListResult
}

TargetTypesClientListResponse contains the response from method TargetTypesClient.NewListPager.

type TargetsClient

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

TargetsClient contains the methods for the Targets group. Don't use this type directly, use NewTargetsClient() instead.

func NewTargetsClient

func NewTargetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetsClient, error)

NewTargetsClient creates a new instance of TargetsClient with the specified values.

  • subscriptionID - GUID that represents an Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*TargetsClient) CreateOrUpdate

func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target Target, options *TargetsClientCreateOrUpdateOptions) (TargetsClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create or update a Target resource that extends a tracked regional resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • target - Target resource to be created or updated.
  • options - TargetsClientCreateOrUpdateOptions contains the optional parameters for the TargetsClient.CreateOrUpdate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateTarget.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTargetsClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", armchaos.Target{
		Properties: map[string]any{
			"identities": []any{
				map[string]any{
					"type":    "CertificateSubjectIssuer",
					"subject": "CN=example.subject",
				},
			},
		},
	}, 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.Target = armchaos.Target{
	// 	Name: to.Ptr("Microsoft-Agent"),
	// 	Type: to.Ptr("Microsoft.Chaos/targets"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"),
	// 	Location: to.Ptr("centraluseuap"),
	// 	Properties: map[string]any{
	// 		"agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf",
	// 		"identities": []any{
	// 			map[string]any{
	// 				"type": "CertificateSubjectIssuer",
	// 				"subject": "CN=example.subject",
	// 			},
	// 		},
	// 	},
	// 	SystemData: &armchaos.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 	},
	// }
}
Output:

func (*TargetsClient) Delete

func (client *TargetsClient) Delete(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientDeleteOptions) (TargetsClientDeleteResponse, error)

Delete - Delete a Target resource that extends a tracked regional resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • options - TargetsClientDeleteOptions contains the optional parameters for the TargetsClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewTargetsClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*TargetsClient) Get

func (client *TargetsClient) Get(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientGetOptions) (TargetsClientGetResponse, error)

Get - Get a Target resource that extends a tracked regional resource. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • targetName - String that represents a Target resource name.
  • options - TargetsClientGetOptions contains the optional parameters for the TargetsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTargetsClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", 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.Target = armchaos.Target{
	// 	Name: to.Ptr("Microsoft-Agent"),
	// 	Type: to.Ptr("Microsoft.Chaos/targets"),
	// 	ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"),
	// 	Location: to.Ptr("centraluseuap"),
	// 	Properties: map[string]any{
	// 		"agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf",
	// 		"identities": []any{
	// 			map[string]any{
	// 				"type": "CertificateSubjectIssuer",
	// 				"subject": "CN=example.subject",
	// 			},
	// 		},
	// 	},
	// 	SystemData: &armchaos.SystemData{
	// 		CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 		LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
	// 	},
	// }
}
Output:

func (*TargetsClient) NewListPager added in v0.4.0

func (client *TargetsClient) NewListPager(resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, options *TargetsClientListOptions) *runtime.Pager[TargetsClientListResponse]

NewListPager - Get a list of Target resources that extend a tracked regional resource.

Generated from API version 2024-01-01

  • resourceGroupName - String that represents an Azure resource group.
  • parentProviderNamespace - String that represents a resource provider namespace.
  • parentResourceType - String that represents a resource type.
  • parentResourceName - String that represents a resource name.
  • options - TargetsClientListOptions contains the optional parameters for the TargetsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargets.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTargetsClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", &armchaos.TargetsClientListOptions{ContinuationToken: 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.TargetListResult = armchaos.TargetListResult{
		// 	Value: []*armchaos.Target{
		// 		{
		// 			Name: to.Ptr("Microsoft-Agent"),
		// 			Type: to.Ptr("Microsoft.Chaos/targets"),
		// 			ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"),
		// 			Location: to.Ptr("centraluseuap"),
		// 			Properties: map[string]any{
		// 				"agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf",
		// 				"identities": []any{
		// 					map[string]any{
		// 						"type": "CertificateSubjectIssuer",
		// 						"subject": "CN=example.subject",
		// 					},
		// 				},
		// 			},
		// 			SystemData: &armchaos.SystemData{
		// 				CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
		// 				LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()),
		// 			},
		// 	}},
		// }
	}
}
Output:

type TargetsClientCreateOrUpdateOptions added in v0.2.0

type TargetsClientCreateOrUpdateOptions struct {
}

TargetsClientCreateOrUpdateOptions contains the optional parameters for the TargetsClient.CreateOrUpdate method.

type TargetsClientCreateOrUpdateResponse added in v0.2.0

type TargetsClientCreateOrUpdateResponse struct {
	// Model that represents a Target resource.
	Target
}

TargetsClientCreateOrUpdateResponse contains the response from method TargetsClient.CreateOrUpdate.

type TargetsClientDeleteOptions added in v0.2.0

type TargetsClientDeleteOptions struct {
}

TargetsClientDeleteOptions contains the optional parameters for the TargetsClient.Delete method.

type TargetsClientDeleteResponse added in v0.2.0

type TargetsClientDeleteResponse struct {
}

TargetsClientDeleteResponse contains the response from method TargetsClient.Delete.

type TargetsClientGetOptions added in v0.2.0

type TargetsClientGetOptions struct {
}

TargetsClientGetOptions contains the optional parameters for the TargetsClient.Get method.

type TargetsClientGetResponse added in v0.2.0

type TargetsClientGetResponse struct {
	// Model that represents a Target resource.
	Target
}

TargetsClientGetResponse contains the response from method TargetsClient.Get.

type TargetsClientListOptions added in v0.2.0

type TargetsClientListOptions struct {
	// String that sets the continuation token.
	ContinuationToken *string
}

TargetsClientListOptions contains the optional parameters for the TargetsClient.NewListPager method.

type TargetsClientListResponse added in v0.2.0

type TargetsClientListResponse struct {
	// Model that represents a list of Target resources and a link for pagination.
	TargetListResult
}

TargetsClientListResponse contains the response from method TargetsClient.NewListPager.

type TrackedResource

type TrackedResource struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'

func (TrackedResource) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type TrackedResource.

func (*TrackedResource) UnmarshalJSON added in v0.6.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource.

type UserAssignedIdentity added in v0.7.0

type UserAssignedIdentity struct {
	// READ-ONLY; The client ID of the assigned identity.
	ClientID *string

	// READ-ONLY; The principal ID of the assigned identity.
	PrincipalID *string
}

UserAssignedIdentity - User assigned identity properties

func (UserAssignedIdentity) MarshalJSON added in v0.7.0

func (u UserAssignedIdentity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity.

func (*UserAssignedIdentity) UnmarshalJSON added in v0.7.0

func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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