Skip to content

Commit

Permalink
Updating to 4.16.1 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjumani authored Apr 22, 2022
1 parent ac35fe8 commit c2b1969
Show file tree
Hide file tree
Showing 35 changed files with 65,394 additions and 55,576 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ endif
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

all: code mock-gen test
all: code mocks test

code:
go run generate/generate.go generate/layout.go --api=generate/listApis.json

FILES=$(shell for file in `pwd`/cloudstack/*Service.go ;do basename $$file .go ; done)
mock-gen:
mocks:
@for f in $(FILES); do \
$(MOCKGEN) -destination=./cloudstack/$${f}_mock.go -package=cloudstack -copyright_file="header.txt" -source=./cloudstack/$${f}.go ; \
done

test:
go test -v ./...
go test -v github.com/apache/cloudstack-go/v2/test

MOCKGEN := $(shell pwd)/bin/mockgen
mockgen: ## Download conversion-gen locally if necessary.
Expand Down
247 changes: 0 additions & 247 deletions cloudstack/AccountService.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ import (
)

type AccountServiceIface interface {
AddAccountToProject(p *AddAccountToProjectParams) (*AddAccountToProjectResponse, error)
NewAddAccountToProjectParams(projectid string) *AddAccountToProjectParams
CreateAccount(p *CreateAccountParams) (*CreateAccountResponse, error)
NewCreateAccountParams(email string, firstname string, lastname string, password string, username string) *CreateAccountParams
DeleteAccount(p *DeleteAccountParams) (*DeleteAccountResponse, error)
NewDeleteAccountParams(id string) *DeleteAccountParams
DeleteAccountFromProject(p *DeleteAccountFromProjectParams) (*DeleteAccountFromProjectResponse, error)
NewDeleteAccountFromProjectParams(account string, projectid string) *DeleteAccountFromProjectParams
DisableAccount(p *DisableAccountParams) (*DisableAccountResponse, error)
NewDisableAccountParams(lock bool) *DisableAccountParams
EnableAccount(p *EnableAccountParams) (*EnableAccountResponse, error)
Expand All @@ -58,154 +54,6 @@ type AccountServiceIface interface {
NewUpdateAccountParams() *UpdateAccountParams
}

type AddAccountToProjectParams struct {
p map[string]interface{}
}

func (p *AddAccountToProjectParams) toURLValues() url.Values {
u := url.Values{}
if p.p == nil {
return u
}
if v, found := p.p["account"]; found {
u.Set("account", v.(string))
}
if v, found := p.p["email"]; found {
u.Set("email", v.(string))
}
if v, found := p.p["projectid"]; found {
u.Set("projectid", v.(string))
}
if v, found := p.p["projectroleid"]; found {
u.Set("projectroleid", v.(string))
}
if v, found := p.p["roletype"]; found {
u.Set("roletype", v.(string))
}
return u
}

func (p *AddAccountToProjectParams) SetAccount(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["account"] = v
}

func (p *AddAccountToProjectParams) GetAccount() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["account"].(string)
return value, ok
}

func (p *AddAccountToProjectParams) SetEmail(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["email"] = v
}

func (p *AddAccountToProjectParams) GetEmail() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["email"].(string)
return value, ok
}

func (p *AddAccountToProjectParams) SetProjectid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["projectid"] = v
}

func (p *AddAccountToProjectParams) GetProjectid() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["projectid"].(string)
return value, ok
}

func (p *AddAccountToProjectParams) SetProjectroleid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["projectroleid"] = v
}

func (p *AddAccountToProjectParams) GetProjectroleid() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["projectroleid"].(string)
return value, ok
}

func (p *AddAccountToProjectParams) SetRoletype(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["roletype"] = v
}

func (p *AddAccountToProjectParams) GetRoletype() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["roletype"].(string)
return value, ok
}

// You should always use this function to get a new AddAccountToProjectParams instance,
// as then you are sure you have configured all required params
func (s *AccountService) NewAddAccountToProjectParams(projectid string) *AddAccountToProjectParams {
p := &AddAccountToProjectParams{}
p.p = make(map[string]interface{})
p.p["projectid"] = projectid
return p
}

// Adds account to a project
func (s *AccountService) AddAccountToProject(p *AddAccountToProjectParams) (*AddAccountToProjectResponse, error) {
resp, err := s.cs.newRequest("addAccountToProject", p.toURLValues())
if err != nil {
return nil, err
}

var r AddAccountToProjectResponse
if err := json.Unmarshal(resp, &r); err != nil {
return nil, err
}

// If we have a async client, we need to wait for the async result
if s.cs.async {
b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
if err != nil {
if err == AsyncTimeoutErr {
return &r, err
}
return nil, err
}

if err := json.Unmarshal(b, &r); err != nil {
return nil, err
}
}

return &r, nil
}

type AddAccountToProjectResponse struct {
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

type CreateAccountParams struct {
p map[string]interface{}
}
Expand Down Expand Up @@ -672,101 +520,6 @@ type DeleteAccountResponse struct {
Success bool `json:"success"`
}

type DeleteAccountFromProjectParams struct {
p map[string]interface{}
}

func (p *DeleteAccountFromProjectParams) toURLValues() url.Values {
u := url.Values{}
if p.p == nil {
return u
}
if v, found := p.p["account"]; found {
u.Set("account", v.(string))
}
if v, found := p.p["projectid"]; found {
u.Set("projectid", v.(string))
}
return u
}

func (p *DeleteAccountFromProjectParams) SetAccount(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["account"] = v
}

func (p *DeleteAccountFromProjectParams) GetAccount() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["account"].(string)
return value, ok
}

func (p *DeleteAccountFromProjectParams) SetProjectid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["projectid"] = v
}

func (p *DeleteAccountFromProjectParams) GetProjectid() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["projectid"].(string)
return value, ok
}

// You should always use this function to get a new DeleteAccountFromProjectParams instance,
// as then you are sure you have configured all required params
func (s *AccountService) NewDeleteAccountFromProjectParams(account string, projectid string) *DeleteAccountFromProjectParams {
p := &DeleteAccountFromProjectParams{}
p.p = make(map[string]interface{})
p.p["account"] = account
p.p["projectid"] = projectid
return p
}

// Deletes account from the project
func (s *AccountService) DeleteAccountFromProject(p *DeleteAccountFromProjectParams) (*DeleteAccountFromProjectResponse, error) {
resp, err := s.cs.newRequest("deleteAccountFromProject", p.toURLValues())
if err != nil {
return nil, err
}

var r DeleteAccountFromProjectResponse
if err := json.Unmarshal(resp, &r); err != nil {
return nil, err
}

// If we have a async client, we need to wait for the async result
if s.cs.async {
b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
if err != nil {
if err == AsyncTimeoutErr {
return &r, err
}
return nil, err
}

if err := json.Unmarshal(b, &r); err != nil {
return nil, err
}
}

return &r, nil
}

type DeleteAccountFromProjectResponse struct {
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

type DisableAccountParams struct {
p map[string]interface{}
}
Expand Down
58 changes: 0 additions & 58 deletions cloudstack/AccountService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2b1969

Please sign in to comment.