From 03ac6ec7741320cc1c76a5c6f51b08131971a206 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Wed, 5 Dec 2018 11:46:37 +0100 Subject: [PATCH] go-mod: update the `go-tfe` dependency --- go.mod | 2 +- go.sum | 4 +-- .../hashicorp/go-tfe/organization.go | 35 +++++++++++++++++++ vendor/modules.txt | 2 +- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 5583980ab..d6e59f54d 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 github.com/hashicorp/go-safetemp v0.0.0-20180326211150-b1a1dbde6fdc // indirect github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect - github.com/hashicorp/go-tfe v0.3.3 + github.com/hashicorp/go-tfe v0.3.4 github.com/hashicorp/go-uuid v1.0.0 github.com/hashicorp/go-version v0.0.0-20180322230233-23480c066577 github.com/hashicorp/golang-lru v0.5.0 // indirect diff --git a/go.sum b/go.sum index 388bf860d..eb59ab484 100644 --- a/go.sum +++ b/go.sum @@ -152,8 +152,8 @@ github.com/hashicorp/go-slug v0.2.0 h1:gekvezBc+9LwN3qC+lesrz0Qg36hhgge9z/an1FCH github.com/hashicorp/go-slug v0.2.0/go.mod h1:+zDycQOzGqOqMW7Kn2fp9vz/NtqpMLQlgb9JUF+0km4= github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 h1:7YOlAIO2YWnJZkQp7B5eFykaIY7C9JndqAFQyVV5BhM= github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-tfe v0.3.3 h1:v17u0VdSy54n6Xn575cTzLrNJ0gn+Y7mq5J+A/p1fkw= -github.com/hashicorp/go-tfe v0.3.3/go.mod h1:Vssg8/lwVz+PyJ/nAK97zYmXxxLe28MCIMhKo+rva1o= +github.com/hashicorp/go-tfe v0.3.4 h1:A9pKjZMDTSGozXf2wQlWhBI7QoxCoas14Xg/TSiEAV8= +github.com/hashicorp/go-tfe v0.3.4/go.mod h1:Vssg8/lwVz+PyJ/nAK97zYmXxxLe28MCIMhKo+rva1o= github.com/hashicorp/go-uuid v1.0.0 h1:RS8zrF7PhGwyNPOtxSClXXj9HA8feRnJzgnI1RJCSnM= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v0.0.0-20180322230233-23480c066577 h1:at4+18LrM8myamuV7/vT6x2s1JNXp2k4PsSbt4I02X4= diff --git a/vendor/github.com/hashicorp/go-tfe/organization.go b/vendor/github.com/hashicorp/go-tfe/organization.go index 32e289ed6..edd6d3f47 100644 --- a/vendor/github.com/hashicorp/go-tfe/organization.go +++ b/vendor/github.com/hashicorp/go-tfe/organization.go @@ -35,6 +35,9 @@ type Organizations interface { // Capacity shows the current run capacity of an organization. Capacity(ctx context.Context, organization string) (*Capacity, error) + // Entitlements shows the entitlements of an organization. + Entitlements(ctx context.Context, organization string) (*Entitlements, error) + // RunQueue shows the current run queue of an organization. RunQueue(ctx context.Context, organization string, options RunQueueOptions) (*RunQueue, error) } @@ -93,6 +96,17 @@ type Capacity struct { Running int `jsonapi:"attr,running"` } +// Entitlements represents the entitlements of an organization. +type Entitlements struct { + ID string `jsonapi:"primary,entitlement-sets"` + StateStorage bool `jsonapi:"attr,state-storage"` + Operations bool `jsonapi:"attr,operations"` + VCSIntegrations bool `jsonapi:"attr,vcs-integrations"` + Sentinel bool `jsonapi:"attr,sentinel"` + PrivateModuleRegistry bool `jsonapi:"attr,private-module-registry"` + Teams bool `jsonapi:"attr,teams"` +} + // RunQueue represents the current run queue of an organization. type RunQueue struct { *Pagination @@ -283,6 +297,27 @@ func (s *organizations) Capacity(ctx context.Context, organization string) (*Cap return c, nil } +// Entitlements shows the entitlements of an organization. +func (s *organizations) Entitlements(ctx context.Context, organization string) (*Entitlements, error) { + if !validStringID(&organization) { + return nil, errors.New("invalid value for organization") + } + + u := fmt.Sprintf("organizations/%s/entitlement-set", url.QueryEscape(organization)) + req, err := s.client.newRequest("GET", u, nil) + if err != nil { + return nil, err + } + + e := &Entitlements{} + err = s.client.do(ctx, req, e) + if err != nil { + return nil, err + } + + return e, nil +} + // RunQueueOptions represents the options for showing the queue. type RunQueueOptions struct { ListOptions diff --git a/vendor/modules.txt b/vendor/modules.txt index 2ffc1e33f..e904726ad 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -326,7 +326,7 @@ github.com/hashicorp/go-rootcerts github.com/hashicorp/go-safetemp # github.com/hashicorp/go-slug v0.2.0 github.com/hashicorp/go-slug -# github.com/hashicorp/go-tfe v0.3.3 +# github.com/hashicorp/go-tfe v0.3.4 github.com/hashicorp/go-tfe # github.com/hashicorp/go-uuid v1.0.0 github.com/hashicorp/go-uuid