Documentation ¶
Overview ¶
Package om provides methods to interact with an Ops Manager via its API.
Index ¶
- Variables
- type API
- func (a *API) ApplyChanges(output io.Writer, ignoreWarnings bool, products ...string) error
- func (a *API) CheckPendingChanges() (bool, error)
- func (a *API) EnsureAvailability(numRetries uint) error
- func (a *API) GetBoshDirectorName() (string, error)
- func (a *API) GetBoshManifest(deploymentName string) ([]byte, error)
- func (a *API) GetDeployedProductVersion(productName string) (string, error)
- func (a *API) GetDirectorCredentials() ([]string, error)
- func (a *API) GetOpsManagerVersion() (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrBadStatusCode = errors.New("expected 2xx error code")
ErrBadStatusCode is an error that is thrown when a non-200 status code is returned from an HTTP call. It can be read with
errors.Is(err, om.ErrBadStatusCode)
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API will allow access to an Ops Manager's HTTP API
func NewAPI ¶
func NewAPI(host string, username string, password string, decryptionPassphrase string, useClientCredentials bool, hc *http.Client) *API
NewAPI will create a new API object. If you want to use client id and client secret instead of username and password, set useClientCredentials to true. Note that host must begin with the scheme (https://example.com, not example.com)
If you pass a nil http.Client, http.DefaultClient will be used for all calls. If you require skipping TLS validation or using custom certs, you must create a Client that does those things and pass it in.
func (*API) ApplyChanges ¶
ApplyChanges will attempt to trigger the installation/update of the requested products. How it behaves depends on the value of products:
* if products is omitted, it will attempt only to deploy the BOSH director
* if products exists and the first element is "all", it will deploy all staged products. Otherwise, only the BOSH director and the specified products will deploy. In these cases, no errands will be run. These should be specified as product names (cf) instead of GUIDs (cf-1234asdf)
if output is nil, the operation will return immediately and is effectively asynchronous. If not, the logs of the just-trigged installation will be streamed to output.
func (*API) CheckPendingChanges ¶
CheckPendingChanges will return true if an apply changes would actually do anything (config changes, version updates, stemcell updates, etc)
func (*API) EnsureAvailability ¶
EnsureAvailability will attempt up to numRetries times to unlock the API with the decryption passphrase provided in NewAPI.
func (*API) GetBoshDirectorName ¶
func (*API) GetBoshManifest ¶
GetBoshManifest returns the latest attemped OpsMan generated BOSH manifest
func (*API) GetDeployedProductVersion ¶
GetDeployedProductVersion will return the version of the requested product that is currently deployed. It will error if the product is p-bosh. For that, you should use GetOpsManagerVersion. It will also error if the product is not found.
func (*API) GetDirectorCredentials ¶
GetDirectorCredentials will return a slice of environment variables (in the form KEY=VALUE), suitable for use in exec.Command, that will facilitate connections to the Ops Manager's BOSH Director
func (*API) GetOpsManagerVersion ¶
GetOpsManagerVersion returns the version of Ops Manager as reported by the /api/v0/info endpoint