Пример #1
0
    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(baremetal_service.BaremetalService(version="v1"))
        self._add_service(
            block_storage_service.BlockStorageService(version="v2"))
        self._add_service(clustering_service.ClusteringService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(database_service.DatabaseService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(lb_service.LoadBalancerService(version="v2"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(workflow_service.WorkflowService(version="v2"))

        self.service_keys = sorted(self._services.keys())
Пример #2
0
 def test_service(self):
     sot = workflow_service.WorkflowService()
     self.assertEqual('workflowv2', sot.service_type)
     self.assertEqual('public', sot.interface)
     self.assertIsNone(sot.region)
     self.assertIsNone(sot.service_name)
     self.assertEqual(1, len(sot.valid_versions))
     self.assertEqual('v2', sot.valid_versions[0].module)
     self.assertEqual('v2', sot.valid_versions[0].path)
Пример #3
0
class Workflow(resource.Resource):
    resource_key = 'workflow'
    resources_key = 'workflows'
    base_path = '/workflows'
    service = workflow_service.WorkflowService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True

    _query_mapping = resource.QueryParameters('marker', 'limit', 'sort_keys',
                                              'sort_dirs', 'fields')

    #: The name of this Workflow
    name = resource.Body("name")
    #: The inputs for this Workflow
    input = resource.Body("input")
    #: A Workflow definition using the Mistral v2 DSL
    definition = resource.Body("definition")
    #: A list of values associated with a workflow that users can use
    #: to group workflows by some criteria
    # TODO(briancurtin): type=list
    tags = resource.Body("tags")
    #: Can be either "private" or "public"
    scope = resource.Body("scope")
    #: The ID of the associated project
    project_id = resource.Body("project_id")
    #: The time at which the workflow was created
    created_at = resource.Body("created_at")
    #: The time at which the workflow was created
    updated_at = resource.Body("updated_at")

    def create(self, session, prepend_key=True):
        request = self._prepare_request(requires_id=False,
                                        prepend_key=prepend_key)

        headers = {"Content-Type": 'text/plain'}
        kwargs = {
            "data": self.definition,
        }

        scope = "?scope=%s" % self.scope
        uri = request.uri + scope

        request.headers.update(headers)
        response = session.post(uri,
                                endpoint_filter=self.service,
                                json=None,
                                headers=request.headers,
                                **kwargs)

        self._translate_response(response, has_body=False)
        return self
Пример #4
0
class Version(resource.Resource):
    resource_key = 'version'
    resources_key = 'versions'
    base_path = '/'
    service = workflow_service.WorkflowService(
        version=workflow_service.WorkflowService.UNVERSIONED)

    # capabilities
    allow_list = True

    # Properties
    links = resource.Body('links')
    status = resource.Body('status')
Пример #5
0
    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(alarm_service.AlarmService(version="v2"))
        self._add_service(bare_metal_service.BareMetalService(version="v1"))
        self._add_service(block_store_service.BlockStoreService(version="v2"))
        self._add_service(cluster_service.ClusterService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(cts_service.CTSService(version="v1"))
        self._add_service(database_service.DatabaseService(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(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(kms_service.KMSService(version="v1"))
        self._add_service(lb_service.LoadBalancerService(version="v1"))
        self._add_service(maas_service.MaaSService(version="v1"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(rds_service.RDSService(version="v1"))
        self._add_service(rds_os_service.RDSService(version="v1"))
        self._add_service(smn_service.SMNService(version="v2"))
        self._add_service(telemetry_service.TelemetryService(version="v2"))
        self._add_service(workflow_service.WorkflowService(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"))

        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_keys = sorted(self._services.keys())
Пример #6
0
class Execution(resource.Resource):
    resource_key = 'execution'
    resources_key = 'executions'
    base_path = '/executions'
    service = workflow_service.WorkflowService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True

    _query_mapping = resource.QueryParameters('marker', 'limit', 'sort_keys',
                                              'sort_dirs', 'fields', 'params',
                                              'include_output')

    #: The name of the workflow
    workflow_name = resource.Body("workflow_name")
    #: The ID of the workflow
    workflow_id = resource.Body("workflow_id")
    #: A description of the workflow execution
    description = resource.Body("description")
    #: A reference to the parent task execution
    task_execution_id = resource.Body("task_execution_id")
    #: Status can be one of: IDLE, RUNNING, SUCCESS, ERROR, or PAUSED
    status = resource.Body("state")
    #: An optional information string about the status
    status_info = resource.Body("state_info")
    #: A JSON structure containing workflow input values
    # TODO(briancurtin): type=dict
    input = resource.Body("input")
    #: The output of the workflow
    output = resource.Body("output")
    #: The time at which the Execution was created
    created_at = resource.Body("created_at")
    #: The time at which the Execution was updated
    updated_at = resource.Body("updated_at")

    def create(self, session, prepend_key=True):
        request = self._prepare_request(requires_id=False,
                                        prepend_key=prepend_key)

        request_body = request.body["execution"]
        response = session.post(request.uri,
                                endpoint_filter=self.service,
                                json=request_body,
                                headers=request.headers)

        self._translate_response(response, has_body=True)
        return self
Пример #7
0
class Execution(resource.Resource):
    resource_key = 'execution'
    resources_key = 'executions'
    base_path = '/executions'
    service = workflow_service.WorkflowService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True

    marker = resource.Body("marker")
    limit = resource.Body("limit")
    sort_keys = resource.Body("sort_keys")
    sort_dirs = resource.Body("sort_dirs")
    fields = resource.Body("fields")
    workflow_name = resource.Body("workflow_name")
    workflow_id = resource.Body("workflow_id")
    description = resource.Body("description")
    params = resource.Body("params")
    task_execution_id = resource.Body("task_execution_id")
    status = resource.Body("state")
    status_info = resource.Body("state_info")
    input = resource.Body("input")
    output = resource.Body("output")
    created_at = resource.Body("created_at")
    updated_at = resource.Body("updated_at")
    include_output = resource.Body("include_output")

    def create(self, session, prepend_key=True):
        request = self._prepare_request(requires_id=False,
                                        prepend_key=prepend_key)

        request_body = request.body["execution"]
        response = session.post(request.uri,
                                endpoint_filter=self.service,
                                json=request_body,
                                headers=request.headers)

        self._translate_response(response)
        return self
Пример #8
0
class Workflow(resource.Resource):
    resource_key = 'workflow'
    resources_key = 'workflows'
    base_path = '/workflows'
    service = workflow_service.WorkflowService()

    # capabilities
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True

    marker = resource.Body("marker")
    limit = resource.Body("limit")
    sort_keys = resource.Body("sort_keys")
    sort_dirs = resource.Body("sort_dirs")
    fields = resource.Body("fields")
    name = resource.Body("name")
    input = resource.Body("input")
    definition = resource.Body("definition")
    tags = resource.Body("tags")
    scope = resource.Body("scope")
    project_id = resource.Body("project_id")
    created_at = resource.Body("created_at")
    updated_at = resource.Body("updated_at")

    def create(self, session, prepend_key=True):
        request = self._prepare_request(requires_id=False,
                                        prepend_key=prepend_key)

        headers = {"Content-Type": 'text/plain'}
        kwargs = {"data": request.body["workflow"]["definition"]}
        uri = request.uri + "?scope=%s" % request.body["workflow"]["scope"]
        request.headers.update(headers)
        response = session.post(uri,
                                endpoint_filter=self.service,
                                json=None,
                                headers=request.headers,
                                **kwargs)

        self._translate_response(response, has_body=False)
        return self
Пример #9
0
class ServicesMixin(object):

    identity = identity_service.IdentityService(service_type='identity')

    compute = compute_service.ComputeService(service_type='compute')

    image = image_service.ImageService(service_type='image')

    load_balancer = load_balancer_service.LoadBalancerService(
        service_type='load-balancer')

    object_store = object_store_service.ObjectStoreService(
        service_type='object-store')

    clustering = clustering_service.ClusteringService(
        service_type='clustering')
    resource_cluster = clustering
    cluster = clustering

    data_processing = service_description.ServiceDescription(
        service_type='data-processing')

    baremetal = baremetal_service.BaremetalService(service_type='baremetal')
    bare_metal = baremetal

    baremetal_introspection = baremetal_introspection_service.BaremetalIntrospectionService(
        service_type='baremetal-introspection')

    key_manager = key_manager_service.KeyManagerService(
        service_type='key-manager')

    resource_optimization = service_description.ServiceDescription(
        service_type='resource-optimization')
    infra_optim = resource_optimization

    message = message_service.MessageService(service_type='message')
    messaging = message

    application_catalog = service_description.ServiceDescription(
        service_type='application-catalog')

    container_infrastructure_management = service_description.ServiceDescription(
        service_type='container-infrastructure-management')
    container_infrastructure = container_infrastructure_management
    container_infra = container_infrastructure_management

    search = service_description.ServiceDescription(service_type='search')

    dns = dns_service.DnsService(service_type='dns')

    workflow = workflow_service.WorkflowService(service_type='workflow')

    rating = service_description.ServiceDescription(service_type='rating')

    operator_policy = service_description.ServiceDescription(
        service_type='operator-policy')
    policy = operator_policy

    shared_file_system = service_description.ServiceDescription(
        service_type='shared-file-system')
    share = shared_file_system

    data_protection_orchestration = service_description.ServiceDescription(
        service_type='data-protection-orchestration')

    orchestration = orchestration_service.OrchestrationService(
        service_type='orchestration')

    block_storage = block_storage_service.BlockStorageService(
        service_type='block-storage')
    block_store = block_storage
    volume = block_storage

    alarm = service_description.ServiceDescription(service_type='alarm')
    alarming = alarm

    meter = service_description.ServiceDescription(service_type='meter')
    metering = meter
    telemetry = meter

    event = service_description.ServiceDescription(service_type='event')
    events = event

    application_deployment = service_description.ServiceDescription(
        service_type='application-deployment')
    application_deployment = application_deployment

    multi_region_network_automation = service_description.ServiceDescription(
        service_type='multi-region-network-automation')
    tricircle = multi_region_network_automation

    database = database_service.DatabaseService(service_type='database')

    application_container = service_description.ServiceDescription(
        service_type='application-container')
    container = application_container

    root_cause_analysis = service_description.ServiceDescription(
        service_type='root-cause-analysis')
    rca = root_cause_analysis

    nfv_orchestration = service_description.ServiceDescription(
        service_type='nfv-orchestration')

    network = network_service.NetworkService(service_type='network')

    backup = service_description.ServiceDescription(service_type='backup')

    monitoring_logging = service_description.ServiceDescription(
        service_type='monitoring-logging')
    monitoring_log_api = monitoring_logging

    monitoring = service_description.ServiceDescription(
        service_type='monitoring')

    monitoring_events = service_description.ServiceDescription(
        service_type='monitoring-events')

    placement = service_description.ServiceDescription(
        service_type='placement')

    instance_ha = instance_ha_service.InstanceHaService(
        service_type='instance-ha')
    ha = instance_ha

    reservation = service_description.ServiceDescription(
        service_type='reservation')

    function_engine = service_description.ServiceDescription(
        service_type='function-engine')

    accelerator = accelerator_service.AcceleratorService(
        service_type='accelerator')

    admin_logic = service_description.ServiceDescription(
        service_type='admin-logic')
    registration = admin_logic