class ResourceBackup(resource2.Resource): resource_key = 'checkpoint' resources_key = None base_path = '/providers/%(provider_id)s/resources/%(resource_id)s/action' service = csbs_service.CsbsService() # Capabilities. allow_create = True # Uri parameter. # Backup provider id. provider_id = resource2.URI('provider_id') # The id of the backup object. resource_id = resource2.URI('resource_id') # Request parameter. # Backup parameter. protect = resource2.Body('protect', type=dict) # Response parameter. # Status of backup. status = resource2.Body('status') # Create time. created_at = resource2.Body('created_at') # Backup record id. id = resource2.Body('id') # Resource graph. resource_graph = resource2.Body('resource_graph') # Id of project. project_id = resource2.Body('project_id') # Backup plan information. protection_plan = resource2.Body('protection_plan', type=dict)
class CheckpointItemCount(resource2.Resource): """Create a checkpoint_item_count resource.""" service = csbs_service.CsbsService() base_path = '/checkpoint_items/count' # Allowed operations on this resource. allow_get = True # Query conditions in get operation. _query_mapping = resource2.QueryParameters( 'status', 'marker', 'sort', 'all_tenants', 'name', 'az', 'resource_id', 'resource_name', 'start_time', 'end_time', 'image_type', 'policy_id', 'ip', 'offset', 'checkpoint_id', 'resource_type', 'dec' ) # limit has removed from query filter _query_mapping._mapping.pop("limit", None) # Count of checkpoint item. count = resource2.Body('count', type=int) def get(self, session, requires_id=True, **data): """Get a remote resource based on this instance. :param session: The session to use for making this request. :param requires_id: A boolean indicating whether resource ID should be part of the requested URI. :param data: Query conditions in get operation. :return: This :class:`Resource` instance. """ if not self.allow_get: raise exceptions.MethodNotSupported(self, "get") request = self._prepare_request(requires_id=requires_id) endpoint_override = self.service.get_endpoint_override() query_params = self._query_mapping._transpose(data) response = session.get(request.uri, endpoint_filter=self.service, endpoint_override=endpoint_override, params=query_params) self._translate_response(response) return self
class ResourceRecoveryCapability(resource2.Resource): resource_key = None resources_key = None base_path = '/providers/%(provider_id)s/resources/action' service = csbs_service.CsbsService() # Capabilities. allow_create = True # Uri parameter. # Backup provider id. provider_id = resource2.URI('provider_id') # Request parameter. # Query the parameter list. check_restorable = resource2.Body('check_restorable', type=list) # Response parameter. # Check parameter list. restorable = resource2.Body('restorable', type=list)
class Policy(resource2.Resource): resource_key = 'policy' resources_key = 'policies' base_path = '/policies' service = csbs_service.CsbsService() # Capabilities. allow_create = True allow_delete = True allow_update = True allow_get = True allow_list = True _query_mapping = resource2.QueryParameters('limit', 'marker', 'sort', 'name', 'all_tenants', 'offset') # Description of backup policy. description = resource2.Body('description') # Name of backup policy. name = resource2.Body('name') # Parameter of backup policy. parameters = resource2.Body('parameters', type=dict) # Backup provider id. provider_id = resource2.Body('provider_id') # A list of backup objects. resources = resource2.Body('resources', type=list) # A list of scheduling periods. scheduled_operations = resource2.Body('scheduled_operations', type=list) # Create time. created_at = resource2.Body('created_at') # Id of backup policy. id = resource2.Body('id') # Id of project. project_id = resource2.Body('project_id') # Status of backup policy. status = resource2.Body('status')
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(vpc_service.VpcServiceV1(version='v1')) self._add_service(bms_service.BmsService(version='v1')) self._add_service(deh_service.DehService(version='v1.0')) self._add_service(csbs_service.CsbsService(version='v1')) self._add_service(ims_service.ImsService(version='v2')) self._add_service(nat_service.NatService(version='v2.0')) 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(iam_service.IamService(version='v3.0')) # 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")) self._add_service(fgs_service.FGSService(version='v2')) if plugins: for plugin in plugins: self._load_plugin(plugin) self.service_keys = sorted(self._services.keys())
class Checkpoint(resource2.Resource): """Create a checkpoint resource.""" service = csbs_service.CsbsService() base_path = '/providers/%(provider_id)s/checkpoints' resource_key = 'checkpoint' # Allowed operations on this resource. allow_create = True allow_delete = True # Query conditions in delete operation. _query_mapping = resource2.QueryParameters('checkpoint_items') # Id of backup provider. provider_id = resource2.URI('provider_id') # Backup parameters. parameters = resource2.Body('parameters', type=dict) # Backup policy id. plan_id = resource2.Body('plan_id') # Auto trigger. auto_trigger = resource2.Body('auto_trigger', type=bool) # List of backup object. resources = resource2.Body('resources', type=list) # Status of checkpoint record. status = resource2.Body('status') # Create time. created_at = resource2.Body('created_at') # Id of checkpoint record. id = resource2.Body('id') # Resource graph. resource_graph = resource2.Body('resource_graph') # Id of project. project_id = resource2.Body('project_id') # Backup policy infomation. protection_plan = resource2.Body('protection_plan', type=dict) def delete(self, session, has_body=False, ignore_missing=True, **data): """Delete the remote resource based on this instance. :param session: The session to use for making this request. :param has_body: Should mapping response body to resource. :param ignore_missing: Ignore missing or error. :param data: Query conditions in delete operation. :return: This :class:`Resource` instance. """ if not self.allow_delete: raise exceptions.MethodNotSupported(self, "delete") request = self._prepare_request() endpoint_override = self.service.get_endpoint_override() query_params = self._query_mapping._transpose(data) try: response = session.delete(request.uri, endpoint_filter=self.service, endpoint_override=endpoint_override, headers={"Accept": ""}, params=query_params) except exceptions.NotFoundException: if ignore_missing: return None else: raise exceptions.ResourceNotFound( message="Not found the resource.") self._translate_response(response, has_body=has_body) return self
class CheckpointItem(resource2.Resource): """Create a checkpoint_item resource.""" service = csbs_service.CsbsService() base_path = '/checkpoint_items' resource_key = 'checkpoint_item' resources_key = 'checkpoint_items' # Allowed operations on this resource. allow_get = True allow_list = True # Query conditions in list operation. _query_mapping = resource2.QueryParameters( 'status', 'limit', 'marker', 'sort', 'all_tenants', 'name', 'az', 'resource_id', 'resource_name', 'start_time', 'end_time', 'image_type', 'policy_id', 'ip', 'offset', 'checkpoint_id', 'resource_type', 'dec' ) # Id of checkpoint. checkpoint_id = resource2.Body('checkpoint_id') # Create time. created_at = resource2.Body('created_at') # Extend infomation. extend_info = resource2.Body('extend_info', type=dict) # Id of checkpoint item. id = resource2.Body('id') # Name of checkpoint item. name = resource2.Body('name') # Id of backup object. resource_id = resource2.Body('resource_id') # Status of checkpoint item. status = resource2.Body('status') # Update time. updated_at = resource2.Body('updated_at') # Metadata of VM. backup_data = resource2.Body('backup_data', type=dict) # Description of checkpoint item. description = resource2.Body('description') # Type of backup object. resource_type = resource2.Body('resource_type') # Copy the list of records. replication_records = resource2.Body('replication_records', type=list) # Backup data time point. protected_at = resource2.Body('protected_at')