当前位置: 首页>>代码示例>>Python>>正文


Python AstakosClient.get_endpoint_url方法代码示例

本文整理汇总了Python中kamaki.clients.astakos.AstakosClient.get_endpoint_url方法的典型用法代码示例。如果您正苦于以下问题:Python AstakosClient.get_endpoint_url方法的具体用法?Python AstakosClient.get_endpoint_url怎么用?Python AstakosClient.get_endpoint_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kamaki.clients.astakos.AstakosClient的用法示例。


在下文中一共展示了AstakosClient.get_endpoint_url方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
 def __init__(self, config):
     self.config = config
     cloud_name = self.config.get('global', 'default_cloud')
     self.auth_token = self.config.get_cloud(cloud_name, 'token')
     cacerts_path = self.config.get('global', 'ca_certs')
     https.patch_with_certs(cacerts_path)
     auth_url = self.config.get_cloud(cloud_name, 'url')
     auth = AstakosClient(auth_url, self.auth_token)
     self.endpoints = dict(
         astakos=auth_url,
         cyclades=auth.get_endpoint_url(CycladesComputeClient.service_type),
         network=auth.get_endpoint_url(CycladesNetworkClient.service_type),
         plankton=auth.get_endpoint_url(ImageClient.service_type)
         )
     self.user_id = auth.user_info['id']
开发者ID:ktsakalozos,项目名称:juju-okeanos-provider,代码行数:17,代码来源:provider.py

示例2: _get_pithos_client

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
 def _get_pithos_client(self, auth_url, token, container):
     try:
         astakos = AstakosClient(auth_url, token)
     except ClientError:
         logger.error("Failed to authenticate user token")
         raise
     try:
         PITHOS_URL = astakos.get_endpoint_url(
             AgkyraPithosClient.service_type)
     except ClientError:
         logger.error("Failed to get endpoints for Pithos")
         raise
     try:
         account = astakos.user_info['id']
         return AgkyraPithosClient(PITHOS_URL, token, account, container)
     except ClientError:
         logger.error("Failed to initialize Pithos client")
         raise
开发者ID:jaeko44,项目名称:agkyra,代码行数:20,代码来源:setup.py

示例3: list_pithos_files

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
 def list_pithos_files(self):
     """ Method for listing pithos+ files available to the user """
     auth_url = self.opts['auth_url']
     token = self.opts['token']
     try:
         auth = AstakosClient(auth_url, token)
         auth.authenticate()
     except ClientError:
         msg = ' Authentication error: Invalid Token'
         logging.error(msg)
         exit(error_fatal)
     pithos_endpoint = auth.get_endpoint_url('object-store')
     pithos_container = self.opts.get('pithos_container','pithos')
     user_id = auth.user_info['id']
     pithos_client = PithosClient(pithos_endpoint,self.opts['token'], user_id, pithos_container)
     objects = pithos_client.list_objects()
     for object in objects:
         is_dir = 'application/directory' in object.get('content_type', object.get('content-type', ''))
         if not is_dir:
             print u"{:>12s} \"pithos:/{:s}/{:s}\"".format(bytes_to_shorthand(object['bytes']),
                                                           pithos_container,object['name'])
开发者ID:themiszamani,项目名称:e-science,代码行数:23,代码来源:orka.py

示例4: AstakosClient

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.

from kamaki.clients.astakos import AstakosClient
from kamaki.clients.pithos import PithosClient

AUTHENTICATION_URL = "https://astakos.example.com/identity/v2.0"
TOKEN = "User-Token"
astakos = AstakosClient(AUTHENTICATION_URL, TOKEN)

service_type = PithosClient.service_type
endpoint = astakos.get_endpoint_url(service_type)
pithos = PithosClient(endpoint, TOKEN)

user = astakos.authenticate()
uuid = user["access"]["user"]["id"]
pithos.account = uuid

#  Get the project containers we care for
containers = filter(
    lambda c: c["name"] in ("pithos", "images"),
    pithos.list_containers())

#  Construct dict of the form {CONTAINER_NAME: PROJECT_ID, ...}
projects = dict([(
    c["name"],
    c["x_container_policy"]["project"]) for c in containers])
开发者ID:grnet,项目名称:kamaki,代码行数:33,代码来源:pithos-reassign.py

示例5: AstakosClient

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
https.patch_ignore_ssl()

authURL = "https://accounts.okeanos.grnet.gr/identity/v2.0"
X_AUTH_TOKEN_NAME = 'X_AUTH_TOKEN'
token = ENV[X_AUTH_TOKEN_NAME]

projectId = '464eb0e7-b556-4fc7-8afb-d590feebaad8'
serverId = '660580'

cycladesServiceType = CycladesClient.service_type
blockStorageServiceType = CycladesBlockStorageClient.service_type

ac = AstakosClient(authURL, token)

cycladesURL = ac.get_endpoint_url(cycladesServiceType)
cc = CycladesClient(cycladesURL, token)

blockStorageURL = ac.get_endpoint_url(blockStorageServiceType)
bsc = CycladesBlockStorageClient(blockStorageURL, token)

onc = OkeanosNativeClient(token, authURL)

print "cycladesURL = %s" % cycladesURL
print "blockStorageURL = %s" % blockStorageURL
print "ac = %s" % ac
print "cc = %s" % cc
print "bsc = %s" % bsc
print "onc = %s" % onc

# servers = cc.list_servers()
开发者ID:CELAR,项目名称:SlipStreamConnector-Okeanos,代码行数:32,代码来源:devapi.py

示例6: Clients

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
class Clients(object):
    """Our kamaki clients"""
    auth_url = None
    token = None
    # Astakos
    astakos = None
    retry = CONNECTION_RETRY_LIMIT
    # Compute
    compute = None
    compute_url = None
    # Cyclades
    cyclades = None
    # Network
    network = None
    network_url = None
    # Pithos
    pithos = None
    pithos_url = None
    # Image
    image = None
    image_url = None

    def _kamaki_ssl(self, ignore_ssl=None):
        """Patch kamaki to use the correct CA certificates

        Read kamaki's config file and decide if we are going to use
        CA certificates and patch kamaki clients accordingly.

        """
        config = kamaki_config.Config()
        if ignore_ssl is None:
            ignore_ssl = config.get("global", "ignore_ssl").lower() == "on"
        ca_file = config.get("global", "ca_certs")

        if ignore_ssl:
            # Skip SSL verification
            https.patch_ignore_ssl()
        else:
            # Use ca_certs path found in kamakirc
            https.patch_with_certs(ca_file)

    def initialize_clients(self, ignore_ssl=False):
        """Initialize all the Kamaki Clients"""

        # Path kamaki for SSL verification
        self._kamaki_ssl(ignore_ssl=ignore_ssl)

        # Initialize kamaki Clients
        self.astakos = AstakosClient(self.auth_url, self.token)
        self.astakos.CONNECTION_RETRY_LIMIT = self.retry

        self.compute_url = self.astakos.get_endpoint_url(
            ComputeClient.service_type)
        self.compute = ComputeClient(self.compute_url, self.token)
        self.compute.CONNECTION_RETRY_LIMIT = self.retry

        self.cyclades_url = self.astakos.get_endpoint_url(
            CycladesClient.service_type)
        self.cyclades = CycladesClient(self.cyclades_url, self.token)
        self.cyclades.CONNECTION_RETRY_LIMIT = self.retry

        self.block_storage_url = self.astakos.get_endpoint_url(
            BlockStorageClient.service_type)
        self.block_storage = BlockStorageClient(self.block_storage_url,
                                                self.token)
        self.block_storage.CONNECTION_RETRY_LIMIT = self.retry

        self.network_url = self.astakos.get_endpoint_url(
            CycladesNetworkClient.service_type)
        self.network = CycladesNetworkClient(self.network_url, self.token)
        self.network.CONNECTION_RETRY_LIMIT = self.retry

        self.pithos_url = self.astakos.get_endpoint_url(
            PithosClient.service_type)
        self.pithos = PithosClient(self.pithos_url, self.token)
        self.pithos.CONNECTION_RETRY_LIMIT = self.retry

        self.image_url = self.astakos.get_endpoint_url(
            ImageClient.service_type)
        self.image = ImageClient(self.image_url, self.token)
        self.image.CONNECTION_RETRY_LIMIT = self.retry
开发者ID:Erethon,项目名称:synnefo,代码行数:83,代码来源:common.py

示例7: get_image_client

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
 def get_image_client(self):
     astakos = AstakosClient(self.endpoints['astakos'], self.auth_token)
     image_url = astakos.get_endpoint_url(ImageClient.service_type)
     plankton = ImageClient(image_url, self.auth_token)
     return plankton
开发者ID:ktsakalozos,项目名称:juju-okeanos-provider,代码行数:7,代码来源:provider.py

示例8: get_network_client

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
 def get_network_client(self):
     astakos = AstakosClient(self.endpoints['astakos'], self.auth_token)
     network_url = astakos.get_endpoint_url(CycladesNetworkClient.service_type)
     network_client = CycladesNetworkClient(network_url, self.auth_token)
     return network_client
开发者ID:ktsakalozos,项目名称:juju-okeanos-provider,代码行数:7,代码来源:provider.py

示例9: get_compute_client

# 需要导入模块: from kamaki.clients.astakos import AstakosClient [as 别名]
# 或者: from kamaki.clients.astakos.AstakosClient import get_endpoint_url [as 别名]
 def get_compute_client(self):
     astakos = AstakosClient(self.endpoints['astakos'], self.auth_token)
     cyclades_url = astakos.get_endpoint_url(CycladesComputeClient.service_type)
     compute_client = CycladesComputeClient(cyclades_url, self.auth_token)
     return compute_client
开发者ID:ktsakalozos,项目名称:juju-okeanos-provider,代码行数:7,代码来源:provider.py


注:本文中的kamaki.clients.astakos.AstakosClient.get_endpoint_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。