(TokensV1)
- GetOrgTokens - GetOrgTokens
- CreateOrgToken - CreateOrgToken
- RevokeOrgToken - RevokeOrgToken
List all organization tokens for a given org.
package main
import(
"context"
"hathoracloud"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.TokensV1.GetOrgTokens(ctx, "org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
orgID |
string | ✔️ | N/A | org-6f706e83-0ec1-437a-9a46-7d4281eb2f39 |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.ListOrgTokens, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 401, 404, 429 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Create a new organization token.
package main
import(
"context"
"hathoracloud"
"hathoracloud/models/components"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.TokensV1.CreateOrgToken(ctx, "org-6f706e83-0ec1-437a-9a46-7d4281eb2f39", components.CreateOrgToken{
Name: "ci-token",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
orgID |
string | ✔️ | N/A | org-6f706e83-0ec1-437a-9a46-7d4281eb2f39 |
createOrgToken |
components.CreateOrgToken | ✔️ | N/A | |
opts |
[]operations.Option | ➖ | The options for this request. |
*components.CreatedOrgToken, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 401, 404, 422, 429 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Revoke an organization token.
package main
import(
"context"
"hathoracloud"
"log"
)
func main() {
ctx := context.Background()
s := hathoracloud.New(
hathoracloud.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
)
res, err := s.TokensV1.RevokeOrgToken(ctx, "org-6f706e83-0ec1-437a-9a46-7d4281eb2f39", "org-token-af469a92-5b45-4565-b3c4-b79878de67d2")
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
orgID |
string | ✔️ | N/A | org-6f706e83-0ec1-437a-9a46-7d4281eb2f39 |
orgTokenID |
string | ✔️ | N/A | org-token-af469a92-5b45-4565-b3c4-b79878de67d2 |
opts |
[]operations.Option | ➖ | The options for this request. |
*bool, error
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 401, 404, 429 | application/json |
errors.SDKError | 4XX, 5XX | */* |