anatools.anaclient.services module¶
Services Functions
- add_workspace_services(self, serviceIds, workspaceId=None)¶
Add a service to a workspace.
- Parameters
workspaceId (str) – Workspace ID of the workspace to add the service to. If not specified, the current workspace is used.
serviceIds (str) – Service IDs of the services to add to the workspace.
- Returns
If true, the services were successfully added to the workspace.
- Return type
bool
- build_service(self, servicefile, ignore=['data/', 'output/'])¶
Build the Docker image of a service.
- Parameters
servicefile (str) – The service file for the service to build.
ignore (list, optional) – List of files or directories to ignore during the build.
- Returns
A boolean that indicates if the service Docker image was successfully built.
- Return type
bool
- create_service(self, name, description=None, organizationId=None, serviceTypeId=None, volumes=[], instance=None, tags=[])¶
Create a new service for your organization.
- Parameters
name (str) – Service name.
description (str) – Description of the service
organizationId (str) – Organization ID. Defaults to current if not specified.
serviceType (str) – The service type that the service adheres to.
volumes (list[str]) – List of the data volume names to associate with this service.
instance (str) – AWS Instance type the service will run on.
tags (list[str]) – List of tags to associate with this service.
- Returns
ServiceId of the new service.
- Return type
str
- create_service_job(self, serviceId, name, description=None, payload=None, workspaceId=None)¶
Create a service job for a service.
- Parameters
workspaceId (str) – Workspace ID of the workspace to create the job for. If not specified, the current workspace is used.
serviceId (str) – Service ID of the service to create the job for.
name (str) – Name of the job.
description (str) – Description of the job.
payload (dict) – Payload for the job.
- Returns
JobId of the created job.
- Return type
str
- delete_service(self, serviceId)¶
Delete a service from your organization.
- Parameters
serviceId (str) – Id of service to delete.
- Returns
Status
- Return type
str
- delete_service_job(self, jobId, workspaceId=None)¶
Delete a service job for a service.
- Parameters
workspaceId (str) – Workspace ID of the workspace to delete the job from. If not specified, the current workspace is used.
jobId (str) – JobId of the job to delete.
- Returns
If true, the job was successfully deleted.
- Return type
bool
- deploy_service(self, serviceId=None, servicefile=None)¶
Deploy the Docker image of a service.
- Parameters
serviceId (str) – ServiceId that you are pushing the image to.
servicefile (str) – Name of the service file to look for.
- Returns
deploymentId for current service deployment
- Return type
str
- edit_service(self, serviceId, name=None, description=None, volumes=None, instance=None, tags=None)¶
Edit a service for your organization.
- Parameters
serviceId (str) – Service ID of the service to edit.
name (name) – The new name to give the service.
description (str) – Description of the service.
volumes (list[str]) – Data volumes for the service.
instance (str) – AWS Instance type to run the service on.
tags (list[str]) –
- Returns
If true, the service was successfully edited.
- Return type
bool
- get_instance_types(self)¶
Get the available instance types for a service.
- Returns
List of instance types.
- Return type
list
- get_service_deployment(self, deploymentId, stream=False)¶
Retrieves status for a service deployment.
- Parameters
deploymentId (str) – The deploymentId to retrieve status for
stream (bool) – Flag to monitor deployment status until complete.
- Returns
Deployment status.
- Return type
list[dict]
- get_service_jobs(self, workspaceId=None, jobId=None, cursor=None, limit=None, filters=None, fields=None)¶
Fetches all service jobs that have run in a workspace.
- Parameters
workspaceId (str) – The workspace to fetch the service jobs from. If not specified, the current workspace is used.
jobId (str) – Filter service jobs list on the specific jobId.
cursor (str) – Cursor for pagination.
limit (int) – Maximum of service jobs to return.
filters (dict) – Filters that limit output to entries that match the filter
fields (list) – List of fields to return, leave empty to get all fields.
- Returns
List of service jobs associated with workspace.
- Return type
list[dict]
- get_service_types(self, fields=None)¶
Get the service types supported by the platform.
- Parameters
fields (list) – List of fields to return, leave empty to get all fields.
- Returns
service types
- Return type
list[dict]
- get_services(self, organizationId=None, workspaceId=None, serviceId=None, cursor=None, limit=None, filters=None, fields=None)¶
Fetches all services available to an organization or workspace.
- Parameters
organizationId (str) – Filter services list on what’s available to the organization.
workspaceId (str) – Filter services list on what’s available to the workspace.
serviceId (str) – Filter services list on the specific serviceId.
cursor (str) – Cursor for pagination.
limit (int) – Maximum of services to return.
filters (dict) – Filters that limit output to entries that match the filter
fields (list) – List of fields to return, leave empty to get all fields.
- Returns
List of services associated with workspace, organization or serviceId.
- Return type
list[dict]
- get_workspace_service_credentials(self, workspaceId=None)¶
Get the credentials for a workspace service.
- Parameters
workspaceId (str) – Workspace ID of the workspace to get the service credentials for. If not specified, the current workspace is used.
- Returns
Dictionary of credentials for the workspace service.
- Return type
dict
- remove_workspace_services(self, serviceIds, workspaceId=None)¶
Remove a service from a workspace.
- Parameters
workspaceId (str) – Workspace ID of the workspace to remove the service from. If not specified, the current workspace is used.
serviceIds (str) – Service IDs of the services to remove from the workspace.
- Returns
If true, the services were successfully removed from the workspace.
- Return type
bool