@@ -83,7 +83,7 @@ type CreateEnvironmentRequest struct {
83
83
// CreateEnvironment sends a request to create an environment.
84
84
func (c Client ) CreateEnvironment (ctx context.Context , orgID string , req CreateEnvironmentRequest ) (* Environment , error ) {
85
85
var env Environment
86
- if err := c .requestBody (ctx , http .MethodPost , "/api/orgs/" + orgID + "/environments" , req , & env ); err != nil {
86
+ if err := c .requestBody (ctx , http .MethodPost , "/api/private/ orgs/" + orgID + "/environments" , req , & env ); err != nil {
87
87
return nil , err
88
88
}
89
89
return & env , nil
@@ -93,7 +93,7 @@ func (c Client) CreateEnvironment(ctx context.Context, orgID string, req CreateE
93
93
// TODO: add the filter options, explore performance issue.
94
94
func (c Client ) Environments (ctx context.Context ) ([]Environment , error ) {
95
95
var envs []Environment
96
- if err := c .requestBody (ctx , http .MethodGet , "/api/environments" , nil , & envs ); err != nil {
96
+ if err := c .requestBody (ctx , http .MethodGet , "/api/private/ environments" , nil , & envs ); err != nil {
97
97
return nil , err
98
98
}
99
99
return envs , nil
@@ -102,20 +102,20 @@ func (c Client) Environments(ctx context.Context) ([]Environment, error) {
102
102
// EnvironmentsByOrganization gets the list of environments owned by the given user.
103
103
func (c Client ) EnvironmentsByOrganization (ctx context.Context , userID , orgID string ) ([]Environment , error ) {
104
104
var envs []Environment
105
- if err := c .requestBody (ctx , http .MethodGet , "/api/orgs/" + orgID + "/members/" + userID + "/environments" , nil , & envs ); err != nil {
105
+ if err := c .requestBody (ctx , http .MethodGet , "/api/private/ orgs/" + orgID + "/members/" + userID + "/environments" , nil , & envs ); err != nil {
106
106
return nil , err
107
107
}
108
108
return envs , nil
109
109
}
110
110
111
111
// DeleteEnvironment deletes the environment.
112
112
func (c Client ) DeleteEnvironment (ctx context.Context , envID string ) error {
113
- return c .requestBody (ctx , http .MethodDelete , "/api/environments/" + envID , nil , nil )
113
+ return c .requestBody (ctx , http .MethodDelete , "/api/private/ environments/" + envID , nil , nil )
114
114
}
115
115
116
116
// StopEnvironment stops the stops.
117
117
func (c Client ) StopEnvironment (ctx context.Context , envID string ) error {
118
- return c .requestBody (ctx , http .MethodPut , "/api/environments/" + envID + "/stop" , nil , nil )
118
+ return c .requestBody (ctx , http .MethodPut , "/api/private/ environments/" + envID + "/stop" , nil , nil )
119
119
}
120
120
121
121
// UpdateEnvironmentReq defines the update operation, only setting
@@ -133,12 +133,12 @@ type UpdateEnvironmentReq struct {
133
133
134
134
// RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification.
135
135
func (c Client ) RebuildEnvironment (ctx context.Context , envID string ) error {
136
- return c .requestBody (ctx , http .MethodPatch , "/api/environments/" + envID , UpdateEnvironmentReq {}, nil )
136
+ return c .requestBody (ctx , http .MethodPatch , "/api/private/ environments/" + envID , UpdateEnvironmentReq {}, nil )
137
137
}
138
138
139
139
// EditEnvironment modifies the environment specification and initiates a rebuild.
140
140
func (c Client ) EditEnvironment (ctx context.Context , envID string , req UpdateEnvironmentReq ) error {
141
- return c .requestBody (ctx , http .MethodPatch , "/api/environments/" + envID , req , nil )
141
+ return c .requestBody (ctx , http .MethodPatch , "/api/private/ environments/" + envID , req , nil )
142
142
}
143
143
144
144
// DialWsep dials an environments command execution interface
@@ -163,7 +163,7 @@ func (c Client) DialIDEStatus(ctx context.Context, envID string) (*websocket.Con
163
163
164
164
// DialEnvironmentBuildLog opens a websocket connection for the environment build log messages.
165
165
func (c Client ) DialEnvironmentBuildLog (ctx context.Context , envID string ) (* websocket.Conn , error ) {
166
- return c .dialWebsocket (ctx , "/api/environments/" + envID + "/watch-update" )
166
+ return c .dialWebsocket (ctx , "/api/private/ environments/" + envID + "/watch-update" )
167
167
}
168
168
169
169
// BuildLog defines a build log record for a Coder environment.
@@ -211,12 +211,12 @@ func (c Client) FollowEnvironmentBuildLog(ctx context.Context, envID string) (<-
211
211
212
212
// DialEnvironmentStats opens a websocket connection for environment stats.
213
213
func (c Client ) DialEnvironmentStats (ctx context.Context , envID string ) (* websocket.Conn , error ) {
214
- return c .dialWebsocket (ctx , "/api/environments/" + envID + "/watch-stats" )
214
+ return c .dialWebsocket (ctx , "/api/private/ environments/" + envID + "/watch-stats" )
215
215
}
216
216
217
217
// DialResourceLoad opens a websocket connection for cpu load metrics on the environment.
218
218
func (c Client ) DialResourceLoad (ctx context.Context , envID string ) (* websocket.Conn , error ) {
219
- return c .dialWebsocket (ctx , "/api/environments/" + envID + "/watch-resource-load" )
219
+ return c .dialWebsocket (ctx , "/api/private/ environments/" + envID + "/watch-resource-load" )
220
220
}
221
221
222
222
// BuildLogType describes the type of an event.
0 commit comments