organization

package
v0.8.0-beta.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIURL  = "https://cloudapi.apecloud.cn"
	APIPath = "api/v1"
)
View Source
const (
	CloudContextDir          = "cloud_context"
	CurrentOrgAndContextFile = "current.json"
	ContextFile              = "context.json"
)
View Source
const OrgAPIName = "organizations"

Variables

This section is empty.

Functions

func GetContextFilePath

func GetContextFilePath() (string, error)

func GetCurrentOrgAndContextFilePath

func GetCurrentOrgAndContextFilePath() (string, error)

func GetToken

func GetToken() (string, error)

func NewOrganizationCmd

func NewOrganizationCmd(streams genericiooptions.IOStreams) *cobra.Command

func NewRequest

func NewRequest(method, path, token string, requestBody []byte) ([]byte, error)

func SetCurrentOrgAndContext

func SetCurrentOrgAndContext(currentOrgAndContext *CurrentOrgAndContext) error

SetCurrentOrgAndContext TODO:Check whether the newly set context and org exist.

Types

type CloudOrganization

type CloudOrganization struct {
	Token   string
	APIURL  string
	APIPath string
}

func (*CloudOrganization) GetOrganizations

func (o *CloudOrganization) GetOrganizations() (*Organizations, error)

func (*CloudOrganization) IsValidOrganization

func (o *CloudOrganization) IsValidOrganization(name string) (bool, error)

type CurrentOrgAndContext

type CurrentOrgAndContext struct {
	CurrentOrganization string `json:"currentOrganization"`
	CurrentContext      string `json:"currentContext"`
}

func GetCurrentOrgAndContext

func GetCurrentOrgAndContext() (*CurrentOrgAndContext, error)

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

type OrgItem

type OrgItem struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Role        string `json:"role"`
	Description string `json:"description"`
	DisplayName string `json:"displayName"`
	CreatedAt   string `json:"createdAt"`
	UpdatedAt   string `json:"updatedAt"`
}

type Organization

type Organization interface {
	GetOrganizations() (*Organizations, error)

	IsValidOrganization(name string) (bool, error)
	// contains filtered or unexported methods
}

type OrganizationOption

type OrganizationOption struct {
	Name         string
	OutputFormat string
	Organization Organization

	genericiooptions.IOStreams
}

type Organizations

type Organizations struct {
	Items []OrgItem `json:"items"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL