armcomputeschedule

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 14 Imported by: 0

README

Azure Compute Schedule Module for Go

PkgGoDev

Microsoft Azure Compute Schedule allows customers to schedule one off operations on their virtual machines. These operations include:

  • Start
  • Deallocate
  • Hibernate

There are 2 groups of schedule type operations that customers can perform on their virtual machines

  • Submit Type Operations: These type of operations can be scheduled at a later date in the future, up to 14 days ahead.
  • Execute Type Operations: These type of operations allow clients to perform operations on their virtual machines immediately.

Other operations include endpoints to get operation status on virtual machines, cancel operations scheduled on virtual machines and get errors that might have occured during operations.

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 Compute Schedule module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule

Authorization

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

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 ComputeSchedule 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 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 CancelOperationsRequest

type CancelOperationsRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The list of operation ids to cancel operations on
	OperationIDs []*string
}

CancelOperationsRequest - This is the request to cancel running operations in scheduled actions using the operation ids

func (CancelOperationsRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CancelOperationsRequest.

func (*CancelOperationsRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CancelOperationsRequest.

type CancelOperationsResponse

type CancelOperationsResponse struct {
	// REQUIRED; An array of resource operations that were successfully cancelled
	Results []*ResourceOperation
}

CancelOperationsResponse - This is the response from a cancel operations request

func (CancelOperationsResponse) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CancelOperationsResponse.

func (*CancelOperationsResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CancelOperationsResponse.

type ClientFactory

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

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 - The ID of the target subscription. The value must be an UUID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewOperationsClient

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewScheduledActionsClient

func (c *ClientFactory) NewScheduledActionsClient() *ScheduledActionsClient

NewScheduledActionsClient creates a new instance of ScheduledActionsClient.

type DeadlineType

type DeadlineType string

DeadlineType - The types of deadlines supported by ScheduledActions

const (
	// DeadlineTypeCompleteBy - Complete the operation by the given deadline.
	DeadlineTypeCompleteBy DeadlineType = "CompleteBy"
	// DeadlineTypeInitiateAt - Initiate the operation at the given deadline.
	DeadlineTypeInitiateAt DeadlineType = "InitiateAt"
	// DeadlineTypeUnknown - Default value of Unknown.
	DeadlineTypeUnknown DeadlineType = "Unknown"
)

func PossibleDeadlineTypeValues

func PossibleDeadlineTypeValues() []DeadlineType

PossibleDeadlineTypeValues returns the possible values for the DeadlineType const type.

type DeallocateResourceOperationResponse

type DeallocateResourceOperationResponse struct {
	// REQUIRED; The description of the operation response
	Description *string

	// REQUIRED; The location of the deallocate request eg westus
	Location *string

	// REQUIRED; The type of resources used in the deallocate request eg virtual machines
	Type *string

	// The results from the deallocate request if no errors exist
	Results []*ResourceOperation
}

DeallocateResourceOperationResponse - The response from a deallocate request

func (DeallocateResourceOperationResponse) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DeallocateResourceOperationResponse.

func (*DeallocateResourceOperationResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DeallocateResourceOperationResponse.

type ExecuteDeallocateRequest

type ExecuteDeallocateRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The execution parameters for the request
	ExecutionParameters *ExecutionParameters

	// REQUIRED; The resources for the request
	Resources *Resources
}

ExecuteDeallocateRequest - The ExecuteDeallocateRequest request for executeDeallocate operations

func (ExecuteDeallocateRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExecuteDeallocateRequest.

func (*ExecuteDeallocateRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteDeallocateRequest.

type ExecuteHibernateRequest

type ExecuteHibernateRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The execution parameters for the request
	ExecutionParameters *ExecutionParameters

	// REQUIRED; The resources for the request
	Resources *Resources
}

ExecuteHibernateRequest - The ExecuteHibernateRequest request for executeHibernate operations

func (ExecuteHibernateRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExecuteHibernateRequest.

func (*ExecuteHibernateRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteHibernateRequest.

type ExecuteStartRequest

type ExecuteStartRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The execution parameters for the request
	ExecutionParameters *ExecutionParameters

	// REQUIRED; The resources for the request
	Resources *Resources
}

ExecuteStartRequest - The ExecuteStartRequest request for executeStart operations

func (ExecuteStartRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExecuteStartRequest.

func (*ExecuteStartRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteStartRequest.

type ExecutionParameters

type ExecutionParameters struct {
	// Details that could optimize the user's request
	OptimizationPreference *OptimizationPreference

	// Retry policy the user can pass
	RetryPolicy *RetryPolicy
}

ExecutionParameters - Extra details needed to run the user's request

func (ExecutionParameters) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExecutionParameters.

func (*ExecutionParameters) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ExecutionParameters.

type GetOperationErrorsRequest

type GetOperationErrorsRequest struct {
	// REQUIRED; The list of operation ids to query errors of
	OperationIDs []*string
}

GetOperationErrorsRequest - This is the request to get errors per vm operations

func (GetOperationErrorsRequest) MarshalJSON

func (g GetOperationErrorsRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GetOperationErrorsRequest.

func (*GetOperationErrorsRequest) UnmarshalJSON

func (g *GetOperationErrorsRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GetOperationErrorsRequest.

type GetOperationErrorsResponse

type GetOperationErrorsResponse struct {
	// REQUIRED; An array of operationids and their corresponding errors if any
	Results []*OperationErrorsResult
}

GetOperationErrorsResponse - This is the response from a get operations errors request

func (GetOperationErrorsResponse) MarshalJSON

func (g GetOperationErrorsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GetOperationErrorsResponse.

func (*GetOperationErrorsResponse) UnmarshalJSON

func (g *GetOperationErrorsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GetOperationErrorsResponse.

type GetOperationStatusRequest

type GetOperationStatusRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The list of operation ids to get the status of
	OperationIDs []*string
}

GetOperationStatusRequest - This is the request to get operation status using operationids

func (GetOperationStatusRequest) MarshalJSON

func (g GetOperationStatusRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GetOperationStatusRequest.

func (*GetOperationStatusRequest) UnmarshalJSON

func (g *GetOperationStatusRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GetOperationStatusRequest.

type GetOperationStatusResponse

type GetOperationStatusResponse struct {
	// REQUIRED; An array of resource operations based on their operation ids
	Results []*ResourceOperation
}

GetOperationStatusResponse - This is the response from a get operations status request

func (GetOperationStatusResponse) MarshalJSON

func (g GetOperationStatusResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GetOperationStatusResponse.

func (*GetOperationStatusResponse) UnmarshalJSON

func (g *GetOperationStatusResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GetOperationStatusResponse.

type HibernateResourceOperationResponse

type HibernateResourceOperationResponse struct {
	// REQUIRED; The description of the operation response
	Description *string

	// REQUIRED; The location of the Hibernate request eg westus
	Location *string

	// REQUIRED; The type of resources used in the Hibernate request eg virtual machines
	Type *string

	// The results from the Hibernate request if no errors exist
	Results []*ResourceOperation
}

HibernateResourceOperationResponse - The response from a Hibernate request

func (HibernateResourceOperationResponse) MarshalJSON

func (h HibernateResourceOperationResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type HibernateResourceOperationResponse.

func (*HibernateResourceOperationResponse) UnmarshalJSON

func (h *HibernateResourceOperationResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type HibernateResourceOperationResponse.

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

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

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON

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

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationErrorDetails

type OperationErrorDetails struct {
	// REQUIRED; CRP operationid of the operation for deeper analysis
	CrpOperationID *string

	// REQUIRED; The error code of the operation
	ErrorCode *string

	// REQUIRED; The error details of the operation
	ErrorDetails *time.Time

	// REQUIRED; The timestamp of the error occurence
	TimeStamp *time.Time
}

OperationErrorDetails - This defines a list of operation errors associated with a unique operationId

func (OperationErrorDetails) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationErrorDetails.

func (*OperationErrorDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationErrorDetails.

type OperationErrorsResult

type OperationErrorsResult struct {
	// The activation time of a vm operation
	ActivationTime *time.Time

	// The completion time of the operation if the operation was completed
	CompletedAt *time.Time

	// The creation time of the error result
	CreationTime *time.Time

	// A list of errors associated with the operationid
	OperationErrors []*OperationErrorDetails

	// The operationId identifying a vm operation
	OperationID *string

	// Request level error code
	RequestErrorCode *string

	// Request level error details
	RequestErrorDetails *string
}

OperationErrorsResult - This is the first level of operation errors from the request when clients get errors per vm operation

func (OperationErrorsResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationErrorsResult.

func (*OperationErrorsResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationErrorsResult.

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

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

type OperationState

type OperationState string

OperationState - Values that define the states of operations in Scheduled Actions

const (
	// OperationStateBlocked - Operations that are blocked
	OperationStateBlocked OperationState = "Blocked"
	// OperationStateCancelled - Operations that have been cancelled by the user
	OperationStateCancelled OperationState = "Cancelled"
	// OperationStateExecuting - Operations that are in the process of being executed
	OperationStateExecuting OperationState = "Executing"
	// OperationStateFailed - Operations that have failed
	OperationStateFailed OperationState = "Failed"
	// OperationStatePendingExecution - Operations that are waiting to be executed
	OperationStatePendingExecution OperationState = "PendingExecution"
	// OperationStatePendingScheduling - Operations that are pending scheduling
	OperationStatePendingScheduling OperationState = "PendingScheduling"
	// OperationStateScheduled - Operations that have been scheduled
	OperationStateScheduled OperationState = "Scheduled"
	// OperationStateSucceeded - Operations that suceeded
	OperationStateSucceeded OperationState = "Succeeded"
	// OperationStateUnknown - The default value for the operation state enum
	OperationStateUnknown OperationState = "Unknown"
)

func PossibleOperationStateValues

func PossibleOperationStateValues() []OperationState

PossibleOperationStateValues returns the possible values for the OperationState const type.

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) NewListPager

NewListPager - List the operations for the provider

Generated from API version 2024-08-15-preview

  • options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example (OperationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/Operations_List_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(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.OperationListResult = armcomputeschedule.OperationListResult{
		// 	Value: []*armcomputeschedule.Operation{
		// 		{
		// 			Name: to.Ptr("ennucrkvxylbsli"),
		// 			ActionType: to.Ptr(armcomputeschedule.ActionTypeInternal),
		// 			Display: &armcomputeschedule.OperationDisplay{
		// 				Description: to.Ptr("tsqbr"),
		// 				Operation: to.Ptr("sjldnlycokfcufegoktphlwpvxkx"),
		// 				Provider: to.Ptr("brssqjspiggui"),
		// 				Resource: to.Ptr("aujpznmlzjgsyynq"),
		// 			},
		// 			IsDataAction: to.Ptr(true),
		// 			Origin: to.Ptr(armcomputeschedule.OriginUser),
		// 	}},
		// }
	}
}
Output:

Example (OperationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/Operations_List_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(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.OperationListResult = armcomputeschedule.OperationListResult{
		// }
	}
}
Output:

type OperationsClientListOptions

type OperationsClientListOptions struct {
}

OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.

type OperationsClientListResponse

type OperationsClientListResponse 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
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type OptimizationPreference

type OptimizationPreference string

OptimizationPreference - The preferences customers can select to optimize their requests to ScheduledActions

const (
	// OptimizationPreferenceAvailability - Optimize while considering availability of resources
	OptimizationPreferenceAvailability OptimizationPreference = "Availability"
	// OptimizationPreferenceCost - Optimize while considering cost savings
	OptimizationPreferenceCost OptimizationPreference = "Cost"
	// OptimizationPreferenceCostAvailabilityBalanced - Optimize while considering a balance of cost and availability
	OptimizationPreferenceCostAvailabilityBalanced OptimizationPreference = "CostAvailabilityBalanced"
)

func PossibleOptimizationPreferenceValues

func PossibleOptimizationPreferenceValues() []OptimizationPreference

PossibleOptimizationPreferenceValues returns the possible values for the OptimizationPreference const type.

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 ResourceOperation

type ResourceOperation struct {
	// Resource level error code if it exists
	ErrorCode *string

	// Resource level error details if they exist
	ErrorDetails *string

	// Details of the operation performed on a resource
	Operation *ResourceOperationDetails

	// Unique identifier for the resource involved in the operation, eg ArmId
	ResourceID *string
}

ResourceOperation - High level response from an operation on a resource

func (ResourceOperation) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceOperation.

func (*ResourceOperation) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperation.

type ResourceOperationDetails

type ResourceOperationDetails struct {
	// REQUIRED; Deadline for the operation
	Deadline *time.Time

	// REQUIRED; Type of deadline of the operation
	DeadlineType *DeadlineType

	// REQUIRED; Type of operation performed on the resources
	OpType *ResourceOperationType

	// REQUIRED; Operation identifier for the unique operation
	OperationID *string

	// REQUIRED; Unique identifier for the resource involved in the operation, eg ArmId
	ResourceID *string

	// REQUIRED; Current state of the operation
	State *OperationState

	// REQUIRED; Subscription id attached to the request
	SubscriptionID *string

	// Time the operation was complete if errors are null
	CompletedAt *time.Time

	// Operation level errors if they exist
	ResourceOperationError *ResourceOperationError

	// Retry policy the user can pass
	RetryPolicy *RetryPolicy

	// Timezone for the operation
	TimeZone *string
}

ResourceOperationDetails - The details of a response from an operation on a resource

func (ResourceOperationDetails) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceOperationDetails.

func (*ResourceOperationDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperationDetails.

type ResourceOperationError

type ResourceOperationError struct {
	// REQUIRED; Code for the error eg 404, 500
	ErrorCode *string

	// REQUIRED; Detailed message about the error
	ErrorDetails *string
}

ResourceOperationError - These describe errors that occur at the resource level

func (ResourceOperationError) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceOperationError.

func (*ResourceOperationError) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperationError.

type ResourceOperationType

type ResourceOperationType string

ResourceOperationType - Type of operation performed on the resources

const (
	// ResourceOperationTypeDeallocate - Deallocate operations on the resources
	ResourceOperationTypeDeallocate ResourceOperationType = "Deallocate"
	// ResourceOperationTypeHibernate - Hibernate operations on the resources
	ResourceOperationTypeHibernate ResourceOperationType = "Hibernate"
	// ResourceOperationTypeStart - Start operations on the resources
	ResourceOperationTypeStart ResourceOperationType = "Start"
	// ResourceOperationTypeUnknown - The default value for this enum type
	ResourceOperationTypeUnknown ResourceOperationType = "Unknown"
)

func PossibleResourceOperationTypeValues

func PossibleResourceOperationTypeValues() []ResourceOperationType

PossibleResourceOperationTypeValues returns the possible values for the ResourceOperationType const type.

type Resources

type Resources struct {
	// REQUIRED; The resource ids used for the request
	IDs []*string
}

Resources - The resources needed for the user request

func (Resources) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Resources.

func (*Resources) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Resources.

type RetryPolicy

type RetryPolicy struct {
	// Retry count for user request
	RetryCount *int32

	// Retry window in minutes for user request
	RetryWindowInMinutes *int32
}

RetryPolicy - The retry policy for the user request

func (RetryPolicy) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type RetryPolicy.

func (*RetryPolicy) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RetryPolicy.

type Schedule

type Schedule struct {
	// REQUIRED; The deadline for the operation
	DeadLine *time.Time

	// REQUIRED; The deadlinetype of the operation, this can either be InitiateAt or CompleteBy
	DeadlineType *DeadlineType

	// REQUIRED; The timezone for the operation
	TimeZone *string
}

Schedule - The schedule details for the user request

func (Schedule) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Schedule.

func (*Schedule) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Schedule.

type ScheduledActionsClient

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

ScheduledActionsClient contains the methods for the ScheduledActions group. Don't use this type directly, use NewScheduledActionsClient() instead.

func NewScheduledActionsClient

func NewScheduledActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledActionsClient, error)

NewScheduledActionsClient creates a new instance of ScheduledActionsClient with the specified values.

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ScheduledActionsClient) VirtualMachinesCancelOperations

VirtualMachinesCancelOperations - virtualMachinesCancelOperations: cancelOperations for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesCancelOperationsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesCancelOperations method.
Example (ScheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesCancelOperations(ctx, "tdxypnse", armcomputeschedule.CancelOperationsRequest{
		Correlationid: to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3c1"),
		OperationIDs: []*string{
			to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")},
	}, 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.CancelOperationsResponse = armcomputeschedule.CancelOperationsResponse{
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource1"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource1"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesCancelOperations(ctx, "lwapkjsbltcqp", armcomputeschedule.CancelOperationsRequest{
		Correlationid: to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3c1"),
		OperationIDs: []*string{
			to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")},
	}, 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.CancelOperationsResponse = armcomputeschedule.CancelOperationsResponse{
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 	}},
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesExecuteDeallocate

VirtualMachinesExecuteDeallocate - virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate method.
Example (ScheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDeallocate(ctx, "mklyzgztbivwzo", armcomputeschedule.ExecuteDeallocateRequest{
		Correlationid: to.Ptr("01080d2f-1dca-4610-afb4-dd25eddf1f3c1"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{
			OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost),
			RetryPolicy: &armcomputeschedule.RetryPolicy{
				RetryCount:           to.Ptr[int32](30),
				RetryWindowInMinutes: to.Ptr[int32](27),
			},
		},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2")},
		},
	}, 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.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{
	// 	Type: to.Ptr("eokrhxypminzcgplibblmwojvjd"),
	// 	Description: to.Ptr("ndhb"),
	// 	Location: to.Ptr("qbbvrdisvjgxirnzdvdsodkt"),
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDeallocate(ctx, "irbtacrhjgfpyvhvjo", armcomputeschedule.ExecuteDeallocateRequest{
		Correlationid:       to.Ptr("01080d2f-1dca-4610-afb4-dd25eddf1f3c1"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2")},
		},
	}, 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.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{
	// 	Type: to.Ptr("eokrhxypminzcgplibblmwojvjd"),
	// 	Description: to.Ptr("ndhb"),
	// 	Location: to.Ptr("qbbvrdisvjgxirnzdvdsodkt"),
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesExecuteHibernate

VirtualMachinesExecuteHibernate - virtualMachinesExecuteHibernate: executeHibernate for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate method.
Example (ScheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteHibernate(ctx, "sejdmamuhhvfpljomwumsplc", armcomputeschedule.ExecuteHibernateRequest{
		Correlationid: to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3c1"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{
			OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost),
			RetryPolicy: &armcomputeschedule.RetryPolicy{
				RetryCount:           to.Ptr[int32](30),
				RetryWindowInMinutes: to.Ptr[int32](27),
			},
		},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")},
		},
	}, 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.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{
	// 	Type: to.Ptr("mkmgbfpkiudefzhdppgjmqztx"),
	// 	Description: to.Ptr("wbxeejgkmtwtkcsepidgox"),
	// 	Location: to.Ptr("rvlnzczpesuvusbmbcjctzcinzlr"),
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteHibernate(ctx, "kga", armcomputeschedule.ExecuteHibernateRequest{
		Correlationid:       to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3c1"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")},
		},
	}, 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.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{
	// 	Type: to.Ptr("mkmgbfpkiudefzhdppgjmqztx"),
	// 	Description: to.Ptr("wbxeejgkmtwtkcsepidgox"),
	// 	Location: to.Ptr("rvlnzczpesuvusbmbcjctzcinzlr"),
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesExecuteStart

VirtualMachinesExecuteStart - virtualMachinesExecuteStart: executeStart for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesExecuteStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteStart method.
Example (ScheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteStart(ctx, "ysfrwcfmfsh", armcomputeschedule.ExecuteStartRequest{
		Correlationid: to.Ptr("23230d2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{
			OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost),
			RetryPolicy: &armcomputeschedule.RetryPolicy{
				RetryCount:           to.Ptr[int32](30),
				RetryWindowInMinutes: to.Ptr[int32](27),
			},
		},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4")},
		},
	}, 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.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{
	// 	Type: to.Ptr("gxmnjtgu"),
	// 	Description: to.Ptr("raacd"),
	// 	Location: to.Ptr("uvlidhowwv"),
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteStart(ctx, "qegbgjculewswqvnmaclcgpqqidl", armcomputeschedule.ExecuteStartRequest{
		Correlationid:       to.Ptr("23230d2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4")},
		},
	}, 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.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{
	// 	Type: to.Ptr("gxmnjtgu"),
	// 	Description: to.Ptr("raacd"),
	// 	Location: to.Ptr("uvlidhowwv"),
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesGetOperationErrors

VirtualMachinesGetOperationErrors - virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationErrors method.
Example (CsScheduledActionsVirtualMachinesGetOperationErrorsMax)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationErrors(ctx, "hfsa", armcomputeschedule.GetOperationErrorsRequest{
		OperationIDs: []*string{
			to.Ptr("DE84A209-5715-43E7-BC76-3E208A9A323")},
	}, 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.GetOperationErrorsResponse = armcomputeschedule.GetOperationErrorsResponse{
	// 	Results: []*armcomputeschedule.OperationErrorsResult{
	// 		{
	// 			OperationID: to.Ptr("DE84A209-5715-43E7-BC76-3E208A9A323"),
	// 			ActivationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:14.771Z"); return t}()),
	// 			CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:14.771Z"); return t}()),
	// 			CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:14.771Z"); return t}()),
	// 			OperationErrors: []*armcomputeschedule.OperationErrorDetails{
	// 				{
	// 					CrpOperationID: to.Ptr("DE84A209-5715-43E7-BC76-3E208A9A32C5"),
	// 					ErrorCode: to.Ptr("nr"),
	// 					ErrorDetails: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:14.771Z"); return t}()),
	// 					TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:14.771Z"); return t}()),
	// 			}},
	// 			RequestErrorCode: to.Ptr("hyfvxj"),
	// 			RequestErrorDetails: to.Ptr("heqpzxzbtrimbxalapqypezeflkyo"),
	// 	}},
	// }
}
Output:

Example (CsScheduledActionsVirtualMachinesGetOperationErrorsMin)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationErrors(ctx, "ggxoaxzxtdbi", armcomputeschedule.GetOperationErrorsRequest{
		OperationIDs: []*string{
			to.Ptr("qeicik")},
	}, 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.GetOperationErrorsResponse = armcomputeschedule.GetOperationErrorsResponse{
	// 	Results: []*armcomputeschedule.OperationErrorsResult{
	// 		{
	// 			OperationID: to.Ptr("wetjrhx"),
	// 			CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:14.771Z"); return t}()),
	// 	}},
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesGetOperationStatus

VirtualMachinesGetOperationStatus - virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesGetOperationStatusOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationStatus method.
Example (ScheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationStatus(ctx, "csay", armcomputeschedule.GetOperationStatusRequest{
		Correlationid: to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3c1"),
		OperationIDs: []*string{
			to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3df")},
	}, 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.GetOperationStatusResponse = armcomputeschedule.GetOperationStatusResponse{
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationStatus(ctx, "htxxasfxaesuecem", armcomputeschedule.GetOperationStatusRequest{
		Correlationid: to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3c1"),
		OperationIDs: []*string{
			to.Ptr("01080d2f-1dca-4610-afb4-dd25eec1f3df")},
	}, 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.GetOperationStatusResponse = armcomputeschedule.GetOperationStatusResponse{
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("ipyvwgk"),
	// 			ErrorDetails: to.Ptr("dfegatwcb"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("brvr"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:13.928Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-08T19:00:13.928Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("ryxlbd"),
	// 					ErrorDetails: to.Ptr("vdwoj"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](5),
	// 					RetryWindowInMinutes: to.Ptr[int32](17),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("l"),
	// 				TimeZone: to.Ptr("ggsopagtvrtsjltyyccqgufgm"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"),
	// 	}},
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesSubmitDeallocate

VirtualMachinesSubmitDeallocate - virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate method.
Example (ScheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDeallocate(ctx, "ibfxsvilwrgqttuslbduzdtxcckdet", armcomputeschedule.SubmitDeallocateRequest{
		Correlationid: to.Ptr("23519o2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{
			OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost),
			RetryPolicy: &armcomputeschedule.RetryPolicy{
				RetryCount:           to.Ptr[int32](30),
				RetryWindowInMinutes: to.Ptr[int32](27),
			},
		},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2")},
		},
		Schedule: &armcomputeschedule.Schedule{
			DeadLine:     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:53.361Z"); return t }()),
			DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
			TimeZone:     to.Ptr("zlcujrtgxtgyik"),
		},
	}, 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.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{
	// 	Type: to.Ptr("eokrhxypminzcgplibblmwojvjd"),
	// 	Description: to.Ptr("ndhb"),
	// 	Location: to.Ptr("qbbvrdisvjgxirnzdvdsodkt"),
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDeallocate(ctx, "qwfcdtmshnlownbkyh", armcomputeschedule.SubmitDeallocateRequest{
		Correlationid:       to.Ptr("23519o2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2")},
		},
		Schedule: &armcomputeschedule.Schedule{
			DeadLine:     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:53.361Z"); return t }()),
			DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
			TimeZone:     to.Ptr("zlcujrtgxtgyik"),
		},
	}, 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.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{
	// 	Type: to.Ptr("eokrhxypminzcgplibblmwojvjd"),
	// 	Description: to.Ptr("ndhb"),
	// 	Location: to.Ptr("qbbvrdisvjgxirnzdvdsodkt"),
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesSubmitHibernate

VirtualMachinesSubmitHibernate - virtualMachinesSubmitHibernate: submitHibernate for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate method.
Example (ScheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitHibernate(ctx, "bgxeayimbxqzev", armcomputeschedule.SubmitHibernateRequest{
		Correlationid: to.Ptr("23519o2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{
			OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost),
			RetryPolicy: &armcomputeschedule.RetryPolicy{
				RetryCount:           to.Ptr[int32](30),
				RetryWindowInMinutes: to.Ptr[int32](27),
			},
		},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")},
		},
		Schedule: &armcomputeschedule.Schedule{
			DeadLine:     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:53.361Z"); return t }()),
			DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
			TimeZone:     to.Ptr("zlcujrtgxtgyik"),
		},
	}, 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.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{
	// 	Type: to.Ptr("mkmgbfpkiudefzhdppgjmqztx"),
	// 	Description: to.Ptr("wbxeejgkmtwtkcsepidgox"),
	// 	Location: to.Ptr("rvlnzczpesuvusbmbcjctzcinzlr"),
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitHibernate(ctx, "fvjciwudfbndlqumcgqs", armcomputeschedule.SubmitHibernateRequest{
		Correlationid:       to.Ptr("23519o2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")},
		},
		Schedule: &armcomputeschedule.Schedule{
			DeadLine:     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:53.361Z"); return t }()),
			DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
			TimeZone:     to.Ptr("zlcujrtgxtgyik"),
		},
	}, 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.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{
	// 	Type: to.Ptr("mkmgbfpkiudefzhdppgjmqztx"),
	// 	Description: to.Ptr("wbxeejgkmtwtkcsepidgox"),
	// 	Location: to.Ptr("rvlnzczpesuvusbmbcjctzcinzlr"),
	// }
}
Output:

func (*ScheduledActionsClient) VirtualMachinesSubmitStart

VirtualMachinesSubmitStart - virtualMachinesSubmitStart: submitStart for a virtual machine If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-15-preview

  • locationparameter - The location name.
  • requestBody - The request body
  • options - ScheduledActionsClientVirtualMachinesSubmitStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitStart method.
Example (ScheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitStart(ctx, "fxiidszhrokwjmewlahfqjiocnes", armcomputeschedule.SubmitStartRequest{
		Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{
			OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost),
			RetryPolicy: &armcomputeschedule.RetryPolicy{
				RetryCount:           to.Ptr[int32](30),
				RetryWindowInMinutes: to.Ptr[int32](27),
			},
		},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4")},
		},
		Schedule: &armcomputeschedule.Schedule{
			DeadLine:     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:53.361Z"); return t }()),
			DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
			TimeZone:     to.Ptr("zlcujrtgxtgyik"),
		},
	}, 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.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{
	// 	Type: to.Ptr("gxmnjtgu"),
	// 	Description: to.Ptr("raacd"),
	// 	Location: to.Ptr("uvlidhowwv"),
	// 	Results: []*armcomputeschedule.ResourceOperation{
	// 		{
	// 			ErrorCode: to.Ptr("pliurpaykwv"),
	// 			ErrorDetails: to.Ptr("mbqwkpxl"),
	// 			Operation: &armcomputeschedule.ResourceOperationDetails{
	// 				OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
	// 				CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:52.974Z"); return t}()),
	// 				DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
	// 				OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown),
	// 				ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"),
	// 				ResourceOperationError: &armcomputeschedule.ResourceOperationError{
	// 					ErrorCode: to.Ptr("fticyqukvkillwd"),
	// 					ErrorDetails: to.Ptr("yimgxqrkp"),
	// 				},
	// 				RetryPolicy: &armcomputeschedule.RetryPolicy{
	// 					RetryCount: to.Ptr[int32](30),
	// 					RetryWindowInMinutes: to.Ptr[int32](27),
	// 				},
	// 				State: to.Ptr(armcomputeschedule.OperationStateUnknown),
	// 				SubscriptionID: to.Ptr("52C81249-550F-459E-9B6E-5BAB6EE62227"),
	// 				TimeZone: to.Ptr("lsoalxijilbrqum"),
	// 			},
	// 			ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"),
	// 	}},
	// }
}
Output:

Example (ScheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a287afb3721dee0d88f11502ec123470bc52a28/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-08-15-preview/examples/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json

package main

import (
	"context"
	"log"

	"time"

	"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/computeschedule/armcomputeschedule"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcomputeschedule.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitStart(ctx, "httzei", armcomputeschedule.SubmitStartRequest{
		Correlationid:       to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34"),
		ExecutionParameters: &armcomputeschedule.ExecutionParameters{},
		Resources: &armcomputeschedule.Resources{
			IDs: []*string{
				to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4")},
		},
		Schedule: &armcomputeschedule.Schedule{
			DeadLine:     to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-12T18:06:53.361Z"); return t }()),
			DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown),
			TimeZone:     to.Ptr("zlcujrtgxtgyik"),
		},
	}, 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.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{
	// 	Type: to.Ptr("gxmnjtgu"),
	// 	Description: to.Ptr("raacd"),
	// 	Location: to.Ptr("uvlidhowwv"),
	// }
}
Output:

type ScheduledActionsClientVirtualMachinesCancelOperationsOptions

type ScheduledActionsClientVirtualMachinesCancelOperationsOptions struct {
}

ScheduledActionsClientVirtualMachinesCancelOperationsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesCancelOperations method.

type ScheduledActionsClientVirtualMachinesCancelOperationsResponse

type ScheduledActionsClientVirtualMachinesCancelOperationsResponse struct {
	// This is the response from a cancel operations request
	CancelOperationsResponse
}

ScheduledActionsClientVirtualMachinesCancelOperationsResponse contains the response from method ScheduledActionsClient.VirtualMachinesCancelOperations.

type ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions

type ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions struct {
}

ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate method.

type ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse

type ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse struct {
	// The response from a deallocate request
	DeallocateResourceOperationResponse
}

ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteDeallocate.

type ScheduledActionsClientVirtualMachinesExecuteHibernateOptions

type ScheduledActionsClientVirtualMachinesExecuteHibernateOptions struct {
}

ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate method.

type ScheduledActionsClientVirtualMachinesExecuteHibernateResponse

type ScheduledActionsClientVirtualMachinesExecuteHibernateResponse struct {
	// The response from a Hibernate request
	HibernateResourceOperationResponse
}

ScheduledActionsClientVirtualMachinesExecuteHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteHibernate.

type ScheduledActionsClientVirtualMachinesExecuteStartOptions

type ScheduledActionsClientVirtualMachinesExecuteStartOptions struct {
}

ScheduledActionsClientVirtualMachinesExecuteStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteStart method.

type ScheduledActionsClientVirtualMachinesExecuteStartResponse

type ScheduledActionsClientVirtualMachinesExecuteStartResponse struct {
	// The response from a start request
	StartResourceOperationResponse
}

ScheduledActionsClientVirtualMachinesExecuteStartResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteStart.

type ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions

type ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions struct {
}

ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationErrors method.

type ScheduledActionsClientVirtualMachinesGetOperationErrorsResponse

type ScheduledActionsClientVirtualMachinesGetOperationErrorsResponse struct {
	// This is the response from a get operations errors request
	GetOperationErrorsResponse
}

ScheduledActionsClientVirtualMachinesGetOperationErrorsResponse contains the response from method ScheduledActionsClient.VirtualMachinesGetOperationErrors.

type ScheduledActionsClientVirtualMachinesGetOperationStatusOptions

type ScheduledActionsClientVirtualMachinesGetOperationStatusOptions struct {
}

ScheduledActionsClientVirtualMachinesGetOperationStatusOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationStatus method.

type ScheduledActionsClientVirtualMachinesGetOperationStatusResponse

type ScheduledActionsClientVirtualMachinesGetOperationStatusResponse struct {
	// This is the response from a get operations status request
	GetOperationStatusResponse
}

ScheduledActionsClientVirtualMachinesGetOperationStatusResponse contains the response from method ScheduledActionsClient.VirtualMachinesGetOperationStatus.

type ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions

type ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions struct {
}

ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate method.

type ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse

type ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse struct {
	// The response from a deallocate request
	DeallocateResourceOperationResponse
}

ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitDeallocate.

type ScheduledActionsClientVirtualMachinesSubmitHibernateOptions

type ScheduledActionsClientVirtualMachinesSubmitHibernateOptions struct {
}

ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate method.

type ScheduledActionsClientVirtualMachinesSubmitHibernateResponse

type ScheduledActionsClientVirtualMachinesSubmitHibernateResponse struct {
	// The response from a Hibernate request
	HibernateResourceOperationResponse
}

ScheduledActionsClientVirtualMachinesSubmitHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitHibernate.

type ScheduledActionsClientVirtualMachinesSubmitStartOptions

type ScheduledActionsClientVirtualMachinesSubmitStartOptions struct {
}

ScheduledActionsClientVirtualMachinesSubmitStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitStart method.

type ScheduledActionsClientVirtualMachinesSubmitStartResponse

type ScheduledActionsClientVirtualMachinesSubmitStartResponse struct {
	// The response from a start request
	StartResourceOperationResponse
}

ScheduledActionsClientVirtualMachinesSubmitStartResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitStart.

type StartResourceOperationResponse

type StartResourceOperationResponse struct {
	// REQUIRED; The description of the operation response
	Description *string

	// REQUIRED; The location of the start request eg westus
	Location *string

	// REQUIRED; The type of resources used in the start request eg virtual machines
	Type *string

	// The results from the start request if no errors exist
	Results []*ResourceOperation
}

StartResourceOperationResponse - The response from a start request

func (StartResourceOperationResponse) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type StartResourceOperationResponse.

func (*StartResourceOperationResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type StartResourceOperationResponse.

type SubmitDeallocateRequest

type SubmitDeallocateRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The execution parameters for the request
	ExecutionParameters *ExecutionParameters

	// REQUIRED; The resources for the request
	Resources *Resources

	// REQUIRED; The schedule for the request
	Schedule *Schedule
}

SubmitDeallocateRequest - The deallocate request for resources

func (SubmitDeallocateRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SubmitDeallocateRequest.

func (*SubmitDeallocateRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SubmitDeallocateRequest.

type SubmitHibernateRequest

type SubmitHibernateRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The execution parameters for the request
	ExecutionParameters *ExecutionParameters

	// REQUIRED; The resources for the request
	Resources *Resources

	// REQUIRED; The schedule for the request
	Schedule *Schedule
}

SubmitHibernateRequest - This is the request for hibernate

func (SubmitHibernateRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SubmitHibernateRequest.

func (*SubmitHibernateRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SubmitHibernateRequest.

type SubmitStartRequest

type SubmitStartRequest struct {
	// REQUIRED; Correlationid item
	Correlationid *string

	// REQUIRED; The execution parameters for the request
	ExecutionParameters *ExecutionParameters

	// REQUIRED; The resources for the request
	Resources *Resources

	// REQUIRED; The schedule for the request
	Schedule *Schedule
}

SubmitStartRequest - This is the request for start

func (SubmitStartRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SubmitStartRequest.

func (*SubmitStartRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SubmitStartRequest.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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