示例#1
0
 def create_endpoint(self, request, endpoint):
     utils.check_endpoint_url(endpoint['url'])
     ref = self._assign_unique_id(self._normalize_dict(endpoint))
     ref = self._validate_endpoint_region(ref, request.context_dict)
     initiator = notifications._get_request_audit_info(request.context_dict)
     ref = self.catalog_api.create_endpoint(ref['id'], ref, initiator)
     return EndpointV3.wrap_member(request.context_dict, ref)
示例#2
0
 def create_endpoint(self, request, endpoint):
     validation.lazy_validate(schema.endpoint_create, endpoint)
     utils.check_endpoint_url(endpoint["url"])
     ref = self._assign_unique_id(self._normalize_dict(endpoint))
     ref = self._validate_endpoint_region(ref, request)
     ref = self.catalog_api.create_endpoint(ref["id"], ref, initiator=request.audit_initiator)
     return EndpointV3.wrap_member(request.context_dict, ref)
示例#3
0
 def create_endpoint(self, request, endpoint):
     utils.check_endpoint_url(endpoint['url'])
     ref = self._assign_unique_id(self._normalize_dict(endpoint))
     ref = self._validate_endpoint_region(ref, request.context_dict)
     initiator = notifications._get_request_audit_info(request.context_dict)
     ref = self.catalog_api.create_endpoint(ref['id'], ref, initiator)
     return EndpointV3.wrap_member(request.context_dict, ref)
示例#4
0
 def create_endpoint(self, request, endpoint):
     validation.lazy_validate(schema.endpoint_create, endpoint)
     utils.check_endpoint_url(endpoint['url'])
     ref = self._assign_unique_id(self._normalize_dict(endpoint))
     ref = self._validate_endpoint_region(ref, request)
     ref = self.catalog_api.create_endpoint(
         ref['id'], ref, initiator=request.audit_initiator)
     return EndpointV3.wrap_member(request.context_dict, ref)
示例#5
0
 def post(self):
     ENFORCER.enforce_call(action='identity:create_endpoint')
     endpoint = self.request_body_json.get('endpoint')
     validation.lazy_validate(schema.endpoint_create, endpoint)
     utils.check_endpoint_url(endpoint['url'])
     endpoint = self._assign_unique_id(self._normalize_dict(endpoint))
     endpoint = self._validate_endpoint_region(endpoint)
     ref = PROVIDERS.catalog_api.create_endpoint(
         endpoint['id'], endpoint, initiator=self.audit_initiator)
     return self.wrap_member(_filter_endpoint(ref)), http_client.CREATED
示例#6
0
 def post(self):
     ENFORCER.enforce_call(action='identity:create_endpoint')
     endpoint = self.request_body_json.get('endpoint')
     validation.lazy_validate(schema.endpoint_create, endpoint)
     utils.check_endpoint_url(endpoint['url'])
     endpoint = self._assign_unique_id(self._normalize_dict(endpoint))
     endpoint = self._validate_endpoint_region(endpoint)
     ref = PROVIDERS.catalog_api.create_endpoint(
         endpoint['id'], endpoint, initiator=self.audit_initiator)
     return self.wrap_member(_filter_endpoint(ref)), http_client.CREATED
示例#7
0
    def create_endpoint(self, request, endpoint):
        """Create three v3 endpoint refs based on a legacy ref."""
        self.assert_admin(request)

        # according to the v2 spec publicurl is mandatory
        self._require_attribute(endpoint, 'publicurl')
        # service_id is necessary
        self._require_attribute(endpoint, 'service_id')

        # we should check publicurl, adminurl, internalurl
        # if invalid, we should raise an exception to reject
        # the request
        for interface in INTERFACES:
            interface_url = endpoint.get(interface + 'url')
            if interface_url:
                utils.check_endpoint_url(interface_url)

        if endpoint.get('region') is not None:
            try:
                self.catalog_api.get_region(endpoint['region'])
            except exception.RegionNotFound:
                region = dict(id=endpoint['region'])
                self.catalog_api.create_region(
                    region, initiator=request.audit_initiator
                )

        legacy_endpoint_ref = endpoint.copy()

        urls = {}
        for i in INTERFACES:
            # remove all urls so they aren't persisted them more than once
            url = '%surl' % i
            if endpoint.get(url):
                # valid urls need to be persisted
                urls[i] = endpoint.pop(url)
            elif url in endpoint:
                # null or empty urls can be discarded
                endpoint.pop(url)
                legacy_endpoint_ref.pop(url)

        legacy_endpoint_id = uuid.uuid4().hex
        for interface, url in urls.items():
            endpoint_ref = endpoint.copy()
            endpoint_ref['id'] = uuid.uuid4().hex
            endpoint_ref['legacy_endpoint_id'] = legacy_endpoint_id
            endpoint_ref['interface'] = interface
            endpoint_ref['url'] = url
            endpoint_ref['region_id'] = endpoint_ref.pop('region', None)
            self.catalog_api.create_endpoint(endpoint_ref['id'],
                                             endpoint_ref,
                                             initiator=request.audit_initiator)

        legacy_endpoint_ref['id'] = legacy_endpoint_id
        return {'endpoint': legacy_endpoint_ref}
示例#8
0
    def create_endpoint(self, request, endpoint):
        """Create three v3 endpoint refs based on a legacy ref."""
        self.assert_admin(request)

        # according to the v2 spec publicurl is mandatory
        self._require_attribute(endpoint, 'publicurl')
        # service_id is necessary
        self._require_attribute(endpoint, 'service_id')

        # we should check publicurl, adminurl, internalurl
        # if invalid, we should raise an exception to reject
        # the request
        for interface in INTERFACES:
            interface_url = endpoint.get(interface + 'url')
            if interface_url:
                utils.check_endpoint_url(interface_url)

        if endpoint.get('region') is not None:
            try:
                self.catalog_api.get_region(endpoint['region'])
            except exception.RegionNotFound:
                region = dict(id=endpoint['region'])
                self.catalog_api.create_region(
                    region, initiator=request.audit_initiator
                )

        legacy_endpoint_ref = endpoint.copy()

        urls = {}
        for i in INTERFACES:
            # remove all urls so they aren't persisted them more than once
            url = '%surl' % i
            if endpoint.get(url):
                # valid urls need to be persisted
                urls[i] = endpoint.pop(url)
            elif url in endpoint:
                # null or empty urls can be discarded
                endpoint.pop(url)
                legacy_endpoint_ref.pop(url)

        legacy_endpoint_id = uuid.uuid4().hex
        for interface, url in urls.items():
            endpoint_ref = endpoint.copy()
            endpoint_ref['id'] = uuid.uuid4().hex
            endpoint_ref['legacy_endpoint_id'] = legacy_endpoint_id
            endpoint_ref['interface'] = interface
            endpoint_ref['url'] = url
            endpoint_ref['region_id'] = endpoint_ref.pop('region')
            self.catalog_api.create_endpoint(endpoint_ref['id'],
                                             endpoint_ref,
                                             initiator=request.audit_initiator)

        legacy_endpoint_ref['id'] = legacy_endpoint_id
        return {'endpoint': legacy_endpoint_ref}