image methods¶
-
class
ecl.image.v2._proxy.
Proxy
(session)[source]¶ Bases:
ecl.proxy2.BaseProxy
-
add_tag
(image_id, tag_to_add)[source]¶ Adds a specified tag to a specified image.
Parameters: - image_id – Image ID stored through the image API. Typically a UUID.
- tag – Image tag to add.
Returns: None
-
cancel_copy_image
(job_id)[source]¶ Lists details for image copy jobs.
Parameters: job_id – JOB_ID that has been paid out in the Copy API. Returns: None
-
copy_image
(image_id, tenant_id_dst)[source]¶ Copy image to a specified region.
Parameters: - image_id – An identifier for the image.
- tenant_id_dst – An identifier for the image tenant for destination region.
Returns:
-
create_image
(**attrs)[source]¶ Creates a virtual machine (VM) image.
Parameters: attrs (dict) – Keyword arguments which will be used to create a Image
, comprised of the properties on the Image class.Returns: The results of image creation Return type: Image
-
create_member
(image, **attrs)[source]¶ Create a new member from attributes
Parameters: Returns: The results of member creation
Return type:
-
delete_image
(image, ignore_missing=True)[source]¶ Delete an image
Parameters: - image – The value can be either the ID of an image or a
Image
instance. - ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the image does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent image.
Returns: None
- image – The value can be either the ID of an image or a
-
delete_member
(image, member, ignore_missing=True)[source]¶ Delete a member
Parameters: - member – The value can be either the ID of a member or a
Member
instance. - ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the member does not exist. When set toTrue
, no exception will be set when attempting to delete a nonexistent member.
Returns: None
- member – The value can be either the ID of a member or a
-
delete_tag
(image_id, tag_to_delete)[source]¶ Deletes a specified tag from a specified image.
Parameters: - image_id – Image ID stored through the image API. Typically a UUID.
- tag_to_delete – Image tag to delete.
Returns: None
-
download_image
(image_id)[source]¶ Download an image
Parameters: image – The value can be either the ID of an image or a Image
instance.Returns: The bytes comprising the given Image.
-
find_image
(name_or_id, ignore_missing=True)[source]¶ Find a single image
Parameters: - name_or_id – The name or ID of a image.
- ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource.
Returns: One
Image
or None
-
get_image
(image)[source]¶ Get a single image
Parameters: image – The value can be the ID of a image or a Image
instance.Returns: One Image
Raises: ResourceNotFound
when no resource can be found.
-
get_image_copy_job
(job_id)[source]¶ Get details for a specified image copy job.
Parameters: job_id – JOB_ID that has been paid out in the Copy API. Returns: ImageCopy
-
get_image_member_schema
()[source]¶ Gets a JSON schema document that represents an image member entity.
Returns: Scheme
-
get_image_schema
()[source]¶ Gets a JSON schema document that represents an image entity.
Returns: Scheme
-
get_images_schema
()[source]¶ Gets a JSON schema document that represents an images entity.
Returns: Scheme
-
get_member
(image, member)[source]¶ Get a single member on an image
Parameters: Returns: One
Member
Raises: ResourceNotFound
when no resource can be found.
-
get_metadata_namespace_schema
()[source]¶ Gets a JSON schema document that represents a metadata definition namespace entity.
Returns: Scheme
-
get_metadata_object_schema
()[source]¶ Gets a JSON schema document that represents a metadata definition object entity.
Returns: Scheme
-
get_metadata_property_schema
()[source]¶ Gets a JSON schema document that represents a metadata definition property entity.
Returns: Scheme
-
get_metadata_resource_type_schema
()[source]¶ Gets a JSON schema document that represents a metadata definition namespace resource type association entity.
Returns: Scheme
-
images
(**query)[source]¶ Return a generator of images
Parameters: **query (kwargs) – Optional query parameters to be sent to limit the resources being returned. Returns: A generator of image objects Return type: Image
-
licenses
()[source]¶ List image license switch types.
Returns: A generator of license objects Return type: License
-
list_image_copy_jobs
()[source]¶ Lists details for image copy jobs.
Returns: A generator of ImageCopy instances. Return type: ImageCopy
-
members
(image)[source]¶ Return a generator of members
Parameters: image – This is the image that the member belongs to, the value can be the ID of a image or a Image
instance.Returns: A generator of member objects Return type: Member
-
remove_tag
(image, tag)[source]¶ Remove a tag to an image
Parameters: - image – The value can be the ID of a image or a
Image
instance that the member will be created for. - tag (str) – The tag to be removed
Returns: None
- image – The value can be the ID of a image or a
-
update_image
(image_id, image_data)[source]¶ Update a image.
Parameters: - image_id – ID of a image.
- image_data – List of attributes(dict) to update on the image.
Returns:
-
image¶
-
class
ecl.image.v2.image.
Image
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_create
= True¶
-
allow_delete
= True¶
-
allow_get
= True¶
-
allow_list
= True¶
-
allow_update
= True¶
-
base_path
= '/v2/images'¶
-
checksum
= None¶ md5 hash of image contents
-
container_format
= None¶ The container format refers to whether the VM image is in a file format that also contains metadata about the actual VM. Container formats include OVF and Amazon AMI. In addition, a VM image might not have a container format - instead, the image is just a blob of unstructured data.
-
created_at
= None¶ Date and time of image registration
-
data
= None¶
-
direct_url
= None¶ The URL to access the image file kept in external store. It appears when you set the show_image_direct_url option to true in the Image service’s configuration file.
-
disk_format
= None¶ Valid values are: aki, ari, ami, raw, iso, vhd, vdi, qcow2, or vmdk. The disk format of a VM image is the format of the underlying disk image. Virtual appliance vendors have different formats for laying out the information contained in a VM disk image.
-
extra_key
= None¶ The key of the extra properties.
-
extra_value
= None¶ The value of the extra properties.
-
file
= None¶ URL for the virtual machine image file.
-
classmethod
find
(session, name_or_id, ignore_missing=True, **params)[source]¶ Find a resource by its name or id.
Parameters: - session (
Session
) – The session to use for making this request. - name_or_id – This resource’s identifier, if needed by
the request. The default is
None
. - ignore_missing (bool) – When set to
False
ResourceNotFound
will be raised when the resource does not exist. When set toTrue
, None will be returned when attempting to find a nonexistent resource. - params (dict) – Any additional parameters to be passed into
underlying methods, such as to
existing()
in order to pass on URI parameters.
Returns: The
Resource
object matching the given name or id or None if nothing matches.Raises: ecl.exceptions.DuplicateResource
if more than one resource is found for this request.Raises: ecl.exceptions.ResourceNotFound
if nothing is found and ignore_missing isFalse
.- session (
-
first
= None¶ URL for the first page of response
-
id
= None¶ An identifier for the image.
-
image_schema
= None¶ URL for schema of the virtual machine image.
-
image_status
= None¶ Status of the image
-
images_schema
= None¶ URL for schema of the virtual machine images.
-
locations
= None¶ Include location_url and location_metadata. location_url: URL to access the image file kept in external store (it is shown when ‘show_multiple_locations’ option is enabled)
-
min_disk
= None¶ Amount of disk space (in GB) required to boot image.
-
min_ram
= None¶ Amount of ram (in MB) required to boot image.
-
name
= None¶ Descriptive name for the image
-
os_type
= None¶ OS information of this image.
-
owner
= None¶ Owner of the image.
-
patch_update
= True¶
-
protected
= None¶ If true, image will not be deletable.
-
resources_key
= 'images'¶
-
self
= None¶
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': 'v2', 'service_type': 'image', 'requires_project_id': False, 'api_version': None}¶
-
service_type
= None¶ Service information of this image.
-
size
= None¶ Size of image file in bytes.
String related to the image
-
updated_at
= None¶ Date and time of the last image modification.
-
visibility
= None¶ The image visibility.
-
image_copy¶
-
class
ecl.image.v2.image_copy.
ImageCopy
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_create
= True¶
-
base_path
= '/v2/extension/image_replicator/jobs'¶
-
copy_progress
= None¶ progress of the image copying
-
destination_image_id
= None¶ destination image_id
-
destination_region_id
= None¶ destination region_id
-
destination_tenant_id
= None¶ destination tenant_id
-
job_id
= None¶ An identifier job’s id for the image copying.
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': 'v2', 'service_type': 'image', 'requires_project_id': False, 'api_version': None}¶
-
source_image_id
= None¶ source image_id
-
source_region_id
= None¶ source region_id
-
source_tenant_id
= None¶ source tenant_id
-
status
= None¶ job status
-
license¶
-
class
ecl.image.v2.license.
License
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
base_path
= '/v2/extension/license_switch/types'¶
-
license_switch_types
= None¶ (“WindowsServer_2012R2_Standard_64_ComLicense”, “WindowsServer_2012_Standard_64_ComLicense”, “WindowsServer_2008R2_Enterprise_64_ComLicense”, “WindowsServer_2008R2_Standard_64_ComLicense”, “Red_Hat_Enterprise_Linux_7_64bit_BYOL”)
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': 'v2', 'service_type': 'image', 'requires_project_id': False, 'api_version': None}¶
-
member¶
-
class
ecl.image.v2.member.
Member
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
allow_create
= True¶
-
allow_delete
= True¶
-
allow_get
= True¶
-
allow_list
= True¶
-
allow_update
= True¶
-
base_path
= '/v2/images/%(image_id)s/members'¶
-
created_at
= None¶ The date and time when the member was created.
-
image_id
= None¶ Image ID stored through the image API. Typically a UUID.
-
member
= None¶ Member_id used to create a member
-
member_id
= None¶ The ID of the image member. An image member is a tenant with whom the image is shared.
-
resources_key
= 'members'¶
-
schema
= None¶ The URL for schema of the member.
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': 'v2', 'service_type': 'image', 'requires_project_id': False, 'api_version': None}¶
-
status
= None¶ The status of the image.
-
updated_at
= None¶ The date and time when the member was updated.
-
schema¶
-
class
ecl.image.v2.schema.
Scheme
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
additionalProperties
= None¶ Image’s additionalProperties.
-
base_path
= '/v2/schemas'¶
-
definitions
= None¶ Metadata’s definition.
-
get_image_member_schema
(session)[source]¶ Gets a JSON schema document that represents an image member entity.
-
get_metadata_namespace_schema
(session)[source]¶ Gets a JSON schema document that represents a metadata definition namespace entity.
-
get_metadata_object_schema
(session)[source]¶ Gets a JSON schema document that represents a metadata definition object entity.
-
get_metadata_property_schema
(session)[source]¶ Gets a JSON schema document that represents a metadata definition property entity.
-
get_metadata_resource_type_schema
(session)[source]¶ Gets a JSON schema document that represents a metadata definition namespace resource type association entity.
-
links
= None¶ Image’s links.
-
name
= None¶ Image’s name.
-
properties
= None¶ Properties for image. Properties list: architecture: Operating system architecture as specified in URL. status: The image status. container_format: The container format of image. min_ram: The minimum amount of RAM in MB that is required to boot the image.. updated_at: The date and time when the resource was updated.The date and time stamp format is ISO 8601. owner: The ID of the owner, or tenant, of the image. min_disk: The minimum disk size in GB that is required to boot the image. tags: A list of Image tag. visibility: The image visibility. id: The unique ID for the image. size: The size of the image data, in bytes. virtual_size: The virtual size of the image. name: The name of the image. checksum: Hash of the image data used. The Image service uses this value for verification. created_at: The date and time when the resource was created.The date and time stamp format is ISO 8601. disk_format: The disk format of the image. properties: Properties, if any, that are associated with the image. protected: Indicates whether the image can be deleted. location: URL to access the image file kept in external store. self: URL for the virtual machine image. schema: URL for schema of the virtual machine image/member. direct_url: URL to access the image file kept in external store. instance_uuid: ID of instance used to create this image. kernel_id: ID of image stored in Glance that should be used as the kernel when booting an AMI-style image. os_distro: Common name of operating system distribution as specified in URL. os_version: Operating system version as specified by the distributor. ramdisk_id: ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image. member_id: Image member ID. For example, the tenant ID of the user with whom the image is being shared.
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': 'v2', 'service_type': 'image', 'requires_project_id': False, 'api_version': None}¶
-
tag¶
-
class
ecl.image.v2.tag.
Tag
(synchronized=False, **attrs)[source]¶ Bases:
ecl.resource2.Resource
-
base_path
= '/v2/images/%(image_id)s/tags/%(tag)s'¶
-
service
= {'region_name': None, 'service_name': None, 'interface': 'public', 'version': 'v2', 'service_type': 'image', 'requires_project_id': False, 'api_version': None}¶
-