Help us shape the future of Go! Take the 2026 Go Developer Survey

resource

package
v0.9.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HeaderWorkspace   = "workspace"
	HeaderContentType = "Content-Type"

	ApplicationJson = "application/json"
)

Variables

This section is empty.

Functions

func Delete

func Delete(client *golangsdk.ServiceClient, resourceId, workspace string) error

Delete is used to delete a resource. Send request DELETE /v1/{project_id}/resources/{resource_id}

func Update

func Update(client *golangsdk.ServiceClient, resourceId string, resource Resource) error

Update is used to modify a specific resource. When modifying the resource, specify the resource ID. The resource type and directory cannot be modified. Send request PUT /v1/{project_id}/resources/{resource_id}

Types

type CreateResp

type CreateResp struct {
	ResourceId string `json:"resourceId"`
}

func Create

func Create(client *golangsdk.ServiceClient, opts Resource) (*CreateResp, error)

Create is used to create a resource. Types of nodes, including DLI Spark, MRS Spark, and MRS MapReduce, can reference files such as JAR and properties through resources. Send request POST /v1/{project_id}/resources

type DependPackage

type DependPackage struct {
	// Type is a file type.
	Type string `json:"type,omitempty"`
	// Location is a file path.
	Location string `json:"location,omitempty"`
}

type ListOpts

type ListOpts struct {
	Offset       int    `q:"offset"`
	Limit        int    `q:"limit"`
	ResourceName string `q:"resourceName"`
}

type ListResp

type ListResp struct {
	// Total is the total number of resources.
	Total int `json:"total"`
	// Resources is a list of resources.
	Resources []*Resource `json:"resources"`
}

func List

func List(client *golangsdk.ServiceClient, opts *ListOpts, workspace string) (*ListResp, error)

List is used to query a resource list. During the query, you can specify the page number and the maximum number of records on each page. Send request GET /v1/{project_id}/resources?offset={offset}&limit={limit}&resourceName={resourceName}

type Resource

type Resource struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// Name is a name of the resource. The name contains a maximum of 32 characters, including only letters, numbers, underscores (_), and hyphens (-).
	Name string `json:"name" required:"true"`
	// Type is a resource type. Can be: archive, file, jar
	Type string `json:"type" required:"true"`
	// Location is an OBS path for storing the resource file. When type is set to jar, location is the path for storing the main JAR package. The path contains a maximum of 1,023 characters. For example, obs://myBucket/test.jar
	Location string `json:"location" required:"true"`
	// JAR package and properties file that the main JAR package depends on. The description contains a maximum of 10,240 characters. If this parameter and the dependFiles parameter are both available, this parameter is preferentially parsed.
	DependPackages []*DependPackage `json:"dependPackages,omitempty"`
	// DependFiles is a JAR package and properties file that the main JAR package depends on. The description contains a maximum of 10,240 characters.
	DependFiles []string `json:"dependFiles,omitempty"`
	// Description of the resource. The description contains a maximum of 255 characters.
	Desc string `json:"desc,omitempty"`
	// Directory for storing the resource. Access the DataArts Studio console and choose Data Development. The default directory is the root directory.
	Directory string `json:"directory,omitempty"`
}

func Get

func Get(client *golangsdk.ServiceClient, resourceId, workspace string) (*Resource, error)

Get is used to query resource details. A resource contains various files such as JAR, ZIP, and properties files. A created resource can be used in job nodes such as DLI Spark and MRS Spark. Send request GET /v1/{project_id}/resources/{resource_id}

Jump to

Keyboard shortcuts

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