def __init__(self, plugins=None): """User preference for each service. :param plugins: List of entry point namespaces to load. Create a new :class:`~openstack.profile.Profile` object with no preferences defined, but knowledge of the services. Services are identified by their service type, e.g.: 'identity', 'compute', etc. """ self._services = {} self._add_service(anti_ddos_service.AntiDDosService(version="v1")) self._add_service(block_store_service.BlockStoreService(version="v2")) self._add_service(compute_service.ComputeService(version="v2")) self._add_service(cts_service.CTSService(version="v1")) self._add_service(dms_service.DMSService(version="v1")) self._add_service(identity_service.IdentityService(version="v3")) self._add_service(image_service.ImageService(version="v2")) self._add_service(kms_service.KMSService(version="v1")) self._add_service(maas_service.MaaSService(version="v1")) self._add_service(network_service.NetworkService(version="v2.0")) self._add_service( orchestration_service.OrchestrationService(version="v1")) self._add_service(smn_service.SMNService(version="v2")) # QianBiao.NG HuaWei Services self._add_service(dns_service.DNSService(version="v2")) self._add_service(cloud_eye_service.CloudEyeService(version="v1")) ass = auto_scaling_service.AutoScalingService(version="v1") self._add_service(ass) vbs_v2 = volume_backup_service.VolumeBackupService(version="v2") self._add_service(vbs_v2) self._add_service(map_reduce_service.MapReduceService(version="v1")) self._add_service(evs_service.EvsServiceV2_1(version='v2.1')) self._add_service(evs_service.EvsService(version='v2')) self._add_service(ecs_service.EcsService(version='v1')) self._add_service(ecs_service.EcsServiceV1_1(version='v1.1')) self._add_service(vpc_service.VpcService(version='v2.0')) self._add_service(bms_service.BmsService(version='v1')) self._add_service(lb_service.LoadBalancerService(version='v1')) # not support below service # self._add_service(message_service.MessageService(version="v1")) # self._add_service(cluster_service.ClusterService(version="v1")) # self._add_service(database_service.DatabaseService(version="v1")) # self._add_service(alarm_service.AlarmService(version="v2")) # self._add_service(bare_metal_service.BareMetalService(version="v1")) # self._add_service(key_manager_service.KeyManagerService(version="v1")) # self._add_service( # object_store_service.ObjectStoreService(version="v1")) self._add_service(rds_service.RDSService(version="v1")) self._add_service(cdn_service.CDNService(version='v1')) # self._add_service(rds_os_service.RDSService(version="v1")) # self._add_service(telemetry_service.TelemetryService(version="v2")) # self._add_service(workflow_service.WorkflowService(version="v2")) if plugins: for plugin in plugins: self._load_plugin(plugin) self.service_keys = sorted(self._services.keys())
class SnapshotRollback(resource2.Resource): resource_key = 'rollback' resources_key = None base_path = '/os-vendor-snapshots/%(snapshot_id)s/rollback' snapshot_id = resource2.URI('snapshot_id') service = evs_service.EvsService() allow_create = True #: The UUID of the EVS disk to be rolled back. volume_id = resource2.Body('volume_id') #: The name of the EVS disk to be rolled back. name = resource2.Body('name')
class Vloume(resource2.Resource): base_path = "/cloudvolumes" service = evs_service.EvsService() allow_create = True # string type volume name name = resource2.Body('name') # availability zone name availability_zone = resource2.Body('availability_zone') # project id project_id = resource2.Body('tenant_id') # created volume number count = resource2.Body('count', type=int) # volume type volume_type = resource2.Body('volume_type') # extend server info backup_id = resource2.Body('backup_id') snapshot_id = resource2.Body('snapshot_id') imageRef = resource2.Body('imageRef') metadata = resource2.Body('metadata') # volume size size = resource2.Body('size') # volume description description = resource2.Body('description') # whether this volume can be attached for many devices multiattach = resource2.Body('multiattach') # whether this device can be shared shareable = resource2.Body('shareable') volume = resource2.Body('volume') # task id job_id = resource2.Body('job_id') # order id order_id = resource2.Body('order_id') error = resource2.Body('error') message = resource2.Body('message') code = resource2.Body('code')
class Job(resource2.Resource): base_path = '/jobs' service = evs_service.EvsService() allow_get = True # job's status status = resource2.Body('status') # job's operation object entities = resource2.Body('entities', type=dict) # job's id job_id = resource2.Body('job_id') # job's type job_type = resource2.Body('job_type') # begin time begin_time = resource2.Body('begin_time') # end time end_time = resource2.Body('end_time') # the error code when the job execution failed error_code = resource2.Body('error_code') # the fail reason when the job execution failed fail_reason = resource2.Body('fail_reason') # the error message returned when an error occurs message = resource2.Body('message') # the error code returned when an error occurs code = resource2.Body('code') # number of subtasks sub_jobs_total = resource2.Body('sub_jobs_total', type=int) # execution information for each subtask sub_jobs = resource2.Body('sub_jobs', type=list) def get(self, session, requires_id=True): """Get a remote resource based on this instance. :param session: The session to use for making this request. :type session: :class:`~openstack.session.Session` :param boolean requires_id: A boolean indicating whether resource ID should be part of the requested URI. :return: This :class:`Resource` instance. :raises: :exc:`~openstack.exceptions.MethodNotSupported` if :data:`Resource.allow_get` is not set to ``True``. """ if not self.allow_get: raise exceptions.MethodNotSupported(self, "get") request = self._prepare_request(requires_id=requires_id) endpoint_override = self.get_endpoint_override(session) service = self.get_service_filter(self, session) response = session.get(request.uri, endpoint_filter = self.service, microversion = service.microversion, endpoint_override=endpoint_override) self._translate_response(response) return self def get_endpoint_override(self,session): endpoint = session.get_endpoint( interface=self.service.interface, service_type=self.service.service_type ) endpoint_override = re.sub(r'/v+./', "/v1/", endpoint) return endpoint_override
class Volume(resource2.Resource): base_path = "/cloudvolumes" resource_key = 'volume' service = evs_service.EvsService() allow_create = True allow_update = True allow_get = True # string type volume name name = resource2.Body('name') # availability zone name availability_zone = resource2.Body('availability_zone') # project id project_id = resource2.Body('tenant_id') # created volume number count = resource2.Body('count', type=int) # volume type volume_type = resource2.Body('volume_type') # extend server info backup_id = resource2.Body('backup_id') snapshot_id = resource2.Body('snapshot_id') imageRef = resource2.Body('imageRef') metadata = resource2.Body('metadata') # volume size size = resource2.Body('size') # volume description description = resource2.Body('description') # whether this volume can be attached for many devices multiattach = resource2.Body('multiattach') # whether this device can be shared shareable = resource2.Body('shareable') volume = resource2.Body('volume') # task id job_id = resource2.Body('job_id') # order id order_id = resource2.Body('order_id') error = resource2.Body('error') message = resource2.Body('message') code = resource2.Body('code') # Cloud hard disk uri self-description information links = resource2.Body("links", type=list) # status status = resource2.Body("status") # Mounting information of the cloud hard disk attachments = resource2.Body("attachments", type=list) # Source cloud hard disk ID, if it is created from the source cloud hard disk, there is value source_volid = resource2.Body("source_volid") # os tenant_id attr_tenant_id = resource2.Body("os-vol-tenant-attr:tenant_id") # Metadata for cloud disk image volume_image_metadata = resource2.Body("volume_image_metadata", type=dict) # created_at created_at = resource2.Body("created_at") # bootable bootable = resource2.Body("bootable") # Host where the cloud drive is located host = resource2.Body("os-vol-host-attr:host") # reserved encrypted = resource2.Body("encrypted", type=bool) # updated date updated_at = resource2.Body("updated_at") # reserved replica_status = resource2.Body("replication_status") # reserved migstat = resource2.Body("os-vol-mig-status-attr:migstat") # reserved consistencygroup_id = resource2.Body("consistencygroup_id") # reserved user_id = resource2.Body("user_id") # dedicated_storage_id dedicated_storage_id = resource2.Body("dedicated_storage_id") # dedicated_storage_name dedicated_storage_name = resource2.Body("dedicated_storage_name") # tags tags = resource2.Body("tags") # Unique identifier when the cloud drive is mounted wwn = resource2.Body("wwn") # enterprise_project_id enterprise_project_id = resource2.Body("enterprise_project_id") # service_type service_type = resource2.Body("service_type") # The cloud disk list queries the location tag, which is the same level as the volume in the response body. # If this query only returns part of the list information, it will return the url of the current disk mark tag, # and you can continue to use this url to query the remaining list information. volumes_links = resource2.Body("volumes_links", type=list) # reserved os_volume_replication_extended_status = resource2.Body("os-volume-replication:extended_status") # reserved os_vol_mig_status_attr_name_id = resource2.Body("os-vol-mig-status-attr:name_id")