om

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package om provides methods to interact with an Ops Manager via its API.

Index

Constants

This section is empty.

Variables

View Source
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

func (a *API) ApplyChanges(output io.Writer, ignoreWarnings bool, products ...string) error

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

func (a *API) CheckPendingChanges() (bool, error)

CheckPendingChanges will return true if an apply changes would actually do anything (config changes, version updates, stemcell updates, etc)

func (*API) EnsureAvailability

func (a *API) EnsureAvailability(numRetries uint) error

EnsureAvailability will attempt up to numRetries times to unlock the API with the decryption passphrase provided in NewAPI.

func (*API) GetBoshDirectorName

func (a *API) GetBoshDirectorName() (string, error)

func (*API) GetBoshManifest

func (a *API) GetBoshManifest(deploymentName string) ([]byte, error)

GetBoshManifest returns the latest attemped OpsMan generated BOSH manifest

func (*API) GetDeployedProductVersion

func (a *API) GetDeployedProductVersion(productName string) (string, error)

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

func (a *API) GetDirectorCredentials() ([]string, error)

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

func (a *API) GetOpsManagerVersion() (string, error)

GetOpsManagerVersion returns the version of Ops Manager as reported by the /api/v0/info endpoint

Jump to

Keyboard shortcuts

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