Esempio n. 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())
Esempio n. 2
0
class Secret(resource.Resource):
    id_attribute = 'secret_ref'
    resources_key = 'secrets'
    base_path = '/secrets'
    service = key_manager_service.KeyManagerService()

    # capabilities
    allow_create = True
    allow_retrieve = True
    allow_update = True
    allow_delete = True
    allow_list = True

    # Properties
    #: Metadata provided by a user or system for informational purposes
    algorithm = resource.prop('algorithm')
    #: Metadata provided by a user or system for informational purposes.
    #: Value must be greater than zero.
    bit_length = resource.prop('bit_length')
    #: A list of content types
    content_types = resource.prop('content_types')
    #: Once this timestamp has past, the secret will no longer be available.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    expires_at = resource.prop('expiration', type=format.ISO8601)
    #: The type/mode of the algorithm associated with the secret information.
    mode = resource.prop('mode')
    #: The name of the secret set by the user
    name = resource.prop('name')
    #: A URI to the sercret
    secret_ref = resource.prop('secret_ref')
    #: The status of this secret
    status = resource.prop('status')
    #: A timestamp when this secret was updated.
    #: *Type: datetime object parsed from ISO 8601 formatted string*
    updated_at = resource.prop('updated', type=format.ISO8601)
Esempio n. 3
0
class Container(resource.Resource):
    resources_key = 'containers'
    base_path = '/containers'
    service = key_manager_service.KeyManagerService()

    # capabilities
    allow_create = True
    allow_fetch = True
    allow_commit = True
    allow_delete = True
    allow_list = True

    # Properties
    #: A URI for this container
    container_ref = resource.Body('container_ref')
    #: The ID for this container
    container_id = resource.Body(
        'container_ref', alternate_id=True,
        type=_format.HREFToUUID)
    #: The timestamp when this container was created.
    created_at = resource.Body('created')
    #: The name of this container
    name = resource.Body('name')
    #: A list of references to secrets in this container
    secret_refs = resource.Body('secret_refs', type=list)
    #: The status of this container
    status = resource.Body('status')
    #: The type of this container
    type = resource.Body('type')
    #: The timestamp when this container was updated.
    updated_at = resource.Body('updated')
    #: A party interested in this container.
    consumers = resource.Body('consumers', type=list)
Esempio n. 4
0
class Order(resource.Resource):
    resources_key = 'orders'
    base_path = '/orders'
    service = key_manager_service.KeyManagerService()

    # capabilities
    allow_create = True
    allow_retrieve = True
    allow_update = True
    allow_delete = True
    allow_list = True

    # Properties
    # TODO(briancurtin): not documented
    error_reason = resource.prop('error_reason')
    # TODO(briancurtin): not documented
    error_status_code = resource.prop('error_status_code')
    #: a dictionary containing key-value parameters which specify the
    #: details of an order request
    meta = resource.prop('meta')
    #: A URI for this order
    order_ref = resource.prop('order_ref')
    #: TODO(briancurtin): not documented
    secret_ref = resource.prop('secret_ref')
    # The status of this order
    status = resource.prop('status')
    # The type of order
    type = resource.prop('type')
Esempio n. 5
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param list 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(cluster_service.ClusterService())
        self._add_service(compute_service.ComputeService())
        self._add_service(database_service.DatabaseService())
        self._add_service(identity_service.IdentityService())
        self._add_service(image_service.ImageService())
        self._add_service(network_service.NetworkService())
        self._add_service(object_store_service.ObjectStoreService())
        self._add_service(orchestration_service.OrchestrationService())
        self._add_service(key_manager_service.KeyManagerService())
        self._add_service(telemetry_service.TelemetryService())
        self._add_service(block_store_service.BlockStoreService())
        self._add_service(message_service.MessageService())

        # NOTE: The Metric service is not added here as it currently
        # only retrieves the /capabilities API.

        if plugins:
            for plugin in plugins:
                self._load_plugin(plugin)
        self.service_keys = sorted(self._services.keys())
Esempio n. 6
0
class Container(resource.Resource):
    id_attribute = 'container_ref'
    resources_key = 'containers'
    base_path = '/containers'
    service = key_manager_service.KeyManagerService()

    # capabilities
    allow_create = True
    allow_retrieve = True
    allow_update = True
    allow_delete = True
    allow_list = True

    # Properties
    #: A URI for this container
    container_ref = resource.prop('container_ref')
    #: The timestamp when this container was created.
    created_at = resource.prop('created')
    #: The name of this container
    name = resource.prop('name')
    #: A list of references to secrets in this container
    secret_refs = resource.prop('secret_refs')
    #: The status of this container
    status = resource.prop('status')
    #: The type of this container
    type = resource.prop('type')
    #: The timestamp when this container was updated.
    updated_at = resource.prop('updated')
 def test_service(self):
     sot = key_manager_service.KeyManagerService()
     self.assertEqual('key-manager', 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('v1', sot.valid_versions[0].module)
     self.assertEqual('v1', sot.valid_versions[0].path)
Esempio n. 8
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())
Esempio n. 9
0
class Order(resource.Resource):
    resources_key = 'orders'
    base_path = '/orders'
    service = key_manager_service.KeyManagerService()

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

    #: Timestamp in ISO8601 format of when the order was created
    created_at = resource.Body('created')
    #: Keystone Id of the user who created the order
    creator_id = resource.Body('creator_id')
    #: A dictionary containing key-value parameters which specify the
    #: details of an order request
    meta = resource.Body('meta', type=dict)
    #: A URI for this order
    order_ref = resource.Body('order_ref')
    #: The ID of this order
    order_id = resource.Body('order_ref',
                             alternate_id=True,
                             type=_format.HREFToUUID)
    #: Secret href associated with the order
    secret_ref = resource.Body('secret_ref')
    #: Secret ID associated with the order
    secret_id = resource.Body('secret_ref', type=_format.HREFToUUID)
    # The status of this order
    status = resource.Body('status')
    #: Metadata associated with the order
    sub_status = resource.Body('sub_status')
    #: Metadata associated with the order
    sub_status_message = resource.Body('sub_status_message')
    # The type of order
    type = resource.Body('type')
    #: 	Timestamp in ISO8601 format of the last time the order was updated.
    updated_at = resource.Body('updated')
Esempio n. 10
0
class Secret(resource2.Resource):
    resources_key = 'secrets'
    base_path = '/secrets'
    service = key_manager_service.KeyManagerService()

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

    _query_mapping = resource2.QueryParameters("name",
                                               "mode",
                                               "bits",
                                               "secret_type",
                                               "acl_only",
                                               "created",
                                               "updated",
                                               "expiration",
                                               "sort",
                                               algorithm="alg")

    # Properties
    #: Metadata provided by a user or system for informational purposes
    algorithm = resource2.Body('algorithm')
    #: Metadata provided by a user or system for informational purposes.
    #: Value must be greater than zero.
    bit_length = resource2.Body('bit_length')
    #: A list of content types
    content_types = resource2.Body('content_types', type=dict)
    #: Once this timestamp has past, the secret will no longer be available.
    expires_at = resource2.Body('expiration')
    #: Timestamp of when the secret was created.
    created_at = resource2.Body('created')
    #: Timestamp of when the secret was last updated.
    updated_at = resource2.Body('updated')
    #: The type/mode of the algorithm associated with the secret information.
    mode = resource2.Body('mode')
    #: The name of the secret set by the user
    name = resource2.Body('name')
    #: A URI to the sercret
    secret_ref = resource2.Body('secret_ref')
    #: The ID of the secret
    # NOTE: This is not really how alternate IDs are supposed to work and
    # ultimately means this has to work differently than all other services
    # in all of OpenStack because of the departure from using actual IDs
    # that even this service can't even use itself.
    secret_id = resource2.Body('secret_ref',
                               alternate_id=True,
                               type=_format.HREFToUUID)
    #: Used to indicate the type of secret being stored.
    secret_type = resource2.Body('secret_type')
    #: The status of this secret
    status = resource2.Body('status')
    #: A timestamp when this secret was updated.
    updated_at = resource2.Body('updated')
    #: The secret's data to be stored. payload_content_type must also
    #: be supplied if payload is included. (optional)
    payload = resource2.Body('payload')
    #: The media type for the content of the payload.
    #: (required if payload is included)
    payload_content_type = resource2.Body('payload_content_type')
    #: The encoding used for the payload to be able to include it in
    #: the JSON request. Currently only base64 is supported.
    #: (required if payload is encoded)
    payload_content_encoding = resource2.Body('payload_content_encoding')

    def get(self, session, requires_id=True):
        request = self._prepare_request(requires_id=requires_id)

        response = session.get(request.uri,
                               endpoint_filter=self.service).json()

        content_type = None
        if self.payload_content_type is not None:
            content_type = self.payload_content_type
        elif "content_types" in response:
            content_type = response["content_types"]["default"]

        # Only try to get the payload if a content type has been explicitly
        # specified or if one was found in the metadata response
        if content_type is not None:
            payload = session.get(utils.urljoin(request.uri, "payload"),
                                  endpoint_filter=self.service,
                                  headers={"Accept": content_type})
            response["payload"] = payload.text

        # We already have the JSON here so don't call into _translate_response
        body = self._filter_component(response, self._body_mapping())
        self._body.attributes.update(body)
        self._body.clean()

        return self
Esempio n. 11
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