github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/boskos/client/README.md (about)

     1  # Boskos Client Library
     2  
     3  Boskos client is a go client library interfaces [boskos server](../README.md).
     4  
     5  Users of boskos need to use boskos client to communicate with the deployed boskos service.
     6  
     7  # Initialize
     8  
     9  A boskos client instance is initialized with the URL of target boskos server accompanied with owner of the client.
    10  
    11  The client object looks like:
    12  
    13  ```
    14  type Client struct {
    15  	url       string
    16  	resources []string
    17  	owner     string
    18  }
    19  ```
    20  
    21  To create a boskos client, use NewClient func, specify boskos server url, and owner of the client:
    22  ```
    23  func NewClient(url string, owner string) *Client
    24  ```
    25  
    26  
    27  # API Reference
    28  
    29  ```
    30  // Acquire asks boskos for a resource of certain type in certain state, and set the resource to dest state.
    31  func (c *Client) Acquire(rtype string, state string, dest string) (string, error)
    32  
    33  // ReleaseAll returns all resources hold by the client back to boskos and set them to dest state.
    34  func (c *Client) ReleaseAll(dest string) error
    35  
    36  // ReleaseOne returns one of owned resources back to boskos and set it to dest state.
    37  func (c *Client) ReleaseOne(name string, dest string) error
    38  
    39  // UpdateAll signals update for all resources hold by the client.
    40  func (c *Client) UpdateAll(state string) error
    41  
    42  // UpdateOne signals update for one of the resources hold by the client.
    43  func (c *Client) UpdateOne(name string, state string) error
    44  
    45  // Reset will scan all boskos resources of type, in state, last updated before expire, and set them to dest state.
    46  // Returns a map of {resourceName:owner} for further actions.
    47  func (c *Client) Reset(rtype string, state string, expire time.Duration, dest string) (map[string]string, error)
    48  ```