go-selvpcclient: github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens Index | Files | Directories

package tokens

import "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/tokens"

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{
  DomainName: "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

Package Files

doc.go requests.go requests_opts.go schemas.go

func Delete Uses

func Delete(ctx context.Context, client *selvpcclient.ServiceClient, id string) (*selvpcclient.ResponseResult, error)

Delete a user owned Identity token by its id.

type Token Uses

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 Uses

func Create(ctx context.Context, client *selvpcclient.ServiceClient, createOpts TokenOpts) (*Token, *selvpcclient.ResponseResult, error)

Create requests a creation of the Identity token.

type TokenOpts Uses

type TokenOpts struct {
    // ProjectID can be used to create a project-scoped Identity token.
    ProjectID string `json:"project_id,omitempty"`

    // DomainName can be used to create a domain-scoped Identity token.
    DomainName string `json:"domain_name,omitempty"`
}

TokenOpts represents options to create a new Identity token.

Directories

PathSynopsis
testing

Package tokens imports 6 packages (graph) and is imported by 1 packages. Updated 2019-10-17. Refresh now. Tools for package owners.