public interface ChefApi extends Closeable
Modifier and Type | Method and Description |
---|---|
ChefService |
chefService()
Provides access to high level Chef features.
|
Sandbox |
commitSandbox(String id,
boolean isCompleted)
Confirms if the sandbox is completed or not.
|
Client |
createClient(String clientName)
Creates a new client.
|
Client |
createClient(String clientName,
CreateClientOptions options)
Creates a new client with custom options.
|
void |
createDatabag(String databagName)
Creates a new data bag.
|
DatabagItem |
createDatabagItem(String databagName,
DatabagItem databagItem)
Adds an item in a data bag.
|
void |
createEnvironment(Environment environment)
Creates a new environment.
|
void |
createNode(Node node)
Creates a new node.
|
void |
createRole(Role role)
Creates a new role.
|
UploadSandbox |
createUploadSandboxForChecksums(Set<List<Byte>> md5s)
Creates a new sandbox.
|
Client |
deleteClient(String clientName)
Deletes the given client.
|
CookbookVersion |
deleteCookbook(String cookbookName,
String version)
Deletes the given cookbook.
|
void |
deleteDatabag(String databagName)
Deletes a data bag, including its items.
|
DatabagItem |
deleteDatabagItem(String databagName,
String databagItemId)
Deletes an item from a data bag.
|
Environment |
deleteEnvironment(String environmentName)
Deletes the given environment.
|
Node |
deleteNode(String nodeName)
Deletes the given node.
|
Role |
deleteRole(String roleName)
Deletes the given role.
|
Client |
generateKeyForClient(String clientName)
Generates a new key-pair for this client, and return the new private key in
the response body.
|
Client |
getClient(String clientName)
Gets the details of existing client.
|
CookbookVersion |
getCookbook(String cookbookName,
String version)
Gets the details of the given cookbook, with the links to each resource
such as recipe files, attributes, etc.
|
CookbookDefinition |
getCookbookInEnvironment(String environmentName,
String cookbookName)
Gets the definition of the cookbook in the given environment.
|
CookbookDefinition |
getCookbookInEnvironment(String environmentName,
String cookbookName,
String numVersions)
Gets the definition of the cookbook in the given environment.
|
DatabagItem |
getDatabagItem(String databagName,
String databagItemId)
Gets an item in a data bag.
|
Environment |
getEnvironment(String environmentName)
Gets the details of an existing environment.
|
Node |
getNode(String nodeName)
Gets the details of the given node.
|
InputStream |
getResourceContents(Resource resource)
Gets the contents of the given resource.
|
Role |
getRole(String roleName)
Gets the details of the given role.
|
Set<String> |
listClients()
Lists the names of the existing clients.
|
Set<String> |
listCookbooks()
Lists the names of the existing cookbooks.
|
Set<CookbookDefinition> |
listCookbooksInEnvironment(String environmentName)
Lists the cookbooks that are available in the given environment.
|
Set<CookbookDefinition> |
listCookbooksInEnvironment(String environmentName,
String numVersions)
Lists the cookbooks that are available in the given environment, limiting
the number of versions returned for each cookbook.
|
Set<String> |
listDatabagItems(String databagName)
Lists the names of the items in a data bag.
|
Set<String> |
listDatabags()
Lists the names of the existing data bags.
|
Set<String> |
listEnvironments()
Lists the names of the existing environments.
|
Set<String> |
listNodes()
Lists the names of the existing nodes.
|
Set<String> |
listNodesInEnvironment(String environmentName)
Lists the names of the nodes in the given environment.
|
Set<String> |
listRecipesInEnvironment(String environmentName)
Lists the names of the recipes in the given environment.
|
Set<String> |
listRoles()
Lists the names of the existing roles.
|
Set<String> |
listSearchIndexes()
Lists the names of the available search indexes.
|
Set<String> |
listVersionsOfCookbook(String cookbookName)
Lists the available versions of the given cookbook.
|
com.google.common.base.Optional<OrganizationApi> |
organizationApi()
Provides access to the organization, user and group management endpoints.
|
SearchResult<? extends Client> |
searchClients()
Searches all clients.
|
SearchResult<? extends Client> |
searchClients(SearchOptions options)
Searches all clients that match the given options.
|
SearchResult<? extends DatabagItem> |
searchDatabagItems(String databagName)
Searches all items in a data bag.
|
SearchResult<? extends DatabagItem> |
searchDatabagItems(String databagName,
SearchOptions options)
Searches all items in a data bag that match the given options.
|
SearchResult<? extends Environment> |
searchEnvironments()
Searches all environments.
|
SearchResult<? extends Environment> |
searchEnvironments(SearchOptions options)
Searches all environments that match the given options.
|
SearchResult<? extends Node> |
searchNodes()
Searches all nodes.
|
SearchResult<? extends Node> |
searchNodes(SearchOptions options)
Searches all nodes that match the given options.
|
SearchResult<? extends Role> |
searchRoles()
Searches all roles.
|
SearchResult<? extends Role> |
searchRoles(SearchOptions options)
Searches all roles that match the given options.
|
CookbookVersion |
updateCookbook(String cookbookName,
String version,
CookbookVersion cookbook)
Creates or updates the given cookbook.
|
DatabagItem |
updateDatabagItem(String databagName,
DatabagItem item)
Updates an item in a data bag.
|
Environment |
updateEnvironment(Environment environment)
Updates the given environment.
|
Node |
updateNode(Node node)
Updates an existing node.
|
Role |
updateRole(Role role)
Updates the given role.
|
void |
uploadContent(URI location,
Payload content)
Uploads the given content to the sandbox at the given URI.
|
@Provides ChefService chefService()
com.google.common.base.Optional<OrganizationApi> organizationApi()
@Named(value="client:list") Set<String> listClients()
@Named(value="client:get") Client getClient(String clientName)
clientName
- The name of the client to get.@Named(value="client:create") Client createClient(String clientName)
clientName
- The name of the new client@Named(value="client:create") Client createClient(String clientName, CreateClientOptions options)
clientName
- The name of the new clientoptions
- The options to customize the client creation.@Named(value="client:generatekey") Client generateKeyForClient(String clientName)
clientName
- The name of the client.@Named(value="client:delete") Client deleteClient(String clientName)
clientName
- The name of the client to delete.@Named(value="cookbook:list") Set<String> listCookbooks()
@Named(value="cookbook:list") Set<CookbookDefinition> listCookbooksInEnvironment(String environmentName)
environmentName
- The name of the environment to get the cookbooks
from.@Named(value="cookbook:list") Set<CookbookDefinition> listCookbooksInEnvironment(String environmentName, String numVersions)
environmentName
- The name of the environment to get the cookbooks
from.numVersions
- The number of cookbook versions to include in the
response, where n is the number of cookbook versions.@Named(value="cookbook:versions") Set<String> listVersionsOfCookbook(String cookbookName)
cookbookName
- The name of the cookbook.@Named(value="cookbook:get") CookbookVersion getCookbook(String cookbookName, String version)
cookbookName
- The name of the cookbook.version
- The version of the cookbook to get.@Named(value="environment:cookbook") CookbookDefinition getCookbookInEnvironment(String environmentName, String cookbookName)
environmentName
- The name of the environment.cookbookName
- The name of the cookbook.@Named(value="environment:cookbook") CookbookDefinition getCookbookInEnvironment(String environmentName, String cookbookName, String numVersions)
environmentName
- The name of the environment.cookbookName
- The name of the cookbook.numVersions
- The number of cookbook versions to include in the
response, where n is the number of cookbook versions.@Named(value="environment:recipelist") Set<String> listRecipesInEnvironment(String environmentName)
environmentName
- The name of the environment.@Named(value="cookbook:update") CookbookVersion updateCookbook(String cookbookName, String version, CookbookVersion cookbook)
cookbookName
- The name of the cookbook to create or update.version
- The version of the cookbook to create or update.cookbook
- The contents of the cookbook to create or update.@Named(value="cookbook:delete") CookbookVersion deleteCookbook(String cookbookName, String version)
cookbookName
- The name of the cookbook to delete.version
- The version of the cookbook to delete.@Named(value="databag:list") Set<String> listDatabags()
@Named(value="databag:create") void createDatabag(String databagName)
databagName
- The name for the new data bag.@Named(value="databag:delete") void deleteDatabag(String databagName)
databagName
- The name of the data bag to delete.@Named(value="databag:listitems") Set<String> listDatabagItems(String databagName)
databagName
- The name of the data bag.@Named(value="databag:getitem") DatabagItem getDatabagItem(String databagName, String databagItemId)
databagName
- The name of the data bag.databagItemId
- The identifier of the item to get.@Named(value="databag:createitem") DatabagItem createDatabagItem(String databagName, DatabagItem databagItem)
databagName
- The name of the data bag.databagItem
- item to add to the data bag.@Named(value="databag:updateitem") DatabagItem updateDatabagItem(String databagName, DatabagItem item)
databagName
- The name of the data bag.item
- The new contents for the item in the data bag.@Named(value="databag:deleteitem") DatabagItem deleteDatabagItem(String databagName, String databagItemId)
databagName
- The name of the data bag.databagItemId
- The identifier of the item to delete.@Named(value="environment:list") Set<String> listEnvironments()
@Named(value="environment:get") Environment getEnvironment(String environmentName)
environmentName
- The name of the environment to get.@Named(value="environment:create") void createEnvironment(Environment environment)
environment
- The environment to create.@Named(value="environment:update") Environment updateEnvironment(Environment environment)
environment
- The new details for the environment.@Named(value="environment:delete") Environment deleteEnvironment(String environmentName)
environmentName
- The name of the environment to delete.@Named(value="node:list") Set<String> listNodes()
@Named(value="environment:nodelist") Set<String> listNodesInEnvironment(String environmentName)
environmentName
- The name of the environment.@Named(value="node:get") Node getNode(String nodeName)
nodeName
- The name of the node to get.@Named(value="node:create") void createNode(Node node)
node
- The details of the node to create.@Named(value="node:update") Node updateNode(Node node)
node
- The new details for the node.@Named(value="node:delete") Node deleteNode(String nodeName)
nodeName
- The name of the node to delete.@Named(value="role:list") Set<String> listRoles()
@Named(value="role:get") Role getRole(String roleName)
roleName
- The name of the role to get.@Named(value="role:create") void createRole(Role role)
role
- The details for the new role.@Named(value="role:update") Role updateRole(Role role)
role
- The new details for the role.@Named(value="role:delete") Role deleteRole(String roleName)
roleName
- The name of the role to delete.@Named(value="sandbox:upload") UploadSandbox createUploadSandboxForChecksums(Set<List<Byte>> md5s)
It accepts a list of checksums as input and returns the URLs against which to PUT files that need to be uploaded.
md5s
- The raw md5 sums. Uses Bytes.asList()
and
Bytes.toByteArray()
as necessary@Named(value="content:upload") void uploadContent(URI location, Payload content)
The URI must be obtained, after uploading a sandbox, from the
UploadSandbox.getUri()
.
location
- The URI where the upload must be performed.content
- The contents to upload.@Named(value="content:get") InputStream getResourceContents(Resource resource)
resource
- The resource to get.@Named(value="sandbox:commit") Sandbox commitSandbox(String id, boolean isCompleted)
This method should be used after uploading contents to the sandbox.
id
- The id of the sandbox to commit.isCompleted
- Flag to set if the sandbox is completed or not.@Named(value="search:indexes") Set<String> listSearchIndexes()
By default, the "role", "node" and "api" indexes will always be available.
Note that the search indexes may lag behind the most current data by at least 10 seconds at any given time - so if you need to write data and immediately query it, you likely need to produce an artificial delay (or simply retry until the data is available).
@Named(value="search:clients") SearchResult<? extends Client> searchClients()
Note that without any request parameters this will return all of the data within the index.
@Named(value="search:clients") SearchResult<? extends Client> searchClients(SearchOptions options)
@Named(value="search:databag") SearchResult<? extends DatabagItem> searchDatabagItems(String databagName)
Note that without any request parameters this will return all of the data within the index.
@Named(value="search:databag") SearchResult<? extends DatabagItem> searchDatabagItems(String databagName, SearchOptions options)
@Named(value="search:environments") SearchResult<? extends Environment> searchEnvironments()
Note that without any request parameters this will return all of the data within the index.
@Named(value="search:environments") SearchResult<? extends Environment> searchEnvironments(SearchOptions options)
@Named(value="search:nodes") SearchResult<? extends Node> searchNodes()
Note that without any request parameters this will return all of the data within the index.
@Named(value="search:nodes") SearchResult<? extends Node> searchNodes(SearchOptions options)
@Named(value="search:roles") SearchResult<? extends Role> searchRoles()
Note that without any request parameters this will return all of the data within the index.
@Named(value="search:roles") SearchResult<? extends Role> searchRoles(SearchOptions options)
Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.