extclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	GUID          string          `json:"guid"`
	Name          string          `json:"name"`
	State         string          `json:"state"`
	CreatedAt     string          `json:"created_at"`
	UpdatedAt     string          `json:"updated_at"`
	Lifecycle     AppLifecycle    `json:"lifecycle"`
	Relationships AppRelations    `json:"relationships"`
	Metadata      AppMetadata     `json:"metadata"`
	Links         map[string]Link `json:"links"`
}

App represents a Cloud Foundry application.

type AppLifecycle

type AppLifecycle struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
}

type AppMetadata

type AppMetadata struct {
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
}

type AppRelations

type AppRelations struct {
	Space struct {
		Data struct {
			GUID string `json:"guid"`
		} `json:"data"`
	} `json:"space"`
}

type Client

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

func NewClient

func NewClient() *Client

NewClient creates a new CF API client from the global config.

func (*Client) GetApp

func (c *Client) GetApp(ctx context.Context, appGUID string) (*App, error)

GetApp fetches a single application by its GUID.

func (*Client) ListApps

func (c *Client) ListApps(ctx context.Context) ([]App, []Space, []Organization, error)

ListApps fetches all applications from the CF API, following pagination. It tries to include space and org data via the include parameter. If the API doesn't support includes (e.g., Korifi), it falls back to fetching apps only and resolves spaces/orgs separately.

func (*Client) RestartApp

func (c *Client) RestartApp(ctx context.Context, appGUID string) error

RestartApp restarts an application by its GUID.

func (*Client) StopApp

func (c *Client) StopApp(ctx context.Context, appGUID string) (*App, error)

StopApp stops an application by its GUID.

type IncludedResources

type IncludedResources struct {
	Spaces        []Space        `json:"spaces,omitempty"`
	Organizations []Organization `json:"organizations,omitempty"`
}

IncludedResources holds optionally included related resources.

type Link struct {
	Href string `json:"href"`
}

type ListAppsResponse

type ListAppsResponse struct {
	Pagination struct {
		TotalResults int   `json:"total_results"`
		TotalPages   int   `json:"total_pages"`
		Next         *Link `json:"next"`
	} `json:"pagination"`
	Resources []App `json:"resources"`
}

ListAppsResponse represents the paginated response from GET /v3/apps.

type ListAppsResponseWithIncludes

type ListAppsResponseWithIncludes struct {
	ListAppsResponse
	Included IncludedResources `json:"included"`
}

type Organization

type Organization struct {
	GUID string `json:"guid"`
	Name string `json:"name"`
}

type RootResponse

type RootResponse struct {
	Links struct {
		Uaa struct {
			Href string `json:"href"`
		} `json:"uaa"`
		Login struct {
			Href string `json:"href"`
		} `json:"login"`
	} `json:"links"`
}

RootResponse represents the CF API root response used to discover the UAA endpoint.

type Space

type Space struct {
	GUID          string `json:"guid"`
	Name          string `json:"name"`
	Relationships struct {
		Organization struct {
			Data struct {
				GUID string `json:"guid"`
			} `json:"data"`
		} `json:"organization"`
	} `json:"relationships"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
}

TokenResponse represents the OAuth2 token response from UAA.

Jump to

Keyboard shortcuts

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