experiments

package
v0.20250211.1133646 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MPL-2.0 Imports: 16 Imported by: 0

README

github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2025-01-01/experiments Documentation

The experiments SDK allows for interaction with Azure Resource Manager chaosstudio (API Version 2025-01-01).

This readme covers example usages, but further information on using this SDK can be found in the project root.

Import Path

import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2025-01-01/experiments"

Client Initialization

client := experiments.NewExperimentsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: ExperimentsClient.Cancel

ctx := context.TODO()
id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentName")

if err := client.CancelThenPoll(ctx, id); err != nil {
	// handle the error
}

Example Usage: ExperimentsClient.CreateOrUpdate

ctx := context.TODO()
id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentName")

payload := experiments.Experiment{
	// ...
}


if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: ExperimentsClient.Delete

ctx := context.TODO()
id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentName")

if err := client.DeleteThenPoll(ctx, id); err != nil {
	// handle the error
}

Example Usage: ExperimentsClient.Get

ctx := context.TODO()
id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentName")

read, err := client.Get(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: ExperimentsClient.List

ctx := context.TODO()
id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group")

// alternatively `client.List(ctx, id, experiments.DefaultListOperationOptions())` can be used to do batched pagination
items, err := client.ListComplete(ctx, id, experiments.DefaultListOperationOptions())
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: ExperimentsClient.ListAll

ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")

// alternatively `client.ListAll(ctx, id, experiments.DefaultListAllOperationOptions())` can be used to do batched pagination
items, err := client.ListAllComplete(ctx, id, experiments.DefaultListAllOperationOptions())
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: ExperimentsClient.Start

ctx := context.TODO()
id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentName")

if err := client.StartThenPoll(ctx, id); err != nil {
	// handle the error
}

Example Usage: ExperimentsClient.Update

ctx := context.TODO()
id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentName")

payload := experiments.ExperimentUpdate{
	// ...
}


if err := client.UpdateThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PossibleValuesForExperimentActionType

func PossibleValuesForExperimentActionType() []string

func PossibleValuesForFilterType

func PossibleValuesForFilterType() []string

func PossibleValuesForProvisioningState

func PossibleValuesForProvisioningState() []string

func PossibleValuesForSelectorType

func PossibleValuesForSelectorType() []string

func PossibleValuesForTargetReferenceType

func PossibleValuesForTargetReferenceType() []string

func ValidateExperimentID

func ValidateExperimentID(input interface{}, key string) (warnings []string, errors []error)

ValidateExperimentID checks that 'input' can be parsed as a Experiment ID

Types

type BaseChaosExperimentActionImpl

type BaseChaosExperimentActionImpl struct {
	Name string               `json:"name"`
	Type ExperimentActionType `json:"type"`
}

func (BaseChaosExperimentActionImpl) ChaosExperimentAction

type BaseChaosTargetFilterImpl

type BaseChaosTargetFilterImpl struct {
	Type FilterType `json:"type"`
}

func (BaseChaosTargetFilterImpl) ChaosTargetFilter

type BaseChaosTargetSelectorImpl

type BaseChaosTargetSelectorImpl struct {
	Filter ChaosTargetFilter `json:"filter"`
	Id     string            `json:"id"`
	Type   SelectorType      `json:"type"`
}

func (BaseChaosTargetSelectorImpl) ChaosTargetSelector

func (*BaseChaosTargetSelectorImpl) UnmarshalJSON

func (s *BaseChaosTargetSelectorImpl) UnmarshalJSON(bytes []byte) error

type CancelOperationResponse

type CancelOperationResponse struct {
	Poller       pollers.Poller
	HttpResponse *http.Response
	OData        *odata.OData
}

type ChaosExperimentAction

type ChaosExperimentAction interface {
	ChaosExperimentAction() BaseChaosExperimentActionImpl
}

func UnmarshalChaosExperimentActionImplementation

func UnmarshalChaosExperimentActionImplementation(input []byte) (ChaosExperimentAction, error)

type ChaosExperimentBranch

type ChaosExperimentBranch struct {
	Actions []ChaosExperimentAction `json:"actions"`
	Name    string                  `json:"name"`
}

func (*ChaosExperimentBranch) UnmarshalJSON

func (s *ChaosExperimentBranch) UnmarshalJSON(bytes []byte) error

type ChaosExperimentStep

type ChaosExperimentStep struct {
	Branches []ChaosExperimentBranch `json:"branches"`
	Name     string                  `json:"name"`
}

type ChaosTargetFilter

type ChaosTargetFilter interface {
	ChaosTargetFilter() BaseChaosTargetFilterImpl
}

func UnmarshalChaosTargetFilterImplementation

func UnmarshalChaosTargetFilterImplementation(input []byte) (ChaosTargetFilter, error)

type ChaosTargetListSelector

type ChaosTargetListSelector struct {
	Targets []TargetReference `json:"targets"`

	Filter ChaosTargetFilter `json:"filter"`
	Id     string            `json:"id"`
	Type   SelectorType      `json:"type"`
}

func (ChaosTargetListSelector) ChaosTargetSelector

func (s ChaosTargetListSelector) ChaosTargetSelector() BaseChaosTargetSelectorImpl

func (ChaosTargetListSelector) MarshalJSON

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

func (*ChaosTargetListSelector) UnmarshalJSON

func (s *ChaosTargetListSelector) UnmarshalJSON(bytes []byte) error

type ChaosTargetQuerySelector

type ChaosTargetQuerySelector struct {
	QueryString     string   `json:"queryString"`
	SubscriptionIds []string `json:"subscriptionIds"`

	Filter ChaosTargetFilter `json:"filter"`
	Id     string            `json:"id"`
	Type   SelectorType      `json:"type"`
}

func (ChaosTargetQuerySelector) ChaosTargetSelector

func (s ChaosTargetQuerySelector) ChaosTargetSelector() BaseChaosTargetSelectorImpl

func (ChaosTargetQuerySelector) MarshalJSON

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

func (*ChaosTargetQuerySelector) UnmarshalJSON

func (s *ChaosTargetQuerySelector) UnmarshalJSON(bytes []byte) error

type ChaosTargetSelector

type ChaosTargetSelector interface {
	ChaosTargetSelector() BaseChaosTargetSelectorImpl
}

func UnmarshalChaosTargetSelectorImplementation

func UnmarshalChaosTargetSelectorImplementation(input []byte) (ChaosTargetSelector, error)

type ChaosTargetSimpleFilter

type ChaosTargetSimpleFilter struct {
	Parameters *ChaosTargetSimpleFilterParameters `json:"parameters,omitempty"`

	Type FilterType `json:"type"`
}

func (ChaosTargetSimpleFilter) ChaosTargetFilter

func (s ChaosTargetSimpleFilter) ChaosTargetFilter() BaseChaosTargetFilterImpl

func (ChaosTargetSimpleFilter) MarshalJSON

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

type ChaosTargetSimpleFilterParameters

type ChaosTargetSimpleFilterParameters struct {
	Zones *zones.Schema `json:"zones,omitempty"`
}

type ContinuousAction

type ContinuousAction struct {
	Duration   string         `json:"duration"`
	Parameters []KeyValuePair `json:"parameters"`
	SelectorId string         `json:"selectorId"`

	Name string               `json:"name"`
	Type ExperimentActionType `json:"type"`
}

func (ContinuousAction) ChaosExperimentAction

func (s ContinuousAction) ChaosExperimentAction() BaseChaosExperimentActionImpl

func (ContinuousAction) MarshalJSON

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

type CreateOrUpdateOperationResponse

type CreateOrUpdateOperationResponse struct {
	Poller       pollers.Poller
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *Experiment
}

type DelayAction

type DelayAction struct {
	Duration string `json:"duration"`

	Name string               `json:"name"`
	Type ExperimentActionType `json:"type"`
}

func (DelayAction) ChaosExperimentAction

func (s DelayAction) ChaosExperimentAction() BaseChaosExperimentActionImpl

func (DelayAction) MarshalJSON

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

type DeleteOperationResponse

type DeleteOperationResponse struct {
	Poller       pollers.Poller
	HttpResponse *http.Response
	OData        *odata.OData
}

type DiscreteAction

type DiscreteAction struct {
	Parameters []KeyValuePair `json:"parameters"`
	SelectorId string         `json:"selectorId"`

	Name string               `json:"name"`
	Type ExperimentActionType `json:"type"`
}

func (DiscreteAction) ChaosExperimentAction

func (s DiscreteAction) ChaosExperimentAction() BaseChaosExperimentActionImpl

func (DiscreteAction) MarshalJSON

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

type Experiment

type Experiment struct {
	Id         *string                                  `json:"id,omitempty"`
	Identity   *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"`
	Location   string                                   `json:"location"`
	Name       *string                                  `json:"name,omitempty"`
	Properties ExperimentProperties                     `json:"properties"`
	SystemData *systemdata.SystemData                   `json:"systemData,omitempty"`
	Tags       *map[string]string                       `json:"tags,omitempty"`
	Type       *string                                  `json:"type,omitempty"`
}

type ExperimentActionType

type ExperimentActionType string
const (
	ExperimentActionTypeContinuous ExperimentActionType = "continuous"
	ExperimentActionTypeDelay      ExperimentActionType = "delay"
	ExperimentActionTypeDiscrete   ExperimentActionType = "discrete"
)

func (*ExperimentActionType) UnmarshalJSON

func (s *ExperimentActionType) UnmarshalJSON(bytes []byte) error

type ExperimentId

type ExperimentId struct {
	SubscriptionId    string
	ResourceGroupName string
	ExperimentName    string
}

ExperimentId is a struct representing the Resource ID for a Experiment

func NewExperimentID

func NewExperimentID(subscriptionId string, resourceGroupName string, experimentName string) ExperimentId

NewExperimentID returns a new ExperimentId struct

func ParseExperimentID

func ParseExperimentID(input string) (*ExperimentId, error)

ParseExperimentID parses 'input' into a ExperimentId

func ParseExperimentIDInsensitively

func ParseExperimentIDInsensitively(input string) (*ExperimentId, error)

ParseExperimentIDInsensitively parses 'input' case-insensitively into a ExperimentId note: this method should only be used for API response data and not user input

func (*ExperimentId) FromParseResult

func (id *ExperimentId) FromParseResult(input resourceids.ParseResult) error

func (ExperimentId) ID

func (id ExperimentId) ID() string

ID returns the formatted Experiment ID

func (ExperimentId) Segments

func (id ExperimentId) Segments() []resourceids.Segment

Segments returns a slice of Resource ID Segments which comprise this Experiment ID

func (ExperimentId) String

func (id ExperimentId) String() string

String returns a human-readable description of this Experiment ID

type ExperimentOperationPredicate

type ExperimentOperationPredicate struct {
	Id       *string
	Location *string
	Name     *string
	Type     *string
}

func (ExperimentOperationPredicate) Matches

func (p ExperimentOperationPredicate) Matches(input Experiment) bool

type ExperimentProperties

type ExperimentProperties struct {
	ProvisioningState *ProvisioningState    `json:"provisioningState,omitempty"`
	Selectors         []ChaosTargetSelector `json:"selectors"`
	Steps             []ChaosExperimentStep `json:"steps"`
}

func (*ExperimentProperties) UnmarshalJSON

func (s *ExperimentProperties) UnmarshalJSON(bytes []byte) error

type ExperimentUpdate

type ExperimentUpdate struct {
	Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"`
	Tags     *map[string]string                       `json:"tags,omitempty"`
}

type ExperimentsClient

type ExperimentsClient struct {
	Client *resourcemanager.Client
}

func NewExperimentsClientWithBaseURI

func NewExperimentsClientWithBaseURI(sdkApi sdkEnv.Api) (*ExperimentsClient, error)

func (ExperimentsClient) Cancel

Cancel ...

func (ExperimentsClient) CancelThenPoll

func (c ExperimentsClient) CancelThenPoll(ctx context.Context, id ExperimentId) error

CancelThenPoll performs Cancel then polls until it's completed

func (ExperimentsClient) CreateOrUpdate

func (c ExperimentsClient) CreateOrUpdate(ctx context.Context, id ExperimentId, input Experiment) (result CreateOrUpdateOperationResponse, err error)

CreateOrUpdate ...

func (ExperimentsClient) CreateOrUpdateThenPoll

func (c ExperimentsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExperimentId, input Experiment) error

CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed

func (ExperimentsClient) Delete

Delete ...

func (ExperimentsClient) DeleteThenPoll

func (c ExperimentsClient) DeleteThenPoll(ctx context.Context, id ExperimentId) error

DeleteThenPoll performs Delete then polls until it's completed

func (ExperimentsClient) Get

Get ...

func (ExperimentsClient) List

List ...

func (ExperimentsClient) ListAll

ListAll ...

func (ExperimentsClient) ListAllComplete

ListAllComplete retrieves all the results into a single object

func (ExperimentsClient) ListAllCompleteMatchingPredicate

func (c ExperimentsClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions, predicate ExperimentOperationPredicate) (result ListAllCompleteResult, err error)

ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (ExperimentsClient) ListComplete

ListComplete retrieves all the results into a single object

func (ExperimentsClient) ListCompleteMatchingPredicate

func (c ExperimentsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions, predicate ExperimentOperationPredicate) (result ListCompleteResult, err error)

ListCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (ExperimentsClient) Start

Start ...

func (ExperimentsClient) StartThenPoll

func (c ExperimentsClient) StartThenPoll(ctx context.Context, id ExperimentId) error

StartThenPoll performs Start then polls until it's completed

func (ExperimentsClient) Update

Update ...

func (ExperimentsClient) UpdateThenPoll

func (c ExperimentsClient) UpdateThenPoll(ctx context.Context, id ExperimentId, input ExperimentUpdate) error

UpdateThenPoll performs Update then polls until it's completed

type FilterType

type FilterType string
const (
	FilterTypeSimple FilterType = "Simple"
)

func (*FilterType) UnmarshalJSON

func (s *FilterType) UnmarshalJSON(bytes []byte) error

type GetOperationResponse

type GetOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *Experiment
}

type KeyValuePair

type KeyValuePair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type ListAllCompleteResult

type ListAllCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []Experiment
}

type ListAllCustomPager

type ListAllCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListAllCustomPager) NextPageLink() *odata.Link

type ListAllOperationOptions

type ListAllOperationOptions struct {
	ContinuationToken *string
	Running           *bool
}

func DefaultListAllOperationOptions

func DefaultListAllOperationOptions() ListAllOperationOptions

func (ListAllOperationOptions) ToHeaders

func (o ListAllOperationOptions) ToHeaders() *client.Headers

func (ListAllOperationOptions) ToOData

func (o ListAllOperationOptions) ToOData() *odata.Query

func (ListAllOperationOptions) ToQuery

type ListAllOperationResponse

type ListAllOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]Experiment
}

type ListCompleteResult

type ListCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []Experiment
}

type ListCustomPager

type ListCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListCustomPager) NextPageLink() *odata.Link

type ListOperationOptions

type ListOperationOptions struct {
	ContinuationToken *string
	Running           *bool
}

func DefaultListOperationOptions

func DefaultListOperationOptions() ListOperationOptions

func (ListOperationOptions) ToHeaders

func (o ListOperationOptions) ToHeaders() *client.Headers

func (ListOperationOptions) ToOData

func (o ListOperationOptions) ToOData() *odata.Query

func (ListOperationOptions) ToQuery

type ListOperationResponse

type ListOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]Experiment
}

type ProvisioningState

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

func (*ProvisioningState) UnmarshalJSON

func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error

type RawChaosExperimentActionImpl

type RawChaosExperimentActionImpl struct {
	Type   string
	Values map[string]interface{}
	// contains filtered or unexported fields
}

RawChaosExperimentActionImpl is returned when the Discriminated Value doesn't match any of the defined types NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) and is used only for Deserialization (e.g. this cannot be used as a Request Payload).

func (RawChaosExperimentActionImpl) ChaosExperimentAction

type RawChaosTargetFilterImpl

type RawChaosTargetFilterImpl struct {
	Type   string
	Values map[string]interface{}
	// contains filtered or unexported fields
}

RawChaosTargetFilterImpl is returned when the Discriminated Value doesn't match any of the defined types NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) and is used only for Deserialization (e.g. this cannot be used as a Request Payload).

func (RawChaosTargetFilterImpl) ChaosTargetFilter

type RawChaosTargetSelectorImpl

type RawChaosTargetSelectorImpl struct {
	Type   string
	Values map[string]interface{}
	// contains filtered or unexported fields
}

RawChaosTargetSelectorImpl is returned when the Discriminated Value doesn't match any of the defined types NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) and is used only for Deserialization (e.g. this cannot be used as a Request Payload).

func (RawChaosTargetSelectorImpl) ChaosTargetSelector

type SelectorType

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

func (*SelectorType) UnmarshalJSON

func (s *SelectorType) UnmarshalJSON(bytes []byte) error

type StartOperationResponse

type StartOperationResponse struct {
	Poller       pollers.Poller
	HttpResponse *http.Response
	OData        *odata.OData
}

type TargetReference

type TargetReference struct {
	Id   string              `json:"id"`
	Type TargetReferenceType `json:"type"`
}

type TargetReferenceType

type TargetReferenceType string
const (
	TargetReferenceTypeChaosTarget TargetReferenceType = "ChaosTarget"
)

func (*TargetReferenceType) UnmarshalJSON

func (s *TargetReferenceType) UnmarshalJSON(bytes []byte) error

type UpdateOperationResponse

type UpdateOperationResponse struct {
	Poller       pollers.Poller
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *Experiment
}

Jump to

Keyboard shortcuts

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