clients

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderTypeAzure is used to specify the provider configuration for Azure resources.
	ProviderTypeAzure = "AzureResourceManager"
	// ProviderTypeAWS is used to specify the provider configuration for AWS resources.
	ProviderTypeAWS = "AWS"
	// ProviderTypeDeployments is used to specify the provider configuration for Bicep modules.
	ProviderTypeDeployments = "Microsoft.Resources"
	// ProviderTypeRadius is used to specify the provider configuration for Radius resources.
	ProviderTypeRadius = "Radius"
)
View Source
const (
	// ModuleName is used for telemetry if needed.
	ModuleName = "radius"

	// ModuleVersion is used for telemetry if needed.
	ModuleVersion = "public-preview"
)

Variables

View Source
var (
	// DeploymentsClientAPIVersion is the API version of the UCP deployment client.
	DeploymentsClientAPIVersion = "2020-10-01"

	// DeploymentOperationsClientAPIVersion is the API version of the UCP deployment operations client.
	DeploymentOperationsClientAPIVersion = "2020-10-01"
)

Functions

func DeploymentEngineURL

func DeploymentEngineURL(baseURI string, resourceID string) string

DeploymentEngineURL takes a base URI and a resource ID and returns a URL string by combining the two.

Types

type AWS

type AWS struct {
	Type  string `json:"type,omitempty"`
	Value Value  `json:"value,omitempty"`
}

type Az

type Az struct {
	Type  string `json:"type,omitempty"`
	Value Value  `json:"value,omitempty"`
}

type ClientCreateOrUpdateResponse

type ClientCreateOrUpdateResponse struct {
	armresources.DeploymentExtended
}

ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate.

type ClientDeleteResponse added in v0.43.0

type ClientDeleteResponse struct {
	armresources.DeploymentExtended
}

ClientDeleteResponse contains the response from method Client.Delete.

type Deployment

type Deployment struct {
	// Location - The location to store the deployment data.
	Location *string `json:"location,omitempty"`
	// Properties - The deployment properties.
	Properties *DeploymentProperties `json:"properties,omitempty"`
	// Tags - Deployment tags
	Tags map[string]*string `json:"tags"`
}

type DeploymentProperties

type DeploymentProperties struct {
	// Template - The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both.
	Template any `json:"template,omitempty"`
	// TemplateLink - The URI of the template. Use either the templateLink property or the template property, but not both.
	TemplateLink *armresources.TemplateLink `json:"templateLink,omitempty"`
	// ProviderConfig specifies the scope for resources
	ProviderConfig any `json:"providerconfig,omitempty"`
	// Parameters - Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string.
	Parameters any `json:"parameters,omitempty"`
	// ParametersLink - The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both.
	ParametersLink *armresources.ParametersLink `json:"parametersLink,omitempty"`
	// Mode - The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'DeploymentModeIncremental', 'DeploymentModeComplete'
	Mode armresources.DeploymentMode `json:"mode,omitempty"`
	// DebugSetting - The debug setting of the deployment.
	DebugSetting *armresources.DebugSetting `json:"debugSetting,omitempty"`
	// OnErrorDeployment - The deployment on error behavior.
	OnErrorDeployment *armresources.OnErrorDeployment `json:"onErrorDeployment,omitempty"`
	// ExpressionEvaluationOptions - Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer.
	ExpressionEvaluationOptions *armresources.ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"`
}

DeploymentProperties deployment properties.

type Deployments

type Deployments struct {
	Type  string `json:"type,omitempty"`
	Value Value  `json:"value,omitempty"`
}

type MockResourceDeploymentsClient added in v0.43.0

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

func NewMockResourceDeploymentsClient added in v0.43.0

func NewMockResourceDeploymentsClient() *MockResourceDeploymentsClient

func (*MockResourceDeploymentsClient) CompleteOperation added in v0.43.0

func (rdc *MockResourceDeploymentsClient) CompleteOperation(operationID string, update func(state *OperationState))

func (*MockResourceDeploymentsClient) ContinueCreateOperation added in v0.43.0

func (rdc *MockResourceDeploymentsClient) ContinueCreateOperation(ctx context.Context, resumeToken string) (Poller[ClientCreateOrUpdateResponse], error)

func (*MockResourceDeploymentsClient) ContinueDeleteOperation added in v0.43.0

func (rdc *MockResourceDeploymentsClient) ContinueDeleteOperation(ctx context.Context, resumeToken string) (Poller[ClientDeleteResponse], error)

func (*MockResourceDeploymentsClient) CreateOrUpdate added in v0.43.0

func (rdc *MockResourceDeploymentsClient) CreateOrUpdate(ctx context.Context, parameters Deployment, resourceID, apiVersion string) (Poller[ClientCreateOrUpdateResponse], error)

func (*MockResourceDeploymentsClient) Delete added in v0.43.0

func (rdc *MockResourceDeploymentsClient) Delete(ctx context.Context, resourceID, apiVersion string) (Poller[ClientDeleteResponse], error)

func (*MockResourceDeploymentsClient) GetResource added in v0.43.0

func (rdc *MockResourceDeploymentsClient) GetResource(resourceID string) (*ClientCreateOrUpdateResponse, bool)

type MockResourceDeploymentsClientPoller added in v0.43.0

type MockResourceDeploymentsClientPoller[T any] struct {
	// contains filtered or unexported fields
}

func (*MockResourceDeploymentsClientPoller[T]) Done added in v0.43.0

func (*MockResourceDeploymentsClientPoller[T]) Poll added in v0.43.0

func (*MockResourceDeploymentsClientPoller[T]) PollUntilDone added in v0.43.0

func (mp *MockResourceDeploymentsClientPoller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOptions) (T, error)

func (*MockResourceDeploymentsClientPoller[T]) Result added in v0.43.0

func (mp *MockResourceDeploymentsClientPoller[T]) Result(ctx context.Context) (T, error)

func (*MockResourceDeploymentsClientPoller[T]) ResumeToken added in v0.43.0

func (mp *MockResourceDeploymentsClientPoller[T]) ResumeToken() (string, error)

type OperationState added in v0.43.0

type OperationState struct {
	Complete bool
	Value    any
	// Ideally we'd use azcore.ResponseError here, but it's tricky to set up in tests.
	Err        error
	ResourceID string
	Kind       string
}

OperationState represents the state of an operation. This is a simplified version of the real OperationState that we use in testing.

type Options

type Options struct {
	// Cred represents a credential for OAuth token.
	Cred azcore.TokenCredential

	// BaseURI represents the base URI for the client.
	BaseURI string

	// ARMClientOptions represents the client options for ARM clients.
	ARMClientOptions *arm.ClientOptions
}

Options represents the client option for azure sdk client including authentication.

type PollUntilDoneOptions added in v0.43.0

type PollUntilDoneOptions = azcoreruntime.PollUntilDoneOptions

type Poller added in v0.43.0

type Poller[T any] interface {
	Done() bool
	Poll(ctx context.Context) (*http.Response, error)
	PollUntilDone(ctx context.Context, options *PollUntilDoneOptions) (T, error)
	Result(ctx context.Context) (T, error)
	ResumeToken() (string, error)
}

Poller is an interface for polling an operation. This uses the same functions of the Poller struct from the Azure SDK for Go. We use this interface to allow mocking the Poller struct in tests.

type ProviderConfig

type ProviderConfig struct {
	Radius      *Radius      `json:"radius,omitempty"`
	Az          *Az          `json:"az,omitempty"`
	AWS         *AWS         `json:"aws,omitempty"`
	Deployments *Deployments `json:"deployments,omitempty"`
}

func GenerateProviderConfig added in v0.43.0

func GenerateProviderConfig(resourceGroup, awsScope, azureScope string) ProviderConfig

GenerateProviderConfig generates a ProviderConfig object based on the given scopes.

func NewDefaultProviderConfig

func NewDefaultProviderConfig(resourceGroup string) ProviderConfig

NewDefaultProviderConfig creates a ProviderConfig instance with two fields, Deployments and Radius, and sets their values based on the resourceGroup parameter. The default config will include configuration for Radius resources, Kubernetes resources, and Bicep modules. AWS and Azure resources must be added separately.

func (ProviderConfig) String added in v0.43.0

func (p ProviderConfig) String() (string, error)

String returns the JSON representation of the ProviderConfig object in a string format.

type Radius

type Radius struct {
	Type  string `json:"type,omitempty"`
	Value Value  `json:"value,omitempty"`
}

type ResourceDeploymentOperationsClient

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

ResourceDeploymentOperationsClient is an operations client which takes in a resourceID as the destination to query. It is used by both Azure and UCP clients.

func NewResourceDeploymentOperationsClient

func NewResourceDeploymentOperationsClient(options *Options) (*ResourceDeploymentOperationsClient, error)

NewResourceDeploymentOperationsClient creates a new ResourceDeploymentOperationsClient with the provided options and returns it, or returns an error if the client creation fails.

func (*ResourceDeploymentOperationsClient) List

func (client *ResourceDeploymentOperationsClient) List(ctx context.Context, resourceGroupName string, deploymentName string, resourceID string, apiVersion string, top *int32) (*armresources.DeploymentOperationsListResult, error)

List retrieves a list of deployment operations for a given resource ID and API version. It returns an error if the list retrieval fails. Parameters: resourceId - the resourceId to deploy to. NOTE, must start with a '/'. Ex: "/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations top - the number of results to return.

func (*ResourceDeploymentOperationsClient) NewListPager

NewListPager creates a pager to iterate over the list of deployment operations for a given resource.

type ResourceDeploymentsClient

type ResourceDeploymentsClient interface {
	CreateOrUpdate(ctx context.Context, parameters Deployment, resourceID, apiVersion string) (Poller[ClientCreateOrUpdateResponse], error)
	ContinueCreateOperation(ctx context.Context, resumeToken string) (Poller[ClientCreateOrUpdateResponse], error)
	Delete(ctx context.Context, resourceID, apiVersion string) (Poller[ClientDeleteResponse], error)
	ContinueDeleteOperation(ctx context.Context, resumeToken string) (Poller[ClientDeleteResponse], error)
}

ResourceDeploymentsClient is a deployments client for Azure Resource Manager. It is used by both Azure and UCP clients.

func NewResourceDeploymentsClient

func NewResourceDeploymentsClient(options *Options) (ResourceDeploymentsClient, error)

NewResourceDeploymentsClient creates a new ResourceDeploymentsClient with the provided options and returns an error if the options are invalid.

type ResourceDeploymentsClientImpl added in v0.43.0

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

func (*ResourceDeploymentsClientImpl) ContinueCreateOperation added in v0.43.0

func (client *ResourceDeploymentsClientImpl) ContinueCreateOperation(ctx context.Context, resumeToken string) (Poller[ClientCreateOrUpdateResponse], error)

ContinueCreateOperation continues a create operation given a resume token.

func (*ResourceDeploymentsClientImpl) ContinueDeleteOperation added in v0.43.0

func (client *ResourceDeploymentsClientImpl) ContinueDeleteOperation(ctx context.Context, resumeToken string) (Poller[ClientDeleteResponse], error)

ContinueCreateOperation continues a create operation given a resume token.

func (*ResourceDeploymentsClientImpl) CreateOrUpdate added in v0.43.0

func (client *ResourceDeploymentsClientImpl) CreateOrUpdate(ctx context.Context, parameters Deployment, resourceID, apiVersion string) (Poller[ClientCreateOrUpdateResponse], error)

CreateOrUpdate creates a request to create or update a deployment and returns a poller to track the progress of the operation.

func (*ResourceDeploymentsClientImpl) Delete added in v0.43.0

func (client *ResourceDeploymentsClientImpl) Delete(ctx context.Context, resourceID, apiVersion string) (Poller[ClientDeleteResponse], error)

Delete creates a request to delete a resource and returns a poller to track the progress of the operation.

type Value

type Value struct {
	Scope string `json:"scope,omitempty"`
}

Jump to

Keyboard shortcuts

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