本文整理汇总了Python中vaporize.core.get_url函数的典型用法代码示例。如果您正苦于以下问题:Python get_url函数的具体用法?Python get_url怎么用?Python get_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: modify
def modify(self, ttl=None, email_address=None, comment=None):
"""Modify this Domain's properties.
:param ttl: Time-To-Live (TTL0 in seconds
:type ttl: int
:param email_address: E-mail address associated with Domain
:type email_address: str
:param comment: A comment or note about this Domain
:type comment: str
:returns: A :class:`Domain`
.. versionadded:: 0.1
"""
assert 'id' in self
data = {}
if ttl is not None:
data['ttl'] = int(ttl)
if email_address is not None:
data['emailAddress'] = email_address
if comment is not None:
data['comment'] = comment
data = json.dumps(data)
url = '/'.join([get_url('clouddns'), 'domains', str(self['id'])])
handle_request('put', url, data)
if ttl is not None:
self['ttl'] = int(ttl)
if email_address is not None:
self['email_address'] = email_address
if comment is not None:
self['comment'] = comment
return self
开发者ID:abg,项目名称:vaporize,代码行数:31,代码来源:domains.py
示例2: modify
def modify(self, name=None, password=None):
"""Modify this Server's name or root password.
:param name: Change the Server's name
:type name: str
:param password: Change the Server's root password
:type password: str
:returns: A modified CloudServers Server.
:rtype: :class:`Server`
.. versionadded:: 0.1
"""
assert 'id' in self
data = {'server': {}}
if name is not None:
data['server']['name'] = name
if password is not None:
data['server']['adminPass'] = password
data = json.dumps(data)
url = '/'.join([get_url('cloudservers'), 'servers', str(self['id'])])
response = handle_request('put', url, data=data)
if response:
if name is not None:
self['name'] = name
return self
开发者ID:mihait,项目名称:vaporize,代码行数:25,代码来源:servers.py
示例3: create
def create(cls, size, name=None, description=None, snapshot=None,
volume_type=None):
"""Create a CloudBlockStorage Volume.
:param size: Volume size in GB (min. 100GB max. 1TB).
:type size: int
:param name: Name of Volume.
:type name: str
:param description: Description of Volume.
:type description: str
:param snapshot: Snapshot_ID or :class:`Snapshot` of the volume restore.
:type snapshot: int or :class:`Snapshot`
:param volume_type: Volume Type, either ``SATA`` or ``SSD``.
:type volume_type: str or :class:`VolumeType`
"""
assert 100 <= int(size) <= 1000
data = {'volume': {'size': int(size)}}
if name:
data['volume']['display_name'] = str(display_name)
if description:
data['volume']['display_descrition'] = str(description)
if snapshot:
if isinstance(snapshot, Snapshot):
snapshot = snapshot.id
data['volume']['snapshot_id'] = int(snapshot)
if volume_type:
if isinstance(volume_type, VolumeType):
volume_type = volume_type.name
data['volume']['volume_type'] = str(volume_type)
data = json.dumps(data)
url = '/'.join([get_url('cloudblockstorage'), 'volumes'])
return handle_request('post', url, data, cls, 'volume')
开发者ID:kolanos,项目名称:vaporize,代码行数:32,代码来源:volumes.py
示例4: list
def list(cls):
"""Returns a list of Volumes.
"""
url = [get_url('cloudblockstorage'), 'volumes']
url = '/'.join(url)
return handle_request('get', url, wrapper=cls, container='volumes')
开发者ID:kolanos,项目名称:vaporize,代码行数:7,代码来源:volumes.py
示例5: create
def create(cls, name, image, flavor, metadata=None, files=None):
"""Create a CloudServers Server
:param name: A Server's name
:type name: str
:param image: An Image or ``id``
:type image: int or :class:`Image`
:param flavor: A Flavor or ``id``
:type flavor: int or :class:`Flavor`
:param metadata: Optional meta data to include with Server
:type metadata: dict
:param files: A list of files to load on Server
:type files: dict
:returns: A shiny new CloudServers Server.
:rtype: :class:`Server`
.. versionadded:: 0.1
"""
if isinstance(image, Image):
image = image.id
image = int(image)
if isinstance(flavor, Flavor):
flavor = flavor.id
flavor = int(flavor)
data = {'server': {'name': name,
'imageId': image,
'flavorId': flavor,
'metadata': metadata or {},
'personality': []}}
if isinstance(files, dict):
for path, contents in list(files.items()):
data['personality'].append({'path': path, 'contents': contents})
data = json.dumps(data)
url = '/'.join([get_url('cloudservers'), 'servers'])
return handle_request('post', url, data, cls, 'server')
开发者ID:mihait,项目名称:vaporize,代码行数:35,代码来源:servers.py
示例6: update_server
def update_server(self, name=None, accessIPv4=None, accessIPv6=None):
"""Update this NextGenServer's name or ip addresses.
:param name: Change the NextGenServer's name
:type name: str
:param accessIPv4: IPv4 access address
:type name: str
:param accessIPv6: IPv6 access address
:type name: str
:returns: A modified CloudNextGenServers NextGenServer.
:rtype: :class:`NextGenServer`
.. versionadded:: 0.3
"""
assert 'id' in self
data = {'server': {}}
if name is not None:
data['server']['name'] = name
if addressIPv4 is not None:
data['server']['addressIPv4'] = addressIPv4
if addressIPv6 is not None:
data['server']['addressIPv6'] = addressIPv6
data = json.dumps(data)
url = '/'.join([get_url('cloudserversopenstack'), 'servers', str(self['id'])])
response = handle_request('put', url, data=data)
if response:
if name is not None:
self['name'] = name
return self
开发者ID:kolanos,项目名称:vaporize,代码行数:29,代码来源:nextgen_servers.py
示例7: add_records
def add_records(self, *records):
"""Add Records to a Domain.
>>> domain = vaporize.domains.create(...)
>>> record1 = vaporize.domains.Record.create(....)
>>> record2 = vaporize.domains.Record.create(...)
>>> domain.add_recrods(record1, record2)
:param records: Records you wish to add to this Domain.
:type records: :class:`Record`
:returns: A list of Records
:rtype: :class:`Record`
.. versionadded:: 0.1
"""
assert 'id' in self
data = {'records': []}
for record in records:
if isinstance(record, Record):
data['records'].append({
'name': record.name,
'type': record.type,
'data': record.data,
'ttl': record.ttl,
'priority': record.priority,
'comment': record.comment
})
data = json.dumps(data)
url = '/'.join([get_url('clouddns'), 'domains', str(self['id']),
'records'])
self['records'] = handle_request('post', url, data, Record, 'records',
domain_id=self['id'])
return self['records']
开发者ID:abg,项目名称:vaporize,代码行数:33,代码来源:domains.py
示例8: create
def create(cls, size, display_description='', display_name='',
snapshot_id='', volume_type=''):
"""Returns info about :param volume_type_id.
:param size: volume size in GB (min. 100GB max. 1TB).
:type : str
:param display_description: display description.
:type : str
:param display_name: display name.
:type : str
:param snapshot_id: snapshot_id of the volume to be restored.
:type : str
:param volume_type: volume type.
:type : str
"""
assert 100 <= int(size) <= 1000
data = { 'volume': { 'size': int(size)}}
if display_description:
data['volume']['display_descrition'] = str(display_description)
if display_name:
data['volume']['display_name'] = str(display_name)
if snapshot_id:
data['volume']['snapshot_id'] = str(snapshot_id)
if volume_type:
data['volume']['volume_type'] = str(volume_type)
data = json.dumps(data)
url = '/'.join([get_url('cloudblockstorage'), 'volumes'])
return handle_request('post', url, data, cls, 'volume')
开发者ID:mihait,项目名称:vaporize,代码行数:28,代码来源:volumes.py
示例9: resize
def resize(self, flavor=None, size=None):
"""Resize the memory and/or volume of the instance.
This operation changes the memory and/or volume size of the instance,
assuming a valid Flavor is provided. Restarts MySQL in the process.
:param flavor: New Flavor (memory size) ofr the Instance.
:type flavor: :class:`Flavor`
:param size: New volume size Iin GBs) for Instance, 1 to 25.
:type size: int
.. versionadded:: 0.2
"""
assert 'id' in self, "Missing Instance ID"
if isinstance(flavor, Flavor):
flavor = flavor.ref
data = {'resize': {}}
if flavor is not None:
data['resize']['flavorRef'] = flavor
if size is not None:
data['resize']['volume'] = {'size': int(size)}
data = json.dumps(data)
url = '/'.join([get_url('clouddatabases'), 'instances',
str(self['id']), 'action'])
handle_request('post', url, data)
开发者ID:rvoicilas,项目名称:vaporize,代码行数:25,代码来源:databases.py
示例10: find
def find(cls, id):
"""Returns a CloudBlockStorage Volume Type.
:param id: One of the IDs returned by the types() call.
:type volume_type_id: int
"""
url = '/'.join([get_url('cloudblockstorage'), 'types', str(id)])
return handle_request('get', url, wrapper=cls, container='volume_type')
开发者ID:kolanos,项目名称:vaporize,代码行数:8,代码来源:volumes.py
示例11: ips
def ips(self):
"""Returns a list of ip addresses attached to the NextGenServer instance.
"""
assert 'id' in self
url = '/'.join([get_url('cloudserversopenstack'), 'servers',
str(self['id']), 'ips'])
return handle_request('get', url, container='addresses')
开发者ID:kolanos,项目名称:vaporize,代码行数:8,代码来源:nextgen_servers.py
示例12: volume_detach
def volume_detach(self, volumeId):
"""Detach the volume specified by volume_id from this NextGenServer.
"""
assert 'id' in self
url = '/'.join([get_url('cloudserversopenstack'), 'servers',
str(self['id']), 'os-volume_attachments', str(volumeId)])
handle_request('delete', url)
开发者ID:kolanos,项目名称:vaporize,代码行数:8,代码来源:nextgen_servers.py
示例13: delete
def delete(self):
"""Delete this Shared IP Group.
.. versionadded:: 0.1
"""
assert 'id' in self
url = '/'.join([get_url('cloudservers'), 'shared_ip_groups',
str(self['id'])])
handle_request('delete', url)
开发者ID:mihait,项目名称:vaporize,代码行数:9,代码来源:servers.py
示例14: unshare_ip
def unshare_ip(self, address):
"""Unshare this Server's IP
.. versionadded:: 0.1
"""
assert 'id' in self
url = '/'.join([get_url('cloudservers'), 'servers', str(self['id']),
'ips', 'public', address])
handle_request('delete', url)
开发者ID:mihait,项目名称:vaporize,代码行数:9,代码来源:servers.py
示例15: describe_type
def describe_type(cls, volume_type_id):
"""Returns info about :param volume_type_id.
:param volume_type_id: One of the ids returned by the types() call.
:type volume_type_id: int
"""
url = '/'.join((get_url('cloudblockstorage'), 'types',
str(volume_type_id)))
return handle_request('get', url, container='volume_type')
开发者ID:rvoicilas,项目名称:vaporize,代码行数:9,代码来源:volumes.py
示例16: list
def list(cls):
"""Returns a list of networks.
:param detail: Provides more details about the network
:type: A list of :class:`Network`
"""
url = [get_url('cloudserversopenstack'), 'os-networksv2']
url = '/'.join(url)
return handle_request('get', url, wrapper=cls, container='networks')
开发者ID:kolanos,项目名称:vaporize,代码行数:9,代码来源:nextgen_servers.py
示例17: find
def find(cls, network_id):
"""Returns a Network by id
:param network_id: The ``network_id`` of the Network to be retrieved
:type id: str
:returns: A :class:`Network`
"""
assert len(network_id) > 0
url = '/'.join([get_url('cloudserversopenstack'), 'os-networksv2', str(network_id)])
return handle_request('get', url, wrapper=cls, container='network')
开发者ID:kolanos,项目名称:vaporize,代码行数:10,代码来源:nextgen_servers.py
示例18: revert_resize
def revert_resize(self):
"""Revert an unsuccessful resize operation
.. versionadded:: 0.3
"""
assert 'id' in self
data = json.dumps({'revertResize': None})
url = '/'.join([get_url('cloudserversopenstack'), 'servers',
str(self['id']), 'action'])
handle_request('post', url, data)
开发者ID:kolanos,项目名称:vaporize,代码行数:10,代码来源:nextgen_servers.py
示例19: unrescue
def unrescue(self):
"""Take server out of rescue mode
.. versionadded:: 0.3
"""
assert 'id' in self
data = json.dumps({'unrescue': None})
url = '/'.join([get_url('cloudserversopenstack'), 'servers',
str(self['id']), 'action'])
return handle_request('post', url, data)
开发者ID:kolanos,项目名称:vaporize,代码行数:10,代码来源:nextgen_servers.py
示例20: confirm_resize
def confirm_resize(self):
"""Confirm a successful resize operation
.. versionadded:: 0.1
"""
assert 'id' in self
data = json.dumps({'confirmResize': None})
url = '/'.join([get_url('cloudservers'), 'servers',
str(self['id']), 'action'])
handle_request('post', url, data)
开发者ID:mihait,项目名称:vaporize,代码行数:10,代码来源:servers.py
注:本文中的vaporize.core.get_url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论