예제 #1
0
파일: service.py 프로젝트: slashk/keystone
    def get_baseurl(self, admin_token, baseurl_id):
        self.__validate_token(admin_token)

        dbaseurl = db_api.baseurls_get(baseurl_id)
        if not dbaseurl:
            raise fault.ItemNotFoundFault("The role could not be found")
        return baseURLs.BaseURL(dbaseurl.id, dbaseurl.region, dbaseurl.service, dbaseurl.public_url, dbaseurl.admin_url, dbaseurl.internal_url, dbaseurl.enabled)       
예제 #2
0
    def create_baseurl_ref_to_tenant(self, admin_token,
                                     tenant_id, baseurl, url):
        self.__validate_token(admin_token)
        if tenant_id == None:
            raise fault.BadRequestFault("Expecting a Tenant Id")

        if db_api.tenant_get(tenant_id) == None:
            raise fault.ItemNotFoundFault("The tenant not found")

        dbaseurl = db_api.baseurls_get(baseurl.id)
        if not dbaseurl:
            raise fault.ItemNotFoundFault("The base URL could not be found")
        dbaseurl_ref = db_models.TenantBaseURLAssociation()
        dbaseurl_ref.tenant_id = tenant_id
        dbaseurl_ref.baseURLs_id = baseurl.id
        dbaseurl_ref = db_api.baseurls_ref_add(dbaseurl_ref)
        baseurlRef = baseURLs.BaseURLRef(dbaseurl_ref.id, url + \
                                         '/baseURLs/' + \
                                         dbaseurl_ref.baseURLs_id)
        return baseurlRef