Package com.structurizr.api
Class WorkspaceApiClient
java.lang.Object
com.structurizr.api.AbstractApiClient
com.structurizr.api.WorkspaceApiClient
A client for the Structurizr workspace API that allows you to get and put Structurizr workspaces in a JSON format.
-
Field Summary
Fields inherited from class com.structurizr.api.AbstractApiClient
agent, STRUCTURIZR_CLOUD_SERVICE_API_URL, STRUCTURIZR_FOR_JAVA_AGENT, url, VERSION, WORKSPACE_PATH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWorkspaceApiClient(String apiKey, String apiSecret) Creates a new Structurizr API client with the specified API key and secret, for the Structurizr cloud service.WorkspaceApiClient(String url, String apiKey, String apiSecret) Creates a new Structurizr client with the specified API URL, key and secret. -
Method Summary
Modifier and TypeMethodDescriptioncom.structurizr.WorkspacegetWorkspace(long workspaceId) Gets the workspace with the given ID.Gets the location where a copy of the workspace is archived when it is retrieved from the server.booleanlockWorkspace(long workspaceId) Locks the workspace with the given ID.voidputWorkspace(long workspaceId, com.structurizr.Workspace workspace) Updates the given workspace.protected voidprotected voidsetApiSecret(String apiSecret) voidsetEncryptionStrategy(EncryptionStrategy encryptionStrategy) Sets the encryption strategy for use when getting or putting workspaces.voidsetIdGenerator(com.structurizr.model.IdGenerator idGenerator) Sets the ID generator to use when parsing a JSON workspace definition.voidsetMergeFromRemote(boolean mergeFromRemote) Specifies whether the layout of diagrams from a remote workspace should be retained when putting a new version of the workspace.voidvoidsetWorkspaceArchiveLocation(File workspaceArchiveLocation) Sets the location where a copy of the workspace will be archived whenever it is retrieved from the server.booleanunlockWorkspace(long workspaceId) Unlocks the workspace with the given ID.Methods inherited from class com.structurizr.api.AbstractApiClient
getAgent, setAgent, setUrl
-
Constructor Details
-
WorkspaceApiClient
protected WorkspaceApiClient() -
WorkspaceApiClient
Creates a new Structurizr API client with the specified API key and secret, for the Structurizr cloud service.- Parameters:
apiKey- the API key of your workspaceapiSecret- the API secret of your workspace
-
WorkspaceApiClient
Creates a new Structurizr client with the specified API URL, key and secret.- Parameters:
url- the URL of your Structurizr instanceapiKey- the API key of your workspaceapiSecret- the API secret of your workspace
-
-
Method Details
-
setIdGenerator
public void setIdGenerator(com.structurizr.model.IdGenerator idGenerator) Sets the ID generator to use when parsing a JSON workspace definition.- Parameters:
idGenerator- an IdGenerator implementation
-
setApiKey
-
setApiSecret
-
getWorkspaceArchiveLocation
Gets the location where a copy of the workspace is archived when it is retrieved from the server.- Returns:
- a File instance representing a directory, or null if this client instance is not archiving
-
setWorkspaceArchiveLocation
Sets the location where a copy of the workspace will be archived whenever it is retrieved from the server. Set this to null if you don't want archiving.- Parameters:
workspaceArchiveLocation- a File instance representing a directory, or null if you don't want archiving
-
setEncryptionStrategy
Sets the encryption strategy for use when getting or putting workspaces.- Parameters:
encryptionStrategy- an EncryptionStrategy implementation
-
setMergeFromRemote
public void setMergeFromRemote(boolean mergeFromRemote) Specifies whether the layout of diagrams from a remote workspace should be retained when putting a new version of the workspace.- Parameters:
mergeFromRemote- true if layout information should be merged from the remote workspace, false otherwise
-
lockWorkspace
Locks the workspace with the given ID.- Parameters:
workspaceId- the ID of your workspace- Returns:
- true if the workspace could be locked, false otherwise
- Throws:
StructurizrClientException- if there are problems related to the network, authorization, etc
-
unlockWorkspace
Unlocks the workspace with the given ID.- Parameters:
workspaceId- the ID of your workspace- Returns:
- true if the workspace could be unlocked, false otherwise
- Throws:
StructurizrClientException- if there are problems related to the network, authorization, etc
-
getWorkspace
Gets the workspace with the given ID.- Parameters:
workspaceId- the workspace ID- Returns:
- a Workspace instance
- Throws:
StructurizrClientException- if there are problems related to the network, authorization, JSON deserialization, etc
-
putWorkspace
public void putWorkspace(long workspaceId, com.structurizr.Workspace workspace) throws StructurizrClientException Updates the given workspace.- Parameters:
workspaceId- the workspace IDworkspace- the workspace instance to update- Throws:
StructurizrClientException- if there are problems related to the network, authorization, JSON serialization, etc
-
setUser
-