client

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 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

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

func (c *Client) AddSecGroupRelationShips(secGroup *SecurityGroup, spaces Spaces) 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) BindUnbindSecurityGroup

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

func (*Client) CurrentUserIsAdmin

func (c *Client) CurrentUserIsAdmin() (bool, 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) GetOrgManagers

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

func (*Client) GetSecGroupByName

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

func (*Client) GetSecGroupSpaces

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

func (*Client) GetSecGroups

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

func (*Client) GetSpaceByGuid

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

func (*Client) GetSpacesWithOrg

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

func (*Client) ListAllSecGroups

func (c *Client) ListAllSecGroups(req *http.Request) ([]byte, 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 CustomTransport

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

func (*CustomTransport) RoundTrip

func (ct *CustomTransport) RoundTrip(r *http.Request) (*http.Response, error)

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"`
	Running   bool   `jsonry:"runnning"`
	Staging   bool   `jsonry:"staging"`
}

type NotFoundError

type NotFoundError error

type Organization

type Organization struct {
	resources.Organization
}

type Organizations

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

type Paginated

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"`
}

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