예제 #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(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())
예제 #2
0
class PTR(resource.Resource):
    """DNS reverse record resource"""
    resources_key = 'floatingips'
    base_path = '/reverse/floatingips'
    service = dns_service.DNSService()

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

    #: Properties
    #: Region
    region = resource.Body('region')
    #: Floating IP ID
    floating_ip_id = resource.Body('floatingip_id')
    #: PTR domain name
    ptrdname = resource.Body('ptrdname')
    #: Recordset description
    description = resource.Body('description')
    #: Time to live, default 300, available value 300-2147483647 (seconds)
    ttl = resource.Body('ttl', type=int)
    #: Ip address
    address = resource.Body('address')
    #: The PTR record status
    status = resource.Body('status')
    #: Is the recordset created by system.
    action = resource.Body('action')
    #: Links contains a `self` pertaining to this zone or a `next` pertaining
    #: to next page
    links = resource.Body('links', type=dict)
예제 #3
0
class Zone(resource.Resource):
    """DNS ZONE Resource"""
    resource_key = 'zone'
    resources_key = 'zones'
    base_path = '/zones'
    service = dns_service.DNSService()

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

    _query_mapping = resource.QueryParameters("offset",
                                              "tags",
                                              zone_type='type')

    # The id of zone
    id = resource.Body("id")
    #: Properties
    #: Zone name
    name = resource.Body('name')
    #: Zone type, if private, domain will only available in a special VPC.
    #: Valid values include ``private``, ``public``
    zone_type = resource.Body('zone_type')
    #: Zone description
    description = resource.Body('description')
    #: The administrator email of this zone
    email = resource.Body('email')
    #: SOA TTL time, unit is seconds, default 300, TTL range 300-2147483647
    ttl = resource.Body('ttl', type=int)
    #: A dictionary represent Router(VPC), includes required items:
    #:  ``router_id`` and ``router_region``
    router = resource.Body('router', type=Router)
    #: sequence serial of modified flag
    serial = resource.Body('serial', type=int)
    #: Zone status
    #: Valid values include ``PENDING_CREATE``, ``ACTIVE``,
    #:                       ``PENDING_DELETE``, ``ERROR``
    status = resource.Body('status')
    #: Recordset number of the zone
    record_num = resource.Body('record_num', type=int)
    #: The pool which manages the zone, assigned by system
    pool_id = resource.Body('pool_id')
    #: The project id which the zone belongs to
    project_id = resource.Body('project_id')
    #: Links contains a `self` pertaining to this zone or a `next` pertaining
    #: to next page
    links = resource.Body('links', type=dict)
    #: The master list for slaver server to fetch DNS
    masters = resource.Body('masters', type=list)
    #: Router list associated to this zone
    routers = resource.Body('routers', type=list)
    #: Timestamp when the zone was created
    created_at = resource.Body('created_at')
    #: Timestamp when the zone was last updated
    updated_at = resource.Body('updated_at')
    # tags
    tags = resource.Body("tags", type=list)
예제 #4
0
 def test_service(self):
     sot = dns_service.DNSService()
     self.assertEqual('dns', 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)
예제 #5
0
class Recordset(resource.Resource):
    """Recordset Resource"""
    resource_key = 'recordset'
    resources_key = 'recordsets'
    base_path = '/zones/%(zone_id)s/recordsets'
    service = dns_service.DNSService()

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

    _query_mapping = resource.QueryParameters("zone_type", "offset")

    # The id if recordset
    id = resource.Body("id")
    #: Properties
    #: The id of the Zone which this recordset belongs to
    zone_id = resource.URI('zone_id')
    #: Recordset name
    name = resource.Body('name')
    #: Recordset description
    description = resource.Body('description')
    #: DNS type of the recordset
    #: Valid values include ``A``, ``AAA``, ``MX``, ``CNAME``, ``TXT``, ``NS``
    type = resource.Body('type')
    #: Time to live, default 300, available value 300-2147483647 (seconds)
    ttl = resource.Body('ttl', type=int)
    #: DNS record value list
    records = resource.Body('records', type=list)
    #: Recordset status
    #: Valid values include ``PENDING_CREATE``, ``ACTIVE``,
    #:                       ``PENDING_DELETE``, ``ERROR``
    status = resource.Body('status')
    #: The name of the Zone which this recordset belongs to
    zone_name = resource.Body('zone_name')
    #: Is the recordset created by system.
    is_default = resource.Body('default', type=bool)
    #: Health check id, not support for now
    health_check_id = resource.Body('health_check_id')
    #: Links contains a `self` pertaining to this zone or a `next` pertaining
    #: to next page
    links = resource.Body('links', type=dict)
    #: ID of the project which the recordset belongs to
    project_id = resource.Body('project_id')
    #: Timestamp when the zone was created
    create_at = resource.Body('create_at')
    #: Timestamp when the zone was last updated
    update_at = resource.Body('update_at')
    # tag
    tags = resource.Body("tags")
    # Whether the identifier is generated by the system by default,
    # the default Recordset generated by the system cannot be deleted.
    default = resource.Body("default")
예제 #6
0
class Version(resource.Resource):
    resource_key = 'version'
    resources_key = 'versions'
    base_path = '/'
    service = dns_service.DNSService(
        version=dns_service.DNSService.UNVERSIONED)

    # capabilities
    allow_list = True

    # Properties
    links = resource.Body('links')
    status = resource.Body('status')
예제 #7
0
class NameServer(resource.Resource):
    resource_key = 'nameserver'
    resources_key = 'nameservers'
    base_path = '/zones/%(zone_id)s/nameservers'
    service = dns_service.DNSService()

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

    #: Properties
    #: The ID of zone using this name-server
    zone_id = resource.URI('zone_id')
    #: NameServer priority
    priority = resource.Body('priority')
    #: NameServer private DNS address
    address = resource.Body('address')
    #: NameServer public DNS address
    hostname = resource.Body('hostname')
예제 #8
0
class AssociateRouter(resource.Resource):
    """associate router resource"""
    resource_key = 'router'
    resources_key = 'router'
    base_path = '/zones/%(zone_id)s/associaterouter'
    service = dns_service.DNSService()

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

    #: Properties
    #: The ID of zone associate with this router
    zone_id = resource.URI('zone_id')
    #: Associate Router ID
    router_id = resource.Body('router_id')
    #: Associate Router region
    router_region = resource.Body('router_region')
    #: Associate Router status
    status = resource.Body('status')