github.com/huiliang/nomad@v0.2.1-0.20151124023127-7a8b664699ff/api/raw.go (about)

     1  package api
     2  
     3  // Raw can be used to do raw queries against custom endpoints
     4  type Raw struct {
     5  	c *Client
     6  }
     7  
     8  // Raw returns a handle to query endpoints
     9  func (c *Client) Raw() *Raw {
    10  	return &Raw{c}
    11  }
    12  
    13  // Query is used to do a GET request against an endpoint
    14  // and deserialize the response into an interface using
    15  // standard Nomad conventions.
    16  func (raw *Raw) Query(endpoint string, out interface{}, q *QueryOptions) (*QueryMeta, error) {
    17  	return raw.c.query(endpoint, out, q)
    18  }
    19  
    20  // Write is used to do a PUT request against an endpoint
    21  // and serialize/deserialized using the standard Nomad conventions.
    22  func (raw *Raw) Write(endpoint string, in, out interface{}, q *WriteOptions) (*WriteMeta, error) {
    23  	return raw.c.write(endpoint, in, out, q)
    24  }
    25  
    26  // Delete is used to do a DELETE request against an endpoint
    27  // and serialize/deserialized using the standard Nomad conventions.
    28  func (raw *Raw) Delete(endpoint string, out interface{}, q *WriteOptions) (*WriteMeta, error) {
    29  	return raw.c.delete(endpoint, out, q)
    30  }