示例#1
0
class NatGateway(resource2.Resource):
    resource_key = 'nat_gateway'
    resources_key = 'nat_gateways'
    base_path = '/nat_gateways'

    service = nat_service.NatService()

    # capabilities
    allow_create = True
    allow_get = True
    allow_update = True
    allow_delete = True
    allow_list = True
    _query_mapping = resource2.QueryParameters("id", "name", "description",
                                               "router_id",
                                               "internal_network_id",
                                               "tenant_id", "status",
                                               "created_at", "admin_state_up")

    # Properties
    # NAT gateway id
    id = resource2.Body("id")
    # NAT gateway name
    name = resource2.Body("name")
    # NAT gateway description
    description = resource2.Body("description")
    # The id of the route used by the NAT gateway.
    router_id = resource2.Body("router_id")
    # The id of the network used by the NAT gateway.
    internal_network_id = resource2.Body("internal_network_id")
    # Status, can be ACTIVE, ERROR, PENDING_CREATE, PENDING_UPDATE,
    # PENDING_DELETE
    status = resource2.Body("status")
    # Specifications can be:
    # "1": small
    # "2": medium
    # "3": large
    # "4": very large
    spec = resource2.Body("spec")
    # tenant id
    tenant_id = resource2.Body("tenant_id")
    # Gateway creation time
    created_at = resource2.Body("created_at")
    # Administrator status, only the system administrator has permission to operate
    # Description:
    # True is the thawing state of the gateway;
    # False is the gateway freeze state.
    admin_state_up = resource2.Body("admin_state_up", type=bool)
示例#2
0
class SnatRule(resource2.Resource):
    """Define a SnatRule class."""

    resource_key = 'snat_rule'
    resources_key = 'snat_rules'
    base_path = '/snat_rules'

    service = nat_service.NatService()

    # Allow create/list/get/delete operation for this resource.
    allow_create = True
    allow_list = True
    allow_get = True
    allow_delete = True

    # Mapping of accepted query parameter names.
    _query_mapping = resource2.QueryParameters(
        'id',
        'tenant_id',
        'nat_gateway_id',
        'network_id',
        'floating_ip_id',
        'floating_ip_address',
        'status',
        'created_at',
        'admin_state_up'
    )

    # Properties.
    # id of rule
    id = resource2.Body('id')
    # id of tenant
    tenant_id = resource2.Body('tenant_id')
    # id of the owning NAT gateway
    nat_gateway_id = resource2.Body('nat_gateway_id')
    # network id used by the rule
    network_id = resource2.Body('network_id')
    # floating IP id
    floating_ip_id = resource2.Body('floating_ip_id')
    # floating IP address
    floating_ip_address = resource2.Body('floating_ip_address')
    # status: ACTIVE, ERROR, PENDING_CREATE, PENDING_UPDATE, PENDING_DELETE
    status = resource2.Body('status')
    # rule creation time
    created_at = resource2.Body('created_at')
    # administrator status
    admin_state_up = resource2.Body('admin_state_up')
示例#3
0
class DnatRule(resource2.Resource):
    resource_key = 'dnat_rule'
    resources_key = 'dnat_rules'
    base_path = '/dnat_rules'

    service = nat_service.NatService()

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

    _query_mapping = resource2.QueryParameters(
        "id", "tenant_id", "port_id", "internal_service_port",
        "floating_ip_id", "floating_ip_address", "external_service_port",
        "protocol", "status", "created_at", "admin_state_up")

    # RULE id
    id = resource2.Body("id")
    # tenant id
    tenant_id = resource2.Body("tenant_id")
    # nat gateway id
    nat_gateway_id = resource2.Body("nat_gateway_id")
    # Port ID of the virtual machine or bare metal(actually,this id is the ecs's  NIC ID)
    port_id = resource2.Body("port_id")
    # Protocol port number for external service of virtual machine or bare metal
    internal_service_port = resource2.Body("internal_service_port", type=int)
    # Floating IP ID
    floating_ip_id = resource2.Body("floating_ip_id")
    # Protocol port number for floating IP external exposure
    external_service_port = resource2.Body("external_service_port", type=int)
    # Floating IP address
    floating_ip_address = resource2.Body("floating_ip_address")
    # Currently, the input characters "TCP" and "UDP" are supported, and the specific protocol number is also supported, 6, 17. Protocol number query rule is not supported
    protocol = resource2.Body("protocol")
    # Status, which can be ACTIVE, ERROR, PENDING_CREATE, PENDING_UPDATE,PENDING_DELETE
    status = resource2.Body("status")
    # Rule creation time
    created_at = resource2.Body("created_at")
    # Administrator status, only the system administrator has permission to operate
    # Description:
    # True is the rule thawing state;
    # False is the rule freeze state
    admin_state_up = resource2.Body("admin_state_up", type=bool)
示例#4
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(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())