client

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Large = ccv3.Query{
	Key:    ccv3.PerPage,
	Values: []string{"5000"},
}

Functions

func QueriesToQueryString added in v0.53.1

func QueriesToQueryString(queries []ccv3.Query) string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string, ccv3Client *ccv3.Client, accessToken string, apiUrl string, transport *http.Transport) *Client

func (*Client) AddSecGroupRelationShips added in v0.31.0

func (c *Client) AddSecGroupRelationShips(secGroup *SecurityGroup) error

func (*Client) BindRunningSecGroupToSpace

func (c *Client) BindRunningSecGroupToSpace(secGroupGUID, spaceGUID string, endpoint string) error

func (*Client) BindSecurityGroup

func (c *Client) BindSecurityGroup(secGroupGUID, spaceGUID string, endpoint string) error

func (*Client) BindStagingSecGroupToSpace

func (c *Client) BindStagingSecGroupToSpace(secGroupGUID, spaceGUID string, endpoint string) error

func (*Client) CleanSecGroupEntitlements added in v0.68.0

func (c *Client) CleanSecGroupEntitlements() ([]model.EntitlementSecGroup, error)

func (*Client) CurrentUserIsAdmin

func (c *Client) CurrentUserIsAdmin() (bool, error)

func (*Client) EntitleSecurityGroup

func (c *Client) EntitleSecurityGroup(secGroupGUID, orgGUID string) error

func (*Client) GetAccessToken

func (c *Client) GetAccessToken() *string

func (*Client) GetApiUrl

func (c *Client) GetApiUrl() string

func (*Client) GetEndpoint

func (c *Client) GetEndpoint() string

func (*Client) GetOrgByGuid

func (c *Client) GetOrgByGuid(guid string) (Organization, error)

func (*Client) GetOrgManagedUserRoles added in v0.37.0

func (c *Client) GetOrgManagedUserRoles(userGuid string, page int) (UserRoles, error)

func (*Client) GetOrgManagers added in v0.31.0

func (c *Client) GetOrgManagers(orgGuid string, page int) (User, error)

func (*Client) GetOrganizations added in v0.37.0

func (c *Client) GetOrganizations(queries []ccv3.Query, page int) (Organizations, error)

func (*Client) GetRoles added in v0.37.0

func (c *Client) GetRoles(queries []ccv3.Query, page int) (UserRoles, error)

func (*Client) GetSecGroupByGuid

func (c *Client) GetSecGroupByGuid(guid string) (SecurityGroup, error)

func (*Client) GetSecGroupByName

func (c *Client) GetSecGroupByName(name string) (SecurityGroup, error)

func (*Client) GetSecGroupEntitlements added in v0.31.0

func (c *Client) GetSecGroupEntitlements() ([]model.EntitlementSecGroup, error)

func (*Client) GetSecGroupSpaces added in v0.29.0

func (c *Client) GetSecGroupSpaces(secGroup *SecurityGroup) (Spaces, error)

func (*Client) GetSecGroups added in v0.31.0

func (c *Client) GetSecGroups(queries []ccv3.Query, page int) (SecurityGroups, error)

func (*Client) GetSpaceByGuid

func (c *Client) GetSpaceByGuid(guid string) (Space, error)

func (*Client) GetSpaces added in v0.37.0

func (c *Client) GetSpaces(queries []ccv3.Query, page int) (Spaces, error)

func (*Client) GetSpacesWithOrg added in v0.31.0

func (c *Client) GetSpacesWithOrg(queries []ccv3.Query, page int) (Spaces, error)

func (*Client) GetTransport

func (c *Client) GetTransport() http.Transport

func (*Client) GetUserManagedSpacesAndOrgs added in v0.37.0

func (c *Client) GetUserManagedSpacesAndOrgs(userGUID string) ([]Space, []resources.Organization, error)

func (*Client) RevokeSecurityGroup

func (c *Client) RevokeSecurityGroup(secGroupGUID, orgGUID string) error

func (*Client) SetAccessToken

func (c *Client) SetAccessToken(accessToken string)

func (*Client) UnBindRunningSecGroupToSpace

func (c *Client) UnBindRunningSecGroupToSpace(secGroupGUID, spaceGUID string, endpoint string) error

func (*Client) UnBindSecurityGroup

func (c *Client) UnBindSecurityGroup(secGroupGUID, spaceGUID string, endpoint string) error

func (*Client) UnBindStagingSecGroupToSpace

func (c *Client) UnBindStagingSecGroupToSpace(secGroupGUID, spaceGUID string, endpoint string) error

type CloudFoundryError

type CloudFoundryError struct {
	Code        int    `json:"code"`
	ErrorCode   string `json:"error_code"`
	Description string `json:"description"`
}

func (CloudFoundryError) Error

func (cfErr CloudFoundryError) Error() string

type CloudFoundryErrorV3

type CloudFoundryErrorV3 struct {
	Code   int    `json:"code"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

func NewCloudFoundryErrorFromV3Errors

func NewCloudFoundryErrorFromV3Errors(cfErrorsV3 CloudFoundryErrorsV3) CloudFoundryErrorV3

CF APIs v3 can return multiple errors, we take the first one and convert it into a V2 model

func (CloudFoundryErrorV3) Error

func (cfErrV3 CloudFoundryErrorV3) Error() string

type CloudFoundryErrorsV3

type CloudFoundryErrorsV3 struct {
	Errors []CloudFoundryErrorV3 `json:"errors"`
}

type CloudFoundryHTTPError

type CloudFoundryHTTPError struct {
	StatusCode int
	Status     string
	Body       string
}

func (CloudFoundryHTTPError) Error

func (e CloudFoundryHTTPError) Error() string

type Data

type Data struct {
	GUID      string `jsonry:"guid,omitempty"`
	SpaceName string `jsonry:"spacename,omitempty"`
	OrgGUID   string `jsonry:"orgguid,omitempty"`
	OrgName   string `jsonry:"orgname,omitempty"`
}

type Entitlements added in v0.31.0

type Entitlements struct {
	Resources []model.EntitlementSecGroup `jsonry:"resources"`
}

type NotFoundError added in v0.68.0

type NotFoundError error

type Organization

type Organization struct {
	resources.Organization
}

type Organizations added in v0.37.0

type Organizations struct {
	Paginated
	Resources []Organization `jsonry:"resources"`
}

type Paginated added in v0.31.0

type Paginated struct {
	Pagination struct {
		Next struct {
			HREF string `jsonry:"href"`
		} `jsonry:"next"`
	} `jsonry:"pagination"`
}

type Rule

type Rule struct {
	Protocol    string `jsonry:"protocol"`
	Destination string `jsonry:"destination"`
	Ports       string `jsonry:"ports,omitempty"`
}

type SecurityGroup

type SecurityGroup struct {
	Name                   string `jsonry:"name,omitempty"`
	GUID                   string `jsonry:"guid,omitempty"`
	Rules                  []Rule `jsonry:"rules,omitempty"`
	StagingGloballyEnabled *bool  `jsonry:"globally_enabled.staging,omitempty"`
	RunningGloballyEnabled *bool  `jsonry:"globally_enabled.running,omitempty"`
	Relationships          struct {
		Running_Spaces struct {
			Data []Data `jsonry:"data"`
		} `jsonry:"running_spaces"`
		Staging_Spaces struct {
			Data []Data `jsonry:"data"`
		} `jsonry:"staging_spaces"`
	} `jsonry:"relationships,omitempty"`
}

func (*SecurityGroup) FeedOrgsAndSpace added in v0.37.0

func (s *SecurityGroup) FeedOrgsAndSpace(spaces []Space, orgs []resources.Organization, orgGUID string)

type SecurityGroups

type SecurityGroups struct {
	Paginated
	Resources []SecurityGroup `jsonry:"resources,omitempty"`
}

type Space

type Space struct {
	resources.Space
}

type Spaces

type Spaces struct {
	Paginated
	Resources []Space                `jsonry:"resources"`
	Included  ccv3.IncludedResources `jsonry:"included"`
}

type User

type User struct {
	Paginated
	Resources []struct {
		GUID          string `jsonry:"guid,omitempty"`
		CreatedAt     string `jsonry:"created_at"`
		UpdatedAt     string `jsonry:"updated_at"`
		Type          string `jsonry:"type,omitempty"`
		Relationships struct {
			User struct {
				Data struct {
					GUID string `jsonry:"guid"`
				}
			}
		}
	}
}

type UserRoles

type UserRoles struct {
	Paginated
	Resources []struct {
		GUID          string `jsonry:"guid,omitempty"`
		CreatedAt     string `jsonry:"created_at"`
		UpdatedAt     string `jsonry:"updated_at"`
		Type          string `jsonry:"type,omitempty"`
		Relationships struct {
			User struct {
				Data struct {
					GUID string `jsonry:"guid"`
				} `jsonry:"data"`
			} `jsonry:"user"`
			Space struct {
				Data struct {
					GUID string `jsonry:"guid"`
				} `jsonry:"data"`
			} `jsonry:"space"`
			Organization struct {
				Data struct {
					GUID string `jsonry:"guid"`
				} `jsonry:"data"`
			} `jsonry:"organization"`
		} `jsonry:"relationships"`
	} `jsonry:"resources"`
}

Jump to

Keyboard shortcuts

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