cf

package
v0.0.0-...-81a4f0c Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenTypeBearer = "Bearer"
	PathApp         = "/v2/apps"
	CFAppNotFound   = "CF-AppNotFound"
)
View Source
const (
	PathCFInfo                                   = "/v2/info"
	PathCFAuth                                   = "/oauth/token"
	PathIntrospectToken                          = "/introspect"
	GrantTypeClientCredentials                   = "client_credentials"
	GrantTypeRefreshToken                        = "refresh_token"
	TimeToRefreshBeforeTokenExpire time.Duration = 10 * time.Minute
)
View Source
const (
	ServiceInstancesPath = "/v2/service_instances"
	ServicePlansPath     = "v2/service_plans"
	ResultsPerPageParam  = "results-per-page"
)
View Source
const (
	CCAdminScope = "cloud_controller.admin"
)

Variables

View Source
var (
	ErrUnauthrorized      = fmt.Errorf(http.StatusText(http.StatusUnauthorized))
	ErrInvalidTokenFormat = fmt.Errorf("Invalid token format")
)

Functions

This section is empty.

Types

type CFClient

type CFClient interface {
	Login() error
	RefreshAuthToken() (string, error)
	GetTokens() (Tokens, error)
	GetEndpoints() Endpoints
	GetApp(string) (*models.AppEntity, error)
	SetAppInstances(string, int) error
	IsUserAdmin(userToken string) (bool, error)
	IsUserSpaceDeveloper(userToken string, appId string) (bool, error)
	IsTokenAuthorized(token, clientId string) (bool, error)
	GetServiceInstancesInOrg(orgGUID, servicePlanGuid string) (int, error)
	GetServicePlan(serviceInstanceGuid string) (string, error)
}

func NewCFClient

func NewCFClient(conf *CFConfig, logger lager.Logger, clk clock.Clock) CFClient

type CFConfig

type CFConfig struct {
	API               string `yaml:"api"`
	ClientID          string `yaml:"client_id"`
	Secret            string `yaml:"secret"`
	SkipSSLValidation bool   `yaml:"skip_ssl_validation"`
}

func (*CFConfig) Validate

func (conf *CFConfig) Validate() error

type Endpoints

type Endpoints struct {
	AuthEndpoint    string `json:"authorization_endpoint"`
	TokenEndpoint   string `json:"token_endpoint"`
	DopplerEndpoint string `json:"doppler_logging_endpoint"`
}

type IntrospectionResponse

type IntrospectionResponse struct {
	Active   bool   `json:"active"`
	Email    string `json:"email"`
	ClientId string `json:"client_id"`
}

type Metadata

type Metadata struct {
	Guid string `json:"guid"`
}

type Resource

type Resource struct {
	Metadata Metadata `json:"metadata"`
}

type Result

type Result struct {
	TotalResults int        `json:"total_results"`
	Resources    []Resource `json:"resources"`
}

type ServiceInstanceEntity

type ServiceInstanceEntity struct {
	ServicePlanGuid string `json:"service_plan_guid"`
}

type ServiceInstanceResource

type ServiceInstanceResource struct {
	Entity ServiceInstanceEntity `json:"entity"`
}

type ServicePlanEntity

type ServicePlanEntity struct {
	UniqueId string `json:"unique_id"`
}

type ServicePlanResource

type ServicePlanResource struct {
	Entity ServicePlanEntity `json:"entity"`
}

type Tokens

type Tokens struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

type UaaClient

type UaaClient interface {
	RefreshAuthToken() (string, error)
}

func NewUaaClient

func NewUaaClient(conf *CFConfig, logger lager.Logger, uaaEndpoint string) UaaClient

Jump to

Keyboard shortcuts

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