Documentation ¶
Index ¶
- func ValidateMandatoryEnvironment(host string, apiKey string) error
- type Client
- func (c *Client) GetActiveSpace() *spaces.Space
- func (c *Client) GetHostUrl() string
- func (c *Client) GetSpacedClient(requester Requester) (*octopusApiClient.Client, error)
- func (c *Client) GetSystemClient(requester Requester) (*octopusApiClient.Client, error)
- func (c *Client) SetSpaceNameOrId(spaceNameOrId string)
- type ClientFactory
- type FakeRequesterContext
- type Requester
- type RequesterContext
- type SpinnerRoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateMandatoryEnvironment ¶ added in v0.1.0
Types ¶
type Client ¶
type Client struct { // Underlying HTTP Client (settable for mocking in unit tests). // If nil, will use the system default HTTP client to connect to the Octopus Deploy server HttpClient *http.Client // TODO this should be an interface rather than a struct, but this requires changing the SDK, we'll get round to that // Octopus API Client not scoped to any space. nullable, lazily created by Get() SystemClient *octopusApiClient.Client // TODO this should be an interface rather than a struct, but this requires changing the SDK, we'll get round to that // Octopus API Client scoped to the current space. nullable, lazily created by Get() SpaceScopedClient *octopusApiClient.Client // the Server URL, obtained from OCTOPUS_URL ApiUrl *url.URL // the Octopus API Key, obtained from OCTOPUS_API_KEY ApiKey string // the Octopus SpaceNameOrID to work within. Obtained from OCTOPUS_SPACE (TODO: or --space=XYZ on the command line??) // Required for commands that need a space, but may be omitted for server-wide commands such as listing teams SpaceNameOrID string // After the space lookup process has occurred, we cache a reference to the SpaceNameOrID object for future use // May be nil if we haven't done space lookup yet ActiveSpace *spaces.Space Ask question.AskProvider }
func (*Client) GetActiveSpace ¶ added in v0.2.0
func (*Client) GetHostUrl ¶ added in v0.2.0
func (*Client) GetSpacedClient ¶ added in v0.2.0
func (c *Client) GetSpacedClient(requester Requester) (*octopusApiClient.Client, error)
func (*Client) GetSystemClient ¶ added in v0.2.0
func (c *Client) GetSystemClient(requester Requester) (*octopusApiClient.Client, error)
func (*Client) SetSpaceNameOrId ¶ added in v0.2.0
type ClientFactory ¶
type ClientFactory interface { // GetSpacedClient returns an Octopus api Client instance which is bound to the Space // specified in the OCTOPUS_SPACE environment variable, or the command line. It should be the default GetSpacedClient(requester Requester) (*octopusApiClient.Client, error) // GetSystemClient returns an Octopus api Client instance which isn't bound to any Space. // Use it for things that live outside of a space, such as Teams, or Spaces themselves GetSystemClient(requester Requester) (*octopusApiClient.Client, error) // GetActiveSpace returns the currently selected space. // Note this is lazily populated when you call GetSpacedClient; // if you have not yet done so then it may return nil GetActiveSpace() *spaces.Space // SetSpaceNameOrId replaces whichever space name or ID was picked up from the environment or selected // interactively. This resets the internal cache inside the ClientFactory, meaning that the next time // someone calls GetSpacedClient we will have to query the Octopus Server to look up spaceNameOrId, // and any calls to GetActiveSpace before that will return nil SetSpaceNameOrId(spaceNameOrId string) // GetHostUrl returns the current set API URL as a string GetHostUrl() string }
func NewClientFactory ¶ added in v0.2.0
func NewClientFactory(httpClient *http.Client, host string, apiKey string, spaceNameOrID string, ask question.AskProvider) (ClientFactory, error)
func NewClientFactoryFromConfig ¶ added in v0.2.1
func NewClientFactoryFromConfig(ask question.AskProvider) (ClientFactory, error)
NewClientFactoryFromConfig Creates a new Client wrapper structure by reading the viper config. specifies nil for the HTTP Client, so this is not for unit tests; use NewClientFactory(... instead)
func NewStubClientFactory ¶ added in v0.3.0
func NewStubClientFactory() ClientFactory
NewStubClientFactory returns a stub instance, so you can satisfy external code that needs a ClientFactory
type FakeRequesterContext ¶ added in v0.7.0
type FakeRequesterContext struct { }
func (*FakeRequesterContext) GetRequester ¶ added in v0.7.0
func (r *FakeRequesterContext) GetRequester() string
type RequesterContext ¶ added in v0.7.0
type RequesterContext struct {
// contains filtered or unexported fields
}
func NewRequester ¶ added in v0.7.0
func NewRequester(c *cobra.Command) *RequesterContext
func (*RequesterContext) GetRequester ¶ added in v0.7.0
func (r *RequesterContext) GetRequester() string
type SpinnerRoundTripper ¶ added in v0.2.1
type SpinnerRoundTripper struct { Next http.RoundTripper Spinner *spinner.Spinner }
func NewSpinnerRoundTripper ¶ added in v0.2.1
func NewSpinnerRoundTripper() *SpinnerRoundTripper
Click to show internal directories.
Click to hide internal directories.