Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitcf6e030

Browse files
authored
feat: add coder-sdk methods for resource-pools (#215)
* feat: add coder-sdk methods for multi-cluster* fixup! feat: add coder-sdk methods for multi-cluster* fixup! feat: add coder-sdk methods for multi-cluster
1 parente516b8c commitcf6e030

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

‎coder-sdk/env.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type Environment struct {
3434
AutoOffThresholdDuration`json:"auto_off_threshold" table:"-"`
3535
SSHAvailablebool`json:"ssh_available" table:"-"`
3636
UseContainerVMbool`json:"use_container_vm" table:"CVM"`
37+
ResourcePoolIDstring`json:"resource_pool_id" table:"-"`
3738
}
3839

3940
// RebuildMessage defines the message shown when an Environment requires a rebuild for it can be accessed.

‎coder-sdk/resourcepools.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package coder
2+
3+
import (
4+
"context"
5+
"net/http"
6+
)
7+
8+
// ResourcePool defines an entity capable of deploying and acting as an ingress for Coder environments.
9+
typeResourcePoolstruct {
10+
IDstring`json:"id"`
11+
Namestring`json:"name"`
12+
Localbool`json:"local"`
13+
ClusterAddressstring`json:"cluster_address"`
14+
DefaultNamespacestring`json:"default_namespace"`
15+
StorageClassstring`json:"storage_class"`
16+
ClusterDomainSuffixstring`json:"cluster_domain_suffix"`
17+
DevurlHoststring`json:"devurl_host"`
18+
NamespaceWhitelist []string`json:"namespace_whitelist"`
19+
OrgWhitelist []string`json:"org_whitelist"`
20+
}
21+
22+
// ResourcePoolByID fetches a resource pool entity by its unique ID.
23+
func (c*Client)ResourcePoolByID(ctx context.Context,idstring) (*ResourcePool,error) {
24+
varrpResourcePool
25+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/resource-pools/"+id,nil,&rp);err!=nil {
26+
returnnil,err
27+
}
28+
return&rp,nil
29+
}
30+
31+
// DeleteResourcePoolByID deletes a resource pool entity from the Coder control plane.
32+
func (c*Client)DeleteResourcePoolByID(ctx context.Context,idstring)error {
33+
returnc.requestBody(ctx,http.MethodDelete,"/api/private/resource-pools/"+id,nil,nil)
34+
}
35+
36+
// ResourcePools fetches all resource pools known to the Coder control plane.
37+
func (c*Client)ResourcePools(ctx context.Context) ([]ResourcePool,error) {
38+
varpools []ResourcePool
39+
iferr:=c.requestBody(ctx,http.MethodGet,"/api/private/resource-pools",nil,&pools);err!=nil {
40+
returnnil,err
41+
}
42+
returnpools,nil
43+
}
44+
45+
// CreateResourcePoolReq defines the request parameters for creating a new resource pool entity.
46+
typeCreateResourcePoolReqstruct {
47+
Namestring`json:"name"`
48+
Localbool`json:"local"`
49+
ClusterCAstring`json:"cluster_ca"`
50+
ClusterAddressstring`json:"cluster_address"`
51+
SATokenstring`json:"sa_token"`
52+
DefaultNamespacestring`json:"default_namespace"`
53+
StorageClassstring`json:"storage_class"`
54+
ClusterDomainSuffixstring`json:"cluster_domain_suffix"`
55+
DevurlHoststring`json:"devurl_host"`
56+
NamespaceWhitelist []string`json:"namespace_whitelist"`
57+
OrgWhitelist []string`json:"org_whitelist"`
58+
}
59+
60+
// CreateResourcePool creates a new ResourcePool entity.
61+
func (c*Client)CreateResourcePool(ctx context.Context,reqCreateResourcePoolReq)error {
62+
returnc.requestBody(ctx,http.MethodPost,"/api/private/resource-pools",req,nil)
63+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp