Documentation ¶
Overview ¶
Package api implements a client API for working with digitalrebar/provision.
Package api implements a client API for working with digitalrebar/provision.
Index ¶
- Constants
- Variables
- func BuildCatalog(input *models.CatalogBuilderInput) (*models.Content, error)
- func CombineCatalogs(catalogs []*models.Content) (res *models.Content, err error)
- func DecodeYaml(buf []byte, ref interface{}) error
- func FetchCatalog(catalogUrls []string, session *Client) (res *models.Content, err error)
- func FetchCatalogUrls(session *Client, catalogUrlsToFetch string) (catalogUrls []string, err error)
- func FindOrFake(src, field string, args map[string]string) string
- func FixSource(source, catalogSource string) string
- func GenPatch(source, target interface{}, paranoid bool) (jsonpatch2.Patch, error)
- func GetCatalog(catalog string, session *Client) (res *models.Content, err error)
- func GetCatalogSource(catalogUrl string, session *Client) (catalogSource string)
- func GetManagerCatalogItem(name, version string, session *Client) (*models.CatalogItem, error)
- func Pretty(f string, obj interface{}) ([]byte, error)
- func PrettyColor(f string, obj interface{}, useColor bool, colors [][]int) ([]byte, error)
- func ProcessCatalog(catalog, catalogSource string, res *models.Content)
- func UnescapedValue(s string) string
- func ValueInList(val, list string) bool
- type Client
- func ClientCertSession(ctx context.Context, endpoint, clientCert, clientKey string, ...) (*Client, error)
- func DisconnectedClient() *Client
- func TokenSession(endpoint, token string) (*Client, error)
- func TokenSessionProxy(endpoint, token string, proxy bool) (*Client, error)
- func TokenSessionProxyServer(endpoint, token string, proxy bool, serverVerify bool, caCert string) (*Client, error)
- func UserSession(endpoint, username, password string) (*Client, error)
- func UserSessionContext(ctx context.Context, endpoint, username, password string) (*Client, error)
- func UserSessionToken(endpoint, username, password string, usetoken bool) (*Client, error)
- func UserSessionTokenContext(ctx context.Context, endpoint, username, password string, usetoken bool) (*Client, error)
- func UserSessionTokenProxy(endpoint, username, password string, usetoken, useproxy bool) (*Client, error)
- func UserSessionTokenProxyContext(ctx context.Context, endpoint, username, password string, ...) (*Client, error)
- func UserSessionTokenProxyContextServer(ctx context.Context, endpoint, username, password string, ...) (*Client, error)
- func (c *Client) AllIndexes() (map[string]map[string]models.Index, error)
- func (c *Client) Authorize(req *http.Request) error
- func (c *Client) BundleContent(src string, dst store.Store, params map[string]string) error
- func (c *Client) Close()
- func (c *Client) CreateContent(content *models.Content, replaceWritable bool) (*models.ContentSummary, error)
- func (c *Client) CreateModel(ref models.Model) error
- func (c *Client) DeleteBlob(at ...string) error
- func (c *Client) DeleteContent(name string) error
- func (c *Client) DeleteModel(prefix, key string) (models.Model, error)
- func (c *Client) Endpoint() string
- func (c *Client) Events() (*EventStream, error)
- func (c *Client) ExistsModel(prefix, key string) (bool, error)
- func (c *Client) File(pathParts ...string) (io.ReadCloser, error)
- func (c *Client) FillModel(ref models.Model, key string) error
- func (c *Client) GetBlob(dest io.Writer, at ...string) error
- func (c *Client) GetBlobSum(at ...string) (string, error)
- func (c *Client) GetContentItem(name string) (*models.Content, error)
- func (c *Client) GetContentSummary() ([]*models.ContentSummary, error)
- func (c *Client) GetModel(prefix, key string, params ...string) (models.Model, error)
- func (c *Client) GetModelForPatch(prefix, key string, params ...string) (models.Model, models.Model, error)
- func (c *Client) Host() string
- func (c *Client) Indexes(prefix string) (map[string]models.Index, error)
- func (c *Client) Info() (*models.Info, error)
- func (c *Client) InstallBootEnvFromFile(src string) (*models.BootEnv, error)
- func (c *Client) InstallISOForBootenv(env *models.BootEnv, src string, downloadOK bool, arch ...string) error
- func (c *Client) InstallRawTemplateFromFile(src string) (*models.Template, error)
- func (c *Client) InstallRawTemplateFromFileWithId(src, tid string) (*models.Template, error)
- func (c *Client) ListBlobs(at string, params ...string) ([]string, error)
- func (c *Client) ListModel(prefix string, params ...string) ([]models.Model, error)
- func (c *Client) Logs() ([]logger.Line, error)
- func (c *Client) MakeProxy(socketPath string) error
- func (c *Client) Objects() ([]string, error)
- func (c *Client) OneIndex(prefix, param string) (models.Index, error)
- func (c *Client) PatchModel(prefix, key string, patch jsonpatch2.Patch) (models.Model, error)
- func (c *Client) PatchTo(old models.Model, new models.Model) (models.Model, error)
- func (c *Client) PatchToFull(old models.Model, new models.Model, paranoid bool) (models.Model, error)
- func (c *Client) PostBlob(blob io.Reader, at ...string) (models.BlobInfo, error)
- func (c *Client) PostBlobExplode(blob io.Reader, explode bool, at ...string) (models.BlobInfo, error)
- func (c *Client) PostEvent(evt *models.Event) error
- func (c *Client) PutModel(obj models.Model) error
- func (c *Client) RefreshToken(principal, key string, validTime time.Duration) (err error)
- func (c *Client) ReplaceContent(content *models.Content, replaceWritable bool) (*models.ContentSummary, error)
- func (c *Client) Req() *R
- func (c *Client) RunProxy(socketPath string) error
- func (c *Client) SetLogger(l logger.Logger)
- func (c *Client) SignRackNUrl(oldUrl string) (newUrl string, err error)
- func (c *Client) StartTokenRefresh(principal, key string, refreshTime, validTime time.Duration) error
- func (c *Client) StaticClient() *http.Client
- func (c *Client) Token() string
- func (c *Client) TokenRefresh(prefix, key string)
- func (c *Client) Trace(lvl string)
- func (c *Client) TraceToken(t string)
- func (c *Client) UnbundleContent(content store.Store, dst string) error
- func (c *Client) UploadISOForBootEnv(env *models.BootEnv, src io.Reader, dest string) (models.BlobInfo, error)
- func (c *Client) UrlFor(args ...string) (*url.URL, error)
- func (c *Client) UrlForProxy(proxy string, args ...string) (*url.URL, error)
- func (c *Client) UrlProxy(up string) *Client
- func (c *Client) Username() string
- func (c *Client) Websocket(at string) (*websocket.Conn, error)
- type CloudiaUrlReq
- type CloudiaUrlResp
- type Decoder
- type Encoder
- type EventStream
- func (es *EventStream) Close() error
- func (es *EventStream) Deregister(handle int64) error
- func (es *EventStream) Kill()
- func (es *EventStream) Register(events ...string) (int64, <-chan RecievedEvent, error)
- func (es *EventStream) Subscribe(handle int64, events ...string) error
- func (es *EventStream) WaitFor(item models.Model, test TestFunc, timeout time.Duration) (string, error)
- type R
- func (r *R) Body(b interface{}) *R
- func (r *R) Context(c context.Context) *R
- func (r *R) Del() *R
- func (r *R) Delete(m models.Model) error
- func (r *R) Do(val interface{}) error
- func (r *R) FailFast() *R
- func (r *R) Fill(m models.Model) error
- func (r *R) Filter(prefix string, filterArgs ...string) *R
- func (r *R) Get() *R
- func (r *R) GetETag() string
- func (r *R) Head() *R
- func (r *R) Headers(args ...string) *R
- func (r *R) List(prefix string) *R
- func (r *R) Meth(v string) *R
- func (r *R) Params(args ...string) *R
- func (r *R) ParanoidPatch() *R
- func (r *R) Patch(b jsonpatch2.Patch) *R
- func (r *R) PatchObj(old, new interface{}) *R
- func (r *R) PatchTo(old, new models.Model) *R
- func (r *R) PatchToFull(old models.Model, new models.Model, paranoid bool) (models.Model, error)
- func (r *R) Post(b interface{}) *R
- func (r *R) Proxy(proxy string) *R
- func (r *R) Put(b interface{}) *R
- func (r *R) Response() (*http.Response, error)
- func (r *R) SetHeaders(args ...string) *R
- func (r *R) Trace(lvl string) *R
- func (r *R) TraceToken(t string) *R
- func (r *R) UrlFor(args ...string) *R
- func (r *R) UrlForM(m models.Model, rest ...string) *R
- func (r *R) Wait(etag, dur string) *R
- type RecievedEvent
- type TestFunc
Constants ¶
const APIPATH = "/api/v3"
APIPATH is the base path for all API endpoints that digitalrebar provision provides.
const CatalogUrlsToFetchForManagers = "all"
Variables ¶
var (
ErrBadPrincipal = errors.New(`principal must be "machines" or "users"`)
)
Functions ¶
func BuildCatalog ¶ added in v4.9.0
func BuildCatalog(input *models.CatalogBuilderInput) (*models.Content, error)
BuildCatalog generates a JSON patch that will transform source into target. The generated patch will have all the applicable test clauses.
func CombineCatalogs ¶ added in v4.10.0
func DecodeYaml ¶
DecodeYaml is a helper function for dealing with user input -- when accepting input from the user, we want to treat both YAML and JSON as first-class citizens. The YAML library we use makes that easier by using the json struct tags for all marshalling and unmarshalling purposes.
Note that the REST API does not use YAML as a wire protocol, so this function should never be used to decode data coming from the provision service.
func FetchCatalog ¶ added in v4.10.0
FetchCatalog fetches contents from all catalog urls NOTE: if logic here is updated - please also look in cli/utils.go to update similar logic there TODO: update so this is common between api and cli packages
func FetchCatalogUrls ¶ added in v4.10.0
func GenPatch ¶
func GenPatch(source, target interface{}, paranoid bool) (jsonpatch2.Patch, error)
GenPatch generates a JSON patch that will transform source into target. The generated patch will have all the applicable test clauses.
func GetCatalog ¶ added in v4.10.0
GetCatalog retrieves contents from the given catalog url NOTE: if logic here is updated - please also look in cli/utils.go to update similar logic there TODO: update so this is common between api and cli packages
func GetCatalogSource ¶ added in v4.10.0
func GetManagerCatalogItem ¶ added in v4.10.0
func GetManagerCatalogItem(name, version string, session *Client) (*models.CatalogItem, error)
GetManagerCatalogItem retrieves the given item from the current catalog also look at FetchCatalog
func Pretty ¶
Pretty marshals object according to the the fmt, in whatever passed for "pretty" according to fmt.
func PrettyColor ¶
PrettyColor marshals object according to the the fmt, in whatever passed for "pretty" according to fmt. If useColor = true, then try to colorize output
func ProcessCatalog ¶ added in v4.10.2
func UnescapedValue ¶ added in v4.12.0
Unescapes an event string
\1 is the dot character. \2 is the comma character. \3 is the asterisk character.
func ValueInList ¶
ValueInList parses a list string for matches with escapes.
Types ¶
type Client ¶
type Client struct { logger.Logger // The amount of time to allow any single round trip by default. // Defaults to no timeout. This will be overridden by a Client.Req().Context() RoundTripTimeout time.Duration // contains filtered or unexported fields }
Client wraps *http.Client to include our authentication routines and routines for handling some of the boilerplate CRUD operations against digitalrebar provision.
func ClientCertSession ¶ added in v4.10.4
func ClientCertSession(ctx context.Context, endpoint, clientCert, clientKey string, useproxy, serverVerify bool, caCert string) (*Client, error)
ClientCertSession creates a new api.Client that will use the client cert
func DisconnectedClient ¶
func DisconnectedClient() *Client
DisconnectedClient returns an unconfigured Client with the Logger already configured for use.
func TokenSession ¶
TokenSession creates a new api.Client that will use the passed-in Token for authentication. It should be used whenever the API is not acting on behalf of a user. Attempts to use/create a proxy session
func TokenSessionProxy ¶
TokenSessionProxy creates a new api.Client that will use the passed-in Token for authentication. It should be used whenever the API is not acting on behalf of a user. Allows for choice on session creation or not.
func TokenSessionProxyServer ¶ added in v4.10.4
func TokenSessionProxyServer(endpoint, token string, proxy bool, serverVerify bool, caCert string) (*Client, error)
TokenSessionProxy creates a new api.Client that will use the passed-in Token for authentication. It should be used whenever the API is not acting on behalf of a user. Allows for choice on session creation or not.
func UserSession ¶
UserSession creates a new api.Client that can act on behalf of a user. It will perform a single request using basic authentication to get a token that expires 600 seconds from the time the session is crated, and every 300 seconds it will refresh that token.
UserSession does not currently attempt to cache tokens to persistent storage, although that may change in the future.
func UserSessionContext ¶
UserSessionContext creates a new api.Client that can act on behalf of a user. It will perform a single request using basic authentication to get a token that expires 600 seconds from the time the session is crated, and every 300 seconds it will refresh that token.
UserSession does not currently attempt to cache tokens to persistent storage, although that may change in the future.
You can use the passed-in Context to override the default connection and request/response timeouts.
func UserSessionToken ¶
UserSessionToken allows for the token conversion turned off.
func UserSessionTokenContext ¶
func UserSessionTokenContext(ctx context.Context, endpoint, username, password string, usetoken bool) (*Client, error)
UserSessionTokenContext allows for the token conversion turned off. It also takes a context.Context to override the default connection timeouts.
func UserSessionTokenProxy ¶
func UserSessionTokenProxy(endpoint, username, password string, usetoken, useproxy bool) (*Client, error)
UserSessionTokenProxy allows for the token conversion turned off and turn off local proxy
func UserSessionTokenProxyContext ¶
func UserSessionTokenProxyContext(ctx context.Context, endpoint, username, password string, usetoken, useproxy bool) (*Client, error)
UserSessionTokenProxy allows for the token conversion turned off and turn off local proxy, along with passing in a context.Context to allow for faster connect timeouts.
func UserSessionTokenProxyContextServer ¶ added in v4.10.4
func UserSessionTokenProxyContextServer(ctx context.Context, endpoint, username, password string, usetoken, useproxy, serverVerify bool, caCert string) (*Client, error)
UserSessionTokenProxy allows for the token conversion turned off and turn off local proxy, along with passing in a context.Context to allow for faster connect timeouts.
func (*Client) AllIndexes ¶
AllIndexes returns all the static indexes available for all object types on the server.
func (*Client) Authorize ¶
Authorize sets the Authorization header in the Request with the current bearer token. The rest of the helper methods call this, so you don't have to unless you are building your own http.Requests.
func (*Client) BundleContent ¶
func (*Client) Close ¶
func (c *Client) Close()
Close should be called whenever you no longer want to use this client connection. It will stop any token refresh routines running in the background, and force any API calls made to this client that would communicate with the server to return an error
func (*Client) CreateContent ¶
func (*Client) CreateModel ¶
CreateModel takes the passed-in model and creates an instance of it on the server. It will return an error if the passed-in model does not validate or if it already exists on the server. Upon success, the newly created object is returned in the passed-in model.
func (*Client) DeleteBlob ¶
DeleteBlob deletes a blob on the server at the location indicated by 'at'
func (*Client) DeleteContent ¶
func (*Client) DeleteModel ¶
DeleteModel deletes the model matching the passed-in prefix and key. It returns the object that was deleted.
func (*Client) Endpoint ¶
Endpoint returns the address of the dr-provision API endpoint that we are talking to.
func (*Client) Events ¶
func (c *Client) Events() (*EventStream, error)
Events creates a new EventStream from the client.
func (*Client) ExistsModel ¶
ExistsModel tests to see if an object exists on the server following the same rules as GetModel
func (*Client) File ¶
func (c *Client) File(pathParts ...string) (io.ReadCloser, error)
File initiates a download from the static file service on the dr-provision endpoint. It is up to the caller to ensure that the returned ReadCloser gets closed, otherwise stale HTTP connections will leak.
func (*Client) FillModel ¶
FillModel fills the passed-in model with new information retrieved from the server.
func (*Client) GetBlob ¶
GetBlob fetches a binary blob from the server, writing it to the passed io.Writer. If the io.Writer is actually an io.ReadWriteSeeker with a Truncate method, GetBlob will only download the file if it has changed on the server side.
func (*Client) GetBlobSum ¶
GetBlobSum fetches the checksum for the blob
func (*Client) GetContentItem ¶
func (*Client) GetContentSummary ¶
func (c *Client) GetContentSummary() ([]*models.ContentSummary, error)
func (*Client) GetModel ¶
GetModel returns an object if type prefix with the unique identifier key, if such an object exists. Key can be either the unique key for an object, or any field on an object that has an index that enforces uniqueness.
func (*Client) GetModelForPatch ¶
func (c *Client) GetModelForPatch(prefix, key string, params ...string) (models.Model, models.Model, error)
GetModelForPatch looks up the object with the additional parameters. Upon success, returns the current object and a clone of that object for modification.
func (*Client) Indexes ¶
Indexes returns all the static indexes available for a given type of object on the server.
func (*Client) Info ¶
Info returns some basic system information that was retrieved as part of the initial authentication.
func (*Client) InstallBootEnvFromFile ¶
func (*Client) InstallISOForBootenv ¶
func (*Client) InstallRawTemplateFromFile ¶
func (*Client) InstallRawTemplateFromFileWithId ¶
func (*Client) ListBlobs ¶
ListBlobs lists the names of all the binary objects at 'at', using the indexing parameters suppied by params.
func (*Client) ListModel ¶
ListModel returns a list of models for prefix matching the request parameters passed in by params.
func (*Client) MakeProxy ¶
MakeProxy creates a proxy server for this process to use. This is primarily used by the agent/runner to help tasks reuse connections.
func (*Client) OneIndex ¶
OneIndex tests to see if there is an index on the object type indicated by prefix for a specific parameter. If the returned Index is empty, there is no such Index.
func (*Client) PatchModel ¶
PatchModel attempts to update the object matching the passed prefix and key on the server side with the passed-in JSON patch (as specified in https://tools.ietf.org/html/rfc6902). To ensure that conflicting changes are rejected, your patch should contain the appropriate test stanzas, which will allow the server to detect and reject conflicting changes from different sources. This returns the resulting object.
func (*Client) PatchTo ¶
PatchTo generates a patch strucutre from old to new objects. The object is then updated. The result is returned in a new object that is not using the old or new object.
func (*Client) PatchToFull ¶
func (c *Client) PatchToFull(old models.Model, new models.Model, paranoid bool) (models.Model, error)
PatchToFull generates a patch strucutre from old to new objects. The object is then updated. The result is returned in a new object that is not using the old or new object. If paranoid is true, then the resulting patch will include a test for the whole old object state.
func (*Client) PostBlob ¶
PostBlob uploads the binary blob contained in the passed io.Reader to the location specified by at on the server. You are responsible for closing the passed io.Reader.
func (*Client) PostBlobExplode ¶
func (c *Client) PostBlobExplode(blob io.Reader, explode bool, at ...string) (models.BlobInfo, error)
PostBlobExplode uploads the binary blob contained in the passed io.Reader to the location specified by at on the server. You are responsible for closing the passed io.Reader. Sends the explode boolean as a query parameter.
func (*Client) PutModel ¶
PutModel replaces the server-side object matching the passed-in object with the passed-in object. Note that PutModel does not allow the server to detect and reject conflicting changes from multiple sources. The resulting object is returned in the passed-in model.
func (*Client) RefreshToken ¶ added in v4.11.0
RefreshToken has the client API fetch a new auth token.
- principal must be one of "users" or "machines". - key is ignored if prefix is "users", and must be the UUID of a machine if prefix is "machines"
The token the client uses for auth will be refreshed if no errors occurred.
func (*Client) ReplaceContent ¶
func (*Client) Req ¶
Req creates a new R for the current client. It defaults to using the GET method.
func (*Client) RunProxy ¶
RunProxy starts a local proxy server for other APII callers to reuse the open connection.
func (*Client) SetLogger ¶
SetLogger sets a new custom logger.Logger for this client. You must call this function only before using the Client to avoid races.
func (*Client) SignRackNUrl ¶ added in v4.10.0
SignRackNUrl is used to sign requests when we are accessing protected assets stored in one of our S3 buckets.
func (*Client) StartTokenRefresh ¶ added in v4.11.0
func (c *Client) StartTokenRefresh(principal, key string, refreshTime, validTime time.Duration) error
StartTokenRefresh starts a background goroutine that will refresh the auth token in use by the Client on a regular basis. It will return an error if the parameters are not valid or if a token is unable to be fetched for the given principal/key combination. If no error is returned, then a goroutine has been spun up in the background that will be stopped when the Client is closed.
func (*Client) StaticClient ¶ added in v4.12.0
func (*Client) TokenRefresh ¶
TokenRefresh is deprecated. Please use StartTokenRefresh instead.
func (*Client) Trace ¶
Trace sets the log level that incoming requests generated by a Client will be logged at, overriding the levels they would normally be logged at on the server side. Setting lvl to an empty string turns off tracing.
func (*Client) TraceToken ¶
TraceToken is a unique token that the server-side logger will emit a log for at the Error log level. It can be used to tie logs generated on the server side to requests made by a specific Client.
func (*Client) UnbundleContent ¶
func (*Client) UploadISOForBootEnv ¶
func (*Client) UrlFor ¶
UrlFor generates a valid API URL for the current endpoint the Client is talking to.
func (*Client) UrlForProxy ¶
UrlForProxy generates a valid API URL to interact with the current endpoint the Client is talking to, with an optional field to handle the case where the endpoint is proxying an API request through to a plugin.
type CloudiaUrlReq ¶ added in v4.10.0
type CloudiaUrlResp ¶ added in v4.10.0
type CloudiaUrlResp struct { Object CloudiaUrlReq `json:"object"` Url string `json:"url"` }
type EventStream ¶
EventStream receives events from the digitalrebar provider. You can read received events by reading from its Events channel.
func (*EventStream) Close ¶
func (es *EventStream) Close() error
Close closes down the EventStream. You should drain the Events until you read a RecievedEvent that has an empty E and a non-nil Err
func (*EventStream) Deregister ¶
func (es *EventStream) Deregister(handle int64) error
Deregister directs the EventStream to unsubscribe from Events from the digitalrebar provisioner. It takes the same parameters as Register.
func (*EventStream) Kill ¶
func (es *EventStream) Kill()
func (*EventStream) Register ¶
func (es *EventStream) Register(events ...string) (int64, <-chan RecievedEvent, error)
Register directs the EventStream to subscribe to Events from the digital rebar provisioner.
Event subscriptions consist of a string with the following format:
type.action.key
type is the object type that you want to listen for events about. * means to listen for events about all object types.
action is the action that caused the event to be created. * means to listen for all actions.
key is the unique identifier of the object to listen for. * means to listen for events from all objects
func (*EventStream) Subscribe ¶
func (es *EventStream) Subscribe(handle int64, events ...string) error
Subscribe directs an EventStream to listen for matching events.
func (*EventStream) WaitFor ¶
func (es *EventStream) WaitFor( item models.Model, test TestFunc, timeout time.Duration) (string, error)
WaitFor waits for an item to match test. It subscribes to an EventStream that watches all update and save envents for the object in question, and returns a string indicating whether the match succeeded, failed, or timed out.
The API for this function is subject to refactoring and change, and should not be considered to be stable yet.
type R ¶
R encapsulates a single Request/Response round trip. It has a slew of helper methods that can be chained together to handle all common operations with this API. It handles capturing any errors that may occur in building and executing the request.
func (*R) Body ¶
Body arranges for b to be used as the body of the request. It also sets the Content-Type of the request depending on what the body is:
If b is an io.Reader or a raw byte array, Content-Type will be set to application/octet-stream, otherwise Content-Type will be set to application/json.
If b is something other than nil, an io.Reader, or a byte array, Body will attempt to marshal the object as a JSON byte array and use that.
func (*R) Context ¶
Context will set the Context.Context that should be used for processing this specific request. If you set a context, the usual retry logic will be disabled as if you had also called FailFast
func (*R) Do ¶
Do attempts to execute the request built up by previous method calls on R. If any errors occurred while building up the request, they will be returned and no API interaction will actually take place. Otherwise, Do will generate an http.Request, perform it, and marshal the results to val. If any errors occur while processing the request, fibonacci based backoff will be performed up to 6 times.
If val is an io.Writer, the body of the response will be copied verbatim into val using io.Copy
Otherwise, the response body will be unmarshalled into val as directed by the Content-Type header of the response.
func (*R) FailFast ¶
FailFast skips the usual fibonacci backoff retry in the case of transient errors.
func (*R) Filter ¶
Filter is a helper for using freeform index operations. The prefix arg is the type of object you want to filter, and filterArgs describes how you want the results filtered. Currently, filterArgs must be in the following format:
"slim" "Meta|Params|Meta,Params" to reduce the amount of data sent back "params" "p1,p2,p3" to reduce the returned parameters to the specified set. "reverse" to reverse the order of the results "aggregate" to aggregate parameters for filtering "sort" "indexName" to sort the results according to indexName's native ordering "limit" "number" to limit the number of results returned "offset" "number" to skip <number> of results before returning "indexName" "Eq/Lt/Lte/Gt/Gte/Ne" "value" to return results Equal, Less Than, Less Than Or Equal, Greater Than, Greater Than Or Equal, or Not Equal to value according to IndexName "indexName" "Re" "re2 compatible regular expression" to return results where values in indexName match the passed-in regular expression. The index must have the Regex flag equal to True "indexName" "Between/Except" "lowerBound" "upperBound" to return values Between(inclusive) lowerBound and Upperbound or its complement for Except. "indexName" "In/Nin" "comma,separated,list,of,values" to return values either in the list of values or not in the listr of values
If formatArgs does not contain some valid combination of the above, the request will fail.
func (*R) Headers ¶
Headers arranges for its arguments to be added as HTTP headers. You must pass an even number of arguments to Headers, and headers added via this method will append new values to any that were already there.
func (*R) Params ¶
Params appends query parameters to the URL R will use. You must pass an even number of parameters to Params
func (*R) ParanoidPatch ¶
ParanoidPatch must be used before PatchXXX calls It turns on the paranoid flag requiring that the generate patch have a full object test.
func (*R) Patch ¶
func (r *R) Patch(b jsonpatch2.Patch) *R
Patch sets the R method to PATCH, and arranges for b (which must be a valid JSON patch) to be used as the body of the request by calling r.Body().
func (*R) PatchToFull ¶
PatchToFull generates a Patch request that will transform old into new. If paranoid is set to true, a test matching the full old object will be included. Otherwise, only tests for changing values will be included.
func (*R) Post ¶
Post sets the R method to POST, and arranges for b to be the body of the request by calling r.Body().
func (*R) Put ¶
Put sets the R method to PUT, and arranges for b to be used as the body of the request by calling r.Body(). If no body is desired, b can be nil
func (*R) Response ¶
Response executes the request and returns a raw http.Response. The caller must close the response body when finished with it.
func (*R) SetHeaders ¶ added in v4.11.0
SetHeaders arranges for its arguments to be added as HTTP headers, replacing any that were added via previous calls to Headers or SetHeaders. You must pass an even number of arguments to SetHeaders.
func (*R) Trace ¶
Trace will arrange for the server to log this specific request at the passed-in Level, overriding any client Trace requests or the levels things would usually be logged at by the server.
func (*R) TraceToken ¶
TraceToken is a unique token that the server-side logger will emit a log for at the Error log level. It can be used to tie logs generated on the server side to requests made by a specific Req.
func (*R) UrlFor ¶
UrlFor arranges for a sane request URL to be used for R. The generated URL will be in the form of:
/api/v3/path.Join(args...)
type RecievedEvent ¶
RecievedEvent contains an event received from the digitalrebar provision server along with any errors that occurred while receiving the event.
type TestFunc ¶
TestFunc is a function type used to test if an item matches some sort of condition.
func AndItems ¶
AndItems retuens a TestFunc that returns true if all the passed-in TestFuncs also return true.
func EqualItem ¶
EqualItem creates a test function to see if a value in the passed interface is equal
func OrItems ¶
OrItems returns a TestFunc that returns true if any of the passed-in TestFuncs return true.
func ParseAwaitFunctions ¶ added in v4.10.0
ParseAwaitFunctions - parses a string into test functions f = And(args) f = Or(args) f = Not(f) f = xx=Eq(value) -- to escape \) args = f,args args =