Orchestration API

For details on how to use orchestration, see Using OpenStack Orchestration

The Orchestration Class

The orchestration high-level interface is available through the orchestration member of a Connection object. The orchestration member will only be added if the service is detected.

Stack Operations

class openstack.orchestration.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_stack(preview=False, **attrs)

Create a new stack from attributes

Parameters:
  • preview (bool) – When True, a preview endpoint will be used to verify the template Default: ``False``

  • attrs (dict) – Keyword arguments which will be used to create a Stack, comprised of the properties on the Stack class.

Returns:

The results of stack creation

Return type:

Stack

find_stack(name_or_id, ignore_missing=True, resolve_outputs=True)

Find a single stack

Parameters:
  • name_or_id – The name or ID of a stack.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.

Returns:

One Stack or None

stacks(**query)

Return a generator of stacks

Parameters:

query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of stack objects

Return type:

Stack

get_stack(stack, resolve_outputs=True)

Get a single stack

Parameters:
  • stack – The value can be the ID of a stack or a Stack instance.

  • resolve_outputs – Whether stack should contain outputs resolved.

Returns:

One Stack

Raises:

ResourceNotFound when no resource can be found.

update_stack(stack, preview=False, **attrs)

Update a stack

Parameters:
  • stack – The value can be the ID of a stack or a Stack instance.

  • attrs (kwargs) – The attributes to update on the stack represented by value.

Returns:

The updated stack

Return type:

Stack

Raises:

ResourceNotFound when no resource can be found.

delete_stack(stack, ignore_missing=True)

Delete a stack

Parameters:
  • stack – The value can be either the ID of a stack or a Stack instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the stack does not exist. When set to True, no exception will be set when attempting to delete a nonexistent stack.

Returns:

None

check_stack(stack)

Check a stack’s status

Since this is an asynchronous action, the only way to check the result is to track the stack’s status.

Parameters:

stack – The value can be either the ID of a stack or an instance of Stack.

Returns:

None

export_stack(stack)

Get the stack data in JSON format

Parameters:

stack – The value can be the ID or a name or an instance of Stack

Returns:

A dictionary containing the stack data.

Raises:

ResourceNotFound when no resource can be found.

suspend_stack(stack)

Suspend a stack status

Parameters:

stack – The value can be either the ID of a stack or an instance of Stack.

Returns:

None

resume_stack(stack)

Resume a stack status

Parameters:

stack – The value can be either the ID of a stack or an instance of Stack.

Returns:

None

get_stack_template(stack)

Get template used by a stack

Parameters:

stack – The value can be the ID of a stack or an instance of Stack

Returns:

One object of StackTemplate

Raises:

ResourceNotFound when no resource can be found.

get_stack_environment(stack)

Get environment used by a stack

Parameters:

stack – The value can be the ID of a stack or an instance of Stack

Returns:

One object of StackEnvironment

Raises:

ResourceNotFound when no resource can be found.

get_stack_files(stack)

Get files used by a stack

Parameters:

stack – The value can be the ID of a stack or an instance of Stack

Returns:

A dictionary containing the names and contents of all files used by the stack.

Raises:

ResourceNotFound when the stack cannot be found.

resources(stack, **query)

Return a generator of resources

Parameters:
  • stack – This can be a stack object, or the name of a stack for which the resources are to be listed.

  • query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of resource objects if the stack exists and there are resources in it. If the stack cannot be found, an exception is thrown.

Return type:

A generator of Resource

Raises:

ResourceNotFound when the stack cannot be found.

validate_template(template, environment=None, template_url=None, ignore_errors=None)

Validates a template.

Parameters:
  • template – The stack template on which the validation is performed.

  • environment – A JSON environment for the stack, if provided.

  • template_url – A URI to the location containing the stack template for validation. This parameter is only required if the template parameter is None. This parameter is ignored if template is specified.

  • ignore_errors – A string containing comma separated error codes to ignore. Currently the only valid error code is ‘99001’.

Returns:

The result of template validation.

Raises:

InvalidRequest if neither template not template_url is provided.

Raises:

HttpException if the template fails the validation.

Stack Event Operations

class openstack.orchestration.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
stack_events(stack, resource_name=None, **attr)

Get a stack events

Parameters:
  • stack – The value can be the ID of a stack or an instance of Stack

  • resource_name – The name of resource. If the resource_name is not None, the base_path changes.

Returns:

A generator of stack_events objects

Return type:

StackEvent

Software Configuration Operations

class openstack.orchestration.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_software_config(**attrs)

Create a new software config from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a SoftwareConfig, comprised of the properties on the SoftwareConfig class.

Returns:

The results of software config creation

Return type:

SoftwareConfig

software_configs(**query)

Returns a generator of software configs

Parameters:

query (dict) – Optional query parameters to be sent to limit the software configs returned.

Returns:

A generator of software config objects.

Return type:

SoftwareConfig

get_software_config(software_config)

Get details about a specific software config.

Parameters:

software_config – The value can be the ID of a software config or a instace of SoftwareConfig,

Returns:

An object of type SoftwareConfig

delete_software_config(software_config, ignore_missing=True)

Delete a software config

Parameters:
  • software_config – The value can be either the ID of a software config or an instance of SoftwareConfig

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the software config does not exist. When set to True, no exception will be set when attempting to delete a nonexistent software config.

Returns:

None

Software Deployment Operations

class openstack.orchestration.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_software_deployment(**attrs)

Create a new software deployment from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a SoftwareDeployment, comprised of the properties on the SoftwareDeployment class.

Returns:

The results of software deployment creation

Return type:

SoftwareDeployment

software_deployments(**query)

Returns a generator of software deployments

Parameters:

query (dict) – Optional query parameters to be sent to limit the software deployments returned.

Returns:

A generator of software deployment objects.

Return type:

SoftwareDeployment

get_software_deployment(software_deployment)

Get details about a specific software deployment resource

Parameters:

software_deployment – The value can be the ID of a software deployment or an instace of SoftwareDeployment,

Returns:

An object of type SoftwareDeployment

delete_software_deployment(software_deployment, ignore_missing=True)

Delete a software deployment

Parameters:
  • software_deployment – The value can be either the ID of a software deployment or an instance of SoftwareDeployment

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the software deployment does not exist. When set to True, no exception will be set when attempting to delete a nonexistent software deployment.

Returns:

None

update_software_deployment(software_deployment, **attrs)

Update a software deployment

Parameters:
  • server – Either the ID of a software deployment or an instance of SoftwareDeployment

  • attrs (dict) – The attributes to update on the software deployment represented by software_deployment.

Returns:

The updated software deployment

Return type:

SoftwareDeployment