Documentation
¶
Overview ¶
Package tokens provides the ability to create tokens through the Resell v2 API.
Example of creating a project-scoped token
createOpts := tokens.TokenOpts{
ProjectID: "f628616b452f4052b191161c26abba91",
}
token, err := tokens.Create(ctx, resellClient, createOpts)
if err != nil {
log.Fatal(err)
}
fmt.Println(token.ID)
Example of creating a domain-scoped token
createOpts := tokens.TokenOpts{
AccountName: "1122334455",
}
token, err := tokens.Create(ctx, resellClient, createOpts)
if err != nil {
log.Fatal(err)
}
fmt.Println(token.ID)
Example of deleting a token
_, err = tokens.Delete(context, resellClient, token.ID)
if err != nil {
log.Fatal(err)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶ added in v1.9.0
func Delete(ctx context.Context, client *selvpcclient.ServiceClient, id string) (*selvpcclient.ResponseResult, error)
Delete a user owned Identity token by its id.
Types ¶
type Token ¶
type Token struct {
// ID contains and Identity token id and can be used to requests calls against
// the different OpenStack services.
ID string `json:"id"`
}
Token represent a single Identity service token.
func Create ¶
func Create(ctx context.Context, client *selvpcclient.ServiceClient, createOpts TokenOpts) (*Token, *selvpcclient.ResponseResult, error)
Create requests a creation of the Identity token.
type TokenOpts ¶
type TokenOpts struct {
// ProjectID can be used to create a project-scoped Identity token.
ProjectID string `json:"project_id,omitempty"`
// AccountName can be used to create a domain-scoped Identity token.
AccountName string `json:"account_name,omitempty"`
}
TokenOpts represents options to create a new Identity token.
Click to show internal directories.
Click to hide internal directories.