Base API Library
openstackclient.api.api.
BaseAPI
(session=None, service_type=None, endpoint=None, **kwargs)¶Bases: openstackclient.api.api.KeystoneSession
Base API
create
(url, session=None, method=None, **params)¶Create a new resource
Parameters: |
|
---|
delete
(url, session=None, **params)¶Delete a resource
Parameters: |
|
---|
find
(path, value=None, attr=None)¶Find a single resource by name or ID
Parameters: |
|
---|
find_attr
(path, value=None, attr=None, resource=None)¶Find a resource via attribute or ID
Most APIs return a list wrapped by a dict with the resource name as key. Some APIs (Identity) return a dict when a query string is present and there is one return value. Take steps to unwrap these bodies and return a single dict without any resource wrappers.
Parameters: |
|
---|
find_bulk
(path, **kwargs)¶Bulk load and filter locally
Parameters: |
|
---|---|
Returns: | list of resource dicts |
find_one
(path, **kwargs)¶Find a resource by name or ID
Parameters: | path (string) – The API-specific portion of the URL path |
---|---|
Returns: | resource dict |
list
(path, session=None, body=None, detailed=False, **params)¶Return a list of resources
GET ${ENDPOINT}/${PATH}?${PARAMS}
path is often the object’s plural resource type
Parameters: |
|
---|---|
Returns: | JSON-decoded response, could be a list or a dict-wrapped-list |
openstackclient.api.api.
KeystoneSession
(session=None, endpoint=None, **kwargs)¶Bases: object
Wrapper for the Keystone Session
Restore some requests.session.Session compatibility; keystoneauth1.session.Session.request() has the method and url arguments swapped from the rest of the requests-using world.
Authentication Plugin Library
openstackclient.api.auth_plugin.
TokenEndpoint
¶Bases: keystoneauth1.loading.base.BaseLoader
Auth plugin to handle traditional token/endpoint usage
Keystoneauth contains a Token plugin class that now correctly handles the token/endpoint auth compatible with OSC. However, the AdminToken loader deprecates the ‘url’ argument, which breaks OSC compatibility, so make one that works.
get_options
()¶Return the legacy options
load_from_options
(url, token, **kwargs)¶A plugin for static authentication with an existing token
Parameters: |
|
---|
plugin_class
¶Compute v2 API Library
openstackclient.api.compute_v2.
APIv2
(**kwargs)¶Bases: osc_lib.api.api.BaseAPI
Compute v2 API
find
(path, value=None, attr=None)¶Find a single resource by name or ID
Parameters: |
|
---|
floating_ip_add
(server, address, fixed_address=None)¶Add a floating IP to a server
Parameters: |
|
---|
floating_ip_create
(pool=None)¶Create a new floating ip
https://developer.openstack.org/api-ref/compute/#create-allocate-floating-ip-address
Parameters: | pool – Name of floating IP pool |
---|
floating_ip_delete
(floating_ip_id=None)¶Delete a floating IP
https://developer.openstack.org/api-ref/compute/#delete-deallocate-floating-ip-address
Parameters: | floating_ip_id (string) – Floating IP ID |
---|
floating_ip_find
(floating_ip=None)¶Return a security group given name or ID
https://developer.openstack.org/api-ref/compute/#list-floating-ip-addresses
Parameters: | floating_ip (string) – Floating IP address |
---|---|
Returns: | A dict of the floating IP attributes |
floating_ip_list
()¶Get floating IPs
https://developer.openstack.org/api-ref/compute/#show-floating-ip-address-details
Returns: | list of floating IPs |
---|
floating_ip_pool_list
()¶Get floating IP pools
https://developer.openstack.org/api-ref/compute/?expanded=#list-floating-ip-pools
Returns: | list of floating IP pools |
---|
floating_ip_remove
(server, address)¶Remove a floating IP from a server
Parameters: |
|
---|
host_list
(zone=None)¶Lists hypervisor Hosts
https://developer.openstack.org/api-ref/compute/#list-hosts Valid for Compute 2.0 - 2.42
Parameters: | zone (string) – Availability zone |
---|---|
Returns: | A dict of the floating IP attributes |
host_set
(host=None, status=None, maintenance_mode=None, **params)¶Modify host properties
https://developer.openstack.org/api-ref/compute/#update-host-status Valid for Compute 2.0 - 2.42
status maintenance_mode
host_show
(host=None)¶Show host
https://developer.openstack.org/api-ref/compute/#show-host-details Valid for Compute 2.0 - 2.42
network_create
(name=None, subnet=None, share_subnet=None)¶Create a new network
https://developer.openstack.org/api-ref/compute/#create-network
Parameters: |
|
---|---|
Returns: | A dict of the network attributes |
network_delete
(network=None)¶Delete a network
https://developer.openstack.org/api-ref/compute/#delete-network
Parameters: | network (string) – Network name or ID |
---|
network_find
(network=None)¶Return a network given name or ID
https://developer.openstack.org/api-ref/compute/#show-network-details
Parameters: | network (string) – Network name or ID |
---|---|
Returns: | A dict of the network attributes |
network_list
()¶Get networks
https://developer.openstack.org/api-ref/compute/#list-networks
Returns: | list of networks |
---|
security_group_create
(name=None, description=None)¶Create a new security group
https://developer.openstack.org/api-ref/compute/#create-security-group
Parameters: |
|
---|
security_group_delete
(security_group=None)¶Delete a security group
https://developer.openstack.org/api-ref/compute/#delete-security-group
Parameters: | security_group (string) – Security group name or ID |
---|
security_group_find
(security_group=None)¶Return a security group given name or ID
https://developer.openstack.org/api-ref/compute/#show-security-group-details
Parameters: | security_group (string) – Security group name or ID |
---|---|
Returns: | A dict of the security group attributes |
security_group_list
(limit=None, marker=None, search_opts=None)¶Get security groups
https://developer.openstack.org/api-ref/compute/#list-security-groups
Parameters: |
|
---|---|
Returns: | list of security groups names |
security_group_rule_create
(security_group_id=None, ip_protocol=None, from_port=None, to_port=None, remote_ip=None, remote_group=None)¶Create a new security group rule
https://developer.openstack.org/api-ref/compute/#create-security-group-rule
Parameters: |
|
---|
security_group_rule_delete
(security_group_rule_id=None)¶Delete a security group rule
https://developer.openstack.org/api-ref/compute/#delete-security-group-rule
Parameters: | security_group_rule_id (string) – Security group rule ID |
---|
security_group_set
(security_group=None, **params)¶Update a security group
https://developer.openstack.org/api-ref/compute/#update-security-group
Parameters: | security_group (string) – Security group name or ID |
---|
TODO(dtroyer): Create an update method in osc-lib
Image v1 API Library
openstackclient.api.image_v1.
APIv1
(endpoint=None, **kwargs)¶Bases: openstackclient.api.api.BaseAPI
Image v1 API
image_list
(detailed=False, public=False, private=False, **filter)¶Get available images
Parameters: |
|
---|
If public and private are both True or both False then all images are returned. Both arguments False is equivalent to no filter and all images are returned. Both arguments True is a filter that includes both public and private images which is the same set as all images.
http://docs.openstack.org/api/openstack-image-service/1.1/content/requesting-a-list-of-public-vm-images.html http://docs.openstack.org/api/openstack-image-service/1.1/content/requesting-detailed-metadata-on-public-vm-images.html http://docs.openstack.org/api/openstack-image-service/1.1/content/filtering-images-returned-via-get-images-and-get-imagesdetail.html
Image v2 API Library
openstackclient.api.image_v2.
APIv2
(endpoint=None, **kwargs)¶Bases: openstackclient.api.image_v1.APIv1
Image v2 API
image_list
(detailed=False, public=False, private=False, community=False, shared=False, **filter)¶Get available images
can add limit/marker
Parameters: |
|
---|
If public, private, community and shared are all True or all False then all images are returned. All arguments False is equivalent to no filter and all images are returned. All arguments True is a filter that includes all public, private, community and shared images which is the same set as all images.
http://docs.openstack.org/api/openstack-image-service/2.0/content/list-images.html
Object Store v1 API Library
openstackclient.api.object_store_v1.
APIv1
(**kwargs)¶Bases: openstackclient.api.api.BaseAPI
Object Store v1 API
account_set
(properties)¶Set account properties
Parameters: | properties (dict) – properties to add or update for the account |
---|
account_show
()¶Show account details
account_unset
(properties)¶Unset account properties
Parameters: | properties (dict) – properties to remove from the account |
---|
container_create
(container=None)¶Create a container
Parameters: | container (string) – name of container to create |
---|---|
Returns: | dict of returned headers |
container_delete
(container=None)¶Delete a container
Parameters: | container (string) – name of container to delete |
---|
container_list
(all_data=False, limit=None, marker=None, end_marker=None, prefix=None, **params)¶Get containers in an account
Parameters: |
|
---|---|
Returns: | list of container names |
container_save
(container=None)¶Save all the content from a container
Parameters: | container (string) – name of container to save |
---|
container_set
(container, properties)¶Set container properties
Parameters: |
|
---|
container_show
(container=None)¶Get container details
Parameters: | container (string) – name of container to show |
---|---|
Returns: | dict of returned headers |
container_unset
(container, properties)¶Unset container properties
Parameters: |
|
---|
object_create
(container=None, object=None, name=None)¶Create an object inside a container
Parameters: |
|
---|---|
Returns: | dict of returned headers |
object_delete
(container=None, object=None)¶Delete an object from a container
Parameters: |
|
---|
object_list
(container=None, all_data=False, limit=None, marker=None, end_marker=None, delimiter=None, prefix=None, **params)¶List objects in a container
Parameters: |
|
---|---|
Returns: | a tuple of (response headers, a list of objects) The response headers will be a dict and all header names will be lowercase. |
object_save
(container=None, object=None, file=None)¶Save an object stored in a container
Parameters: |
|
---|
object_set
(container, object, properties)¶Set object properties
Parameters: |
|
---|
object_show
(container=None, object=None)¶Get object details
Parameters: |
|
---|---|
Returns: | dict of object properties |
object_unset
(container, object, properties)¶Unset object properties
Parameters: |
|
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.