resourcegroups

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (string, error)

Create creates a new resource group.

func Update

func Update(client *golangsdk.ServiceClient, groupId string, opts UpdateOpts) error

Update modifies a resource group.

Types

type BatchCreateResourcesOpts

type BatchCreateResourcesOpts struct {
	// Specifies the list of resources to add.
	// A maximum of 1000 resources can be added at a time.
	Resources []ResourceItem `json:"resources" required:"true"`
}

BatchCreateResourcesOpts contains the options for batch adding resources to a resource group.

type BatchCreateResourcesResponse

type BatchCreateResourcesResponse struct {
	// Specifies the number of resources that were added successfully.
	SucceedCount int `json:"succeed_count"`
}

BatchCreateResourcesResponse contains the response from the BatchCreateResources request.

func BatchCreateResources

func BatchCreateResources(client *golangsdk.ServiceClient, groupId string, opts BatchCreateResourcesOpts) (*BatchCreateResourcesResponse, error)

BatchCreateResources adds resources to a resource group in batches.

type BatchDeleteResourcesOpts

type BatchDeleteResourcesOpts struct {
	// Specifies the list of resources to delete.
	// A maximum of 1000 resources can be deleted at a time.
	Resources []ResourceItem `json:"resources" required:"true"`
}

BatchDeleteResourcesOpts contains the options for batch deleting resources from a resource group.

type BatchDeleteResourcesResponse

type BatchDeleteResourcesResponse struct {
	// Specifies the number of resources that were deleted successfully.
	SucceedCount int `json:"succeed_count"`
}

BatchDeleteResourcesResponse contains the response from the BatchDeleteResources request.

func BatchDeleteResources

func BatchDeleteResources(client *golangsdk.ServiceClient, groupId string, opts BatchDeleteResourcesOpts) (*BatchDeleteResourcesResponse, error)

BatchDeleteResources removes resources from a resource group in batches.

type CreateOpts

type CreateOpts struct {
	// Specifies the resource group name.
	// It can contain 1 to 128 characters and must start with a letter.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
	GroupName string `json:"group_name" required:"true"`
	// Specifies the enterprise project ID.
	// The value can be a UUID or "0".
	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
	// Specifies how resources are added to the resource group.
	// Possible values: EPS, TAG, Manual
	// Default: Manual
	Type string `json:"type,omitempty"`
	// Specifies the tags for dynamic resource matching.
	// This parameter is mandatory when type is set to TAG.
	// A maximum of 10 tags can be specified.
	Tags []ResourceGroupTag `json:"tags,omitempty"`
	// Specifies the enterprise project IDs for the EPS type.
	// This parameter is mandatory when type is set to EPS.
	// A maximum of 10 enterprise project IDs can be specified.
	AssociationEpIds []string `json:"association_ep_ids,omitempty"`
}

CreateOpts contains the options for creating a resource group.

type DeleteOpts

type DeleteOpts struct {
	// Specifies the list of resource group IDs to delete.
	// A maximum of 100 resource groups can be deleted at a time.
	GroupIds []string `json:"group_ids" required:"true"`
}

DeleteOpts contains the options for batch deleting resource groups.

type DeleteResponse

type DeleteResponse struct {
	// Specifies the list of deleted resource group IDs.
	GroupIds []string `json:"group_ids"`
}

DeleteResponse contains the response from the batch delete request.

func Delete

func Delete(client *golangsdk.ServiceClient, opts DeleteOpts) (*DeleteResponse, error)

Delete batch deletes resource groups.

type ListOpts

type ListOpts struct {
	// Specifies the enterprise project ID.
	// The value can be a UUID or "0".
	EnterpriseProjectId string `q:"enterprise_project_id"`
	// Specifies the resource group name. Fuzzy matching is supported.
	// It can contain 1 to 128 characters.
	GroupName string `q:"group_name"`
	// Specifies the resource group ID.
	// It contains 24 characters and starts with "rg".
	GroupId string `q:"group_id"`
	// Specifies the pagination offset.
	// Default: 0, Range: 0-10000
	Offset int `q:"offset,omitempty"`
	// Specifies the number of records on each page.
	// Default: 100, Range: 1-100
	Limit int `q:"limit,omitempty"`
	// Specifies how resources are added to the resource group.
	// Possible values: EPS, TAG, Manual
	Type string `q:"type"`
}

ListOpts contains the options for querying resource groups.

type ListResourcesOpts

type ListResourcesOpts struct {
	// Specifies the resource dimension.
	// Multiple dimensions are separated by commas and sorted alphabetically.
	DimName string `q:"dim_name"`
	// Specifies the resource dimension value.
	// Fuzzy matching is not supported.
	// It can contain 1 to 256 characters.
	DimValue string `q:"dim_value"`
	// Specifies the resource health status.
	// Possible values: health, unhealthy, no_alarm_rule
	Status string `q:"status"`
	// Specifies the number of records on each page.
	// Default: 100, Range: 1-1000
	Limit int `q:"limit,omitempty"`
	// Specifies the pagination offset.
	// Default: 0, Range: 0-10000
	Offset int `q:"offset,omitempty"`
	// Specifies the enterprise project ID.
	ExtendRelationId string `q:"extend_relation_id"`
}

ListResourcesOpts contains the options for querying resources in a resource group.

type ListResourcesResponse

type ListResourcesResponse struct {
	// Specifies the total number of resources.
	Count int `json:"count"`
	// Specifies the list of resources.
	Resources []ResourceInfo `json:"resources"`
}

ListResourcesResponse contains the response from the ListResources request.

func ListResources

func ListResources(client *golangsdk.ServiceClient, groupId string, service string, opts ListResourcesOpts) (*ListResourcesResponse, error)

ListResources returns a list of resources for a specified service type in a resource group.

type ListResponse

type ListResponse struct {
	// Specifies the total number of resource groups.
	Count int `json:"count"`
	// Specifies the list of resource groups.
	ResourceGroups []ResourceGroup `json:"resource_groups"`
}

ListResponse contains the response from the List request.

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) (*ListResponse, error)

List returns a list of resource groups.

type ResourceDimension

type ResourceDimension struct {
	// Specifies the dimension name.
	// It can contain 1 to 32 characters.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
	Name string `json:"name" required:"true"`
	// Specifies the dimension value, which is the resource instance ID.
	// It can contain 1 to 256 characters.
	Value string `json:"value" required:"true"`
}

ResourceDimension represents a resource dimension.

type ResourceGroup

type ResourceGroup struct {
	// Specifies the resource group name.
	GroupName string `json:"group_name"`
	// Specifies the resource group ID.
	GroupId string `json:"group_id"`
	// Specifies the time when the resource group was created.
	// The value is in UTC format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
	CreateTime string `json:"create_time"`
	// Specifies the enterprise project ID.
	EnterpriseProjectId string `json:"enterprise_project_id"`
	// Specifies how resources are added to the resource group.
	// Possible values: EPS, TAG, Manual
	Type string `json:"type"`
}

ResourceGroup represents a resource group in the list response.

type ResourceGroupDetail

type ResourceGroupDetail struct {
	// Specifies the resource group name.
	GroupName string `json:"group_name"`
	// Specifies the resource group ID.
	GroupId string `json:"group_id"`
	// Specifies the time when the resource group was created.
	// The value is in UTC format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
	CreateTime string `json:"create_time"`
	// Specifies the enterprise project ID.
	EnterpriseProjectId string `json:"enterprise_project_id"`
	// Specifies how resources are added to the resource group.
	// Possible values: EPS, TAG, Manual
	Type string `json:"type"`
	// Specifies the enterprise project IDs for the EPS type.
	AssociationEpIds []string `json:"association_ep_ids"`
	// Specifies the tags for dynamic resource matching.
	Tags []ResourceGroupTag `json:"tags"`
}

ResourceGroupDetail represents the detailed information of a resource group.

func Get

func Get(client *golangsdk.ServiceClient, groupId string) (*ResourceGroupDetail, error)

Get retrieves details of a resource group.

type ResourceGroupTag

type ResourceGroupTag struct {
	// Specifies the tag key.
	// It can contain 1 to 36 characters.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
	Key string `json:"key" required:"true"`
	// Specifies the tag value.
	// It can contain 0 to 43 characters.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
	Value string `json:"value,omitempty"`
}

ResourceGroupTag represents a tag for dynamic resource matching.

type ResourceInfo

type ResourceInfo struct {
	// Specifies the resource health status.
	// Possible values: health, unhealthy, no_alarm_rule
	Status string `json:"status"`
	// Specifies the resource dimension information.
	Dimensions []ResourceDimension `json:"dimensions"`
}

ResourceInfo represents a resource in the list response.

type ResourceItem

type ResourceItem struct {
	// Specifies the namespace of a service.
	// The value must be in the service.item format and can contain 3 to 32 characters.
	// service and item must start with a letter and contain only letters, digits, and underscores (_).
	Namespace string `json:"namespace" required:"true"`
	// Specifies the resource dimension information.
	// A maximum of 4 dimensions can be specified.
	Dimensions []ResourceDimension `json:"dimensions" required:"true"`
}

ResourceItem represents a resource to be added to or deleted from a resource group.

type UpdateOpts

type UpdateOpts struct {
	// Specifies the resource group name.
	// It can contain 1 to 128 characters.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
	GroupName string `json:"group_name" required:"true"`
	// Specifies the tags for dynamic resource matching.
	// This parameter is used when the resource group type is TAG.
	// A maximum of 10 tags can be specified.
	Tags []ResourceGroupTag `json:"tags,omitempty"`
}

UpdateOpts contains the options for modifying a resource group.

Jump to

Keyboard shortcuts

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