Skip to content

Commit

Permalink
NKS-1892 Add subscription information to user profile (#16)
Browse files Browse the repository at this point in the history
* NKS-1892 Add subscription information to user profile

We need to perform a pre-flight check when HCI users enable NKS on HCI. If their subscription is not active we want to fail fast.
  • Loading branch information
sverrirsig committed Aug 20, 2019
1 parent 0279f69 commit 2dc0c6d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions nks/userprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import "fmt"

// UserProfile struct
type UserProfile struct {
ID int `json:"pk"`
Username string `json:"username"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
FullName string `json:"full_name"`
OrgMems []OrgMembership `json:"org_memberships"`
Keysets []Keyset `json:"keysets"`
ID int `json:"pk"`
Username string `json:"username"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
FullName string `json:"full_name"`
OrgMems []OrgMembership `json:"org_memberships"`
Keysets []Keyset `json:"keysets"`
Subscription Subscription `json:"subscription"`
}

type OrgMembership struct {
Expand All @@ -24,6 +25,12 @@ type OrgMembership struct {
IsDefault bool `json:"is_default"`
}

type Subscription struct {
ID int `json:"pk"`
State string `json:"state"`
IsActive bool `json:"is_active"`
}

// GetUserProfile gets user profile for user (based on API token)
func (c *APIClient) GetUserProfile() (up []UserProfile, err error) {
req := &APIReq{
Expand Down

0 comments on commit 2dc0c6d

Please sign in to comment.