services.py 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685
  1. """
  2. Specifications for services available through a provider
  3. """
  4. from abc import ABCMeta
  5. from abc import abstractmethod
  6. from abc import abstractproperty
  7. from cloudbridge.interfaces.resources import PageableObjectMixin
  8. class CloudService(object):
  9. """
  10. Base interface for any service supported by a provider. This interface
  11. has a provider property that can be used to access the provider associated
  12. with this service.
  13. """
  14. __metaclass__ = ABCMeta
  15. @abstractproperty
  16. def provider(self):
  17. """
  18. Returns the provider instance associated with this service.
  19. :rtype: :class:`.CloudProvider`
  20. :return: a CloudProvider object
  21. """
  22. pass
  23. class ComputeService(CloudService):
  24. """
  25. The compute service interface is a collection of services that provides
  26. access to the underlying compute related services in a provider. For
  27. example, the compute.instances service can be used to launch a new
  28. instance, and the compute.images service can be used to list available
  29. machine images.
  30. """
  31. __metaclass__ = ABCMeta
  32. @abstractproperty
  33. def images(self):
  34. """
  35. Provides access to all Image related services in this provider.
  36. (e.g. Glance in OpenStack)
  37. Example:
  38. .. code-block:: python
  39. # print all images
  40. for image in provider.compute.images:
  41. print(image.id, image.name, image.label)
  42. # print only first 50 images
  43. for image in provider.compute.images.list(limit=50):
  44. print(image.id, image.name, image.label)
  45. # find image by name
  46. image = provider.compute.images.find(name='Ubuntu 16.04')[0]
  47. print(image.id, image.name, image.label)
  48. :rtype: :class:`.ImageService`
  49. :return: an ImageService object
  50. """
  51. pass
  52. @abstractproperty
  53. def vm_types(self):
  54. """
  55. Provides access to all VM type related services in this provider.
  56. Example:
  57. .. code-block:: python
  58. # list all VM sizes
  59. for vm_type in provider.compute.vm_types:
  60. print(vm_type.id, vm_type.name)
  61. # find a specific size by name
  62. vm_type = provider.compute.vm_types.find(name='m1.small')[0]
  63. print(vm_type.vcpus)
  64. :rtype: :class:`.VMTypeService`
  65. :return: an VMTypeService object
  66. """
  67. pass
  68. @abstractproperty
  69. def instances(self):
  70. """
  71. Provides access to all Instance related services in this provider.
  72. Example:
  73. .. code-block:: python
  74. # launch a new instance
  75. image = provider.compute.images.find(name='Ubuntu 16.04')[0]
  76. size = provider.compute.vm_types.find(name='m1.small')[0]
  77. instance = provider.compute.instances.create('Hello', image, size)
  78. print(instance.id, instance.label)
  79. :rtype: :class:`.InstanceService`
  80. :return: an InstanceService object
  81. """
  82. pass
  83. @abstractproperty
  84. def regions(self):
  85. """
  86. Provides access to all Region related services in this provider.
  87. Example:
  88. .. code-block:: python
  89. for region in provider.compute.regions:
  90. print("Region: ", region.name)
  91. for zone in region.zones:
  92. print("\\tZone: ", zone.name)
  93. :rtype: :class:`.RegionService`
  94. :return: a RegionService object
  95. """
  96. pass
  97. class InstanceService(PageableObjectMixin, CloudService):
  98. """
  99. Provides access to instances in a provider, including creating,
  100. listing and deleting instances.
  101. """
  102. __metaclass__ = ABCMeta
  103. @abstractmethod
  104. def __iter__(self):
  105. """
  106. Iterate through the list of instances.
  107. Example:
  108. ```
  109. for instance in provider.compute.instances:
  110. print(instance.name)
  111. ```
  112. :rtype: ``object`` of :class:`.Instance`
  113. :return: an Instance object
  114. """
  115. pass
  116. @abstractmethod
  117. def get(self, instance_id):
  118. """
  119. Returns an instance given its id. Returns None
  120. if the object does not exist.
  121. :rtype: ``object`` of :class:`.Instance`
  122. :return: an Instance object
  123. """
  124. pass
  125. @abstractmethod
  126. def find(self, **kwargs):
  127. """
  128. Searches for an instance by a given list of attributes.
  129. Supported attributes: name, label
  130. :type name: ``str``
  131. :param name: The name to search for
  132. :type label: ``str``
  133. :param label: The label to search for
  134. :rtype: List of ``object`` of :class:`.Instance`
  135. :return: A list of Instance objects matching the supplied attributes.
  136. """
  137. pass
  138. @abstractmethod
  139. def list(self, limit=None, marker=None):
  140. """
  141. List available instances.
  142. The returned results can be limited with limit and marker. If not
  143. specified, the limit defaults to a global default.
  144. See :func:`~interfaces.resources.PageableObjectMixin.list`
  145. for more information on how to page through returned results.
  146. example::
  147. # List instances
  148. instlist = provider.compute.instances.list()
  149. for instance in instlist:
  150. print("Instance Data: {0}", instance)
  151. :type limit: ``int``
  152. :param limit: The maximum number of objects to return. Note that the
  153. maximum is not guaranteed to be honoured, and a lower
  154. maximum may be enforced depending on the provider. In
  155. such a case, the returned ResultList's is_truncated
  156. property can be used to determine whether more records
  157. are available.
  158. :type marker: ``str``
  159. :param marker: The marker is an opaque identifier used to assist
  160. in paging through very long lists of objects. It is
  161. returned on each invocation of the list method.
  162. :rtype: ``ResultList`` of :class:`.Instance`
  163. :return: A ResultList object containing a list of Instances
  164. """
  165. pass
  166. @abstractmethod
  167. def create(self, label, image, vm_type, subnet, key_pair=None,
  168. vm_firewalls=None, user_data=None, launch_config=None,
  169. **kwargs):
  170. """
  171. Creates a new virtual machine instance.
  172. :type label: ``str``
  173. :param label: The label of the virtual machine instance. The instance
  174. name will be derived from this label.
  175. :type image: ``MachineImage`` or ``str``
  176. :param image: The MachineImage object or id to boot the virtual machine
  177. with
  178. :type vm_type: ``VMType`` or ``str``
  179. :param vm_type: The VMType or name, specifying the size of
  180. the instance to boot into
  181. :type subnet: ``Subnet`` or ``str``
  182. :param subnet: The subnet object or a subnet string ID with which the
  183. instance should be associated. The subnet is a mandatory
  184. parameter, and must be provided when launching an
  185. instance.
  186. Note: Older clouds (with classic networking), may not
  187. have proper subnet support and are not guaranteed to
  188. work. Some providers (e.g. OpenStack) support a null
  189. value but the behaviour is implementation specific.
  190. :type key_pair: ``KeyPair`` or ``str``
  191. :param key_pair: The KeyPair object or its id, to set for the
  192. instance.
  193. :type vm_firewalls: A ``list`` of ``VMFirewall`` objects or a
  194. list of ``str`` object IDs
  195. :param vm_firewalls: A list of ``VMFirewall`` objects or a list
  196. of ``VMFirewall`` IDs, which should be
  197. assigned to this instance.
  198. The VM firewalls must be associated with the
  199. same network as the supplied subnet. Use
  200. ``network.vm_firewalls`` to retrieve a list
  201. of firewalls belonging to a network.
  202. :type user_data: ``str``
  203. :param user_data: An extra userdata object which is compatible with
  204. the provider.
  205. :type launch_config: ``LaunchConfig`` object
  206. :param launch_config: A ``LaunchConfig`` object which
  207. describes advanced launch configuration options for an instance.
  208. Currently, this includes only block_device_mappings. To
  209. construct a launch configuration object, call
  210. provider.compute.instances.create_launch_config()
  211. :rtype: ``object`` of :class:`.Instance`
  212. :return: an instance of Instance class
  213. """
  214. pass
  215. def create_launch_config(self):
  216. """
  217. Creates a ``LaunchConfig`` object which can be used
  218. to set additional options when launching an instance, such as
  219. block device mappings and network interfaces.
  220. :rtype: ``object`` of :class:`.LaunchConfig`
  221. :return: an instance of a LaunchConfig class
  222. """
  223. pass
  224. class VolumeService(PageableObjectMixin, CloudService):
  225. """
  226. Base interface for a Volume Service.
  227. """
  228. __metaclass__ = ABCMeta
  229. @abstractmethod
  230. def get(self, volume_id):
  231. """
  232. Returns a volume given its id.
  233. :rtype: ``object`` of :class:`.Volume`
  234. :return: a Volume object or ``None`` if the volume does not exist.
  235. """
  236. pass
  237. @abstractmethod
  238. def find(self, **kwargs):
  239. """
  240. Searches for a volume by a given list of attributes.
  241. Supported attributes: label
  242. :rtype: ``object`` of :class:`.Volume`
  243. :return: a Volume object or ``None`` if not found.
  244. """
  245. pass
  246. @abstractmethod
  247. def list(self, limit=None, marker=None):
  248. """
  249. List all volumes.
  250. :rtype: ``list`` of :class:`.Volume`
  251. :return: a list of Volume objects.
  252. """
  253. pass
  254. @abstractmethod
  255. def create(self, label, size, snapshot=None, description=None):
  256. """
  257. Creates a new volume.
  258. :type label: ``str``
  259. :param label: The label for the volume.
  260. :type size: ``int``
  261. :param size: The size of the volume (in GB).
  262. :type snapshot: ``str`` or :class:`.Snapshot` object
  263. :param snapshot: An optional reference to a snapshot from which this
  264. volume should be created.
  265. :type description: ``str``
  266. :param description: An optional description that may be supported by
  267. some providers. Providers that do not support this
  268. property will return ``None``.
  269. :rtype: ``object`` of :class:`.Volume`
  270. :return: a newly created Volume object.
  271. """
  272. pass
  273. def delete(self, volume):
  274. """
  275. Delete an existing volume.
  276. :type volume: ``str`` or :class:`Volume`
  277. :param volume: The object or ID of the volume to be deleted.
  278. """
  279. pass
  280. class SnapshotService(PageableObjectMixin, CloudService):
  281. """
  282. Base interface for a Snapshot Service.
  283. """
  284. __metaclass__ = ABCMeta
  285. @abstractmethod
  286. def get(self, snapshot_id):
  287. """
  288. Returns a snapshot given its id.
  289. :rtype: ``object`` of :class:`.Snapshot`
  290. :return: a Snapshot object or ``None`` if the snapshot does not exist.
  291. """
  292. pass
  293. @abstractmethod
  294. def find(self, **kwargs):
  295. """
  296. Searches for a snapshot by a given list of attributes.
  297. Supported attributes: label
  298. :rtype: list of :class:`.Snapshot`
  299. :return: a Snapshot object or an empty list if none found.
  300. """
  301. pass
  302. @abstractmethod
  303. def list(self, limit=None, marker=None):
  304. """
  305. List all snapshots.
  306. :rtype: ``list`` of :class:`.Snapshot`
  307. :return: a list of Snapshot objects.
  308. """
  309. pass
  310. @abstractmethod
  311. def create(self, label, volume, description=None):
  312. """
  313. Creates a new snapshot off a volume.
  314. :type label: ``str``
  315. :param label: The label for the snapshot.
  316. :type volume: ``str`` or ``Volume``
  317. :param volume: The volume to create a snapshot of.
  318. :type description: ``str``
  319. :param description: An optional description that may be supported by
  320. some providers. Providers that do not support this
  321. property will return None.
  322. :rtype: ``object`` of :class:`.Snapshot`
  323. :return: a newly created Snapshot object.
  324. """
  325. pass
  326. def delete(self, snapshot):
  327. """
  328. Delete an existing snapshot.
  329. :type snapshot: ``str`` or :class:`Snapshot`
  330. :param snapshot: The object or ID of the snapshot to be deleted.
  331. """
  332. pass
  333. class StorageService(CloudService):
  334. """
  335. The Storage Service interface provides access to block device services,
  336. such as volume and snapshot services, as well as object store services,
  337. such as buckets, in the provider.
  338. """
  339. __metaclass__ = ABCMeta
  340. @abstractproperty
  341. def volumes(self):
  342. """
  343. Provides access to volumes (i.e., block storage) for this provider.
  344. Example:
  345. .. code-block:: python
  346. # print all volumes
  347. for vol in provider.storage.volumes:
  348. print(vol.id, vol.name, vol.label)
  349. # find volume by label
  350. vol = provider.storage.volumes.find(label='my_vol')[0]
  351. print(vol.id, vol.name, vol.label)
  352. :rtype: :class:`.VolumeService`
  353. :return: a VolumeService object
  354. """
  355. pass
  356. @abstractproperty
  357. def snapshots(self):
  358. """
  359. Provides access to volume snapshots for this provider.
  360. Example:
  361. .. code-block:: python
  362. # print all snapshots
  363. for snap in provider.storage.snapshots:
  364. print(snap.id, snap.name, snap.label)
  365. # find snapshot by label
  366. snap = provider.storage.snapshots.find(label='my_snap')[0]
  367. print(snap.id, snap.name, snap.label)
  368. :rtype: :class:`.SnapshotService`
  369. :return: a SnapshotService object
  370. """
  371. pass
  372. @abstractproperty
  373. def buckets(self):
  374. """
  375. Provides access to object storage services in this provider.
  376. Example:
  377. .. code-block:: python
  378. # print all buckets
  379. for bucket in provider.storage.buckets:
  380. print(bucket.id, bucket.name)
  381. # find bucket by name
  382. bucket = provider.storage.buckets.find(name='my_bucket')[0]
  383. print(bucket.id, bucket.name)
  384. :rtype: :class:`.BucketService`
  385. :return: a BucketService object
  386. """
  387. pass
  388. class ImageService(PageableObjectMixin, CloudService):
  389. """
  390. Base interface for an Image Service
  391. """
  392. __metaclass__ = ABCMeta
  393. @abstractmethod
  394. def get(self, image_id):
  395. """
  396. Returns an Image given its id. Returns None if the Image does not
  397. exist.
  398. :rtype: ``object`` of :class:`.Image`
  399. :return: an Image instance
  400. """
  401. pass
  402. @abstractmethod
  403. def find(self, **kwargs):
  404. """
  405. Searches for an image by a given list of attributes
  406. Supported attributes: name, label
  407. :rtype: ``object`` of :class:`.Image`
  408. :return: an Image instance
  409. """
  410. pass
  411. @abstractmethod
  412. def list(self, filter_by_owner=True, limit=None, marker=None):
  413. """
  414. List all images.
  415. :type filter_by_owner: ``bool``
  416. :param filter_by_owner: If ``True``, return only images owned
  417. by the current user. Else, return all
  418. public images available from the provider.
  419. Note that fetching all images may take a
  420. long time.
  421. :rtype: ``list`` of :class:`.Image`
  422. :return: list of image objects
  423. """
  424. pass
  425. class NetworkingService(CloudService):
  426. """
  427. Base service interface for networking.
  428. This service offers a collection of networking services that in turn
  429. provide access to networking resources.
  430. """
  431. __metaclass__ = ABCMeta
  432. @abstractproperty
  433. def networks(self):
  434. """
  435. Provides access to all Network related services.
  436. :rtype: :class:`.NetworkService`
  437. :return: a Network service object
  438. """
  439. pass
  440. @abstractproperty
  441. def subnets(self):
  442. """
  443. Provides access to all Subnet related services.
  444. :rtype: :class:`.SubnetService`
  445. :return: a Subnet service object
  446. """
  447. pass
  448. @abstractproperty
  449. def routers(self):
  450. """
  451. Provides access to all Router related services.
  452. :rtype: :class:`.RouterService`
  453. :return: a Router service object
  454. """
  455. pass
  456. @abstractproperty
  457. def _floating_ips(self):
  458. """
  459. Provides access to floating ips for this provider.
  460. This service is not iterable.
  461. :rtype: :class:`.FloatingIPService`
  462. :return: a FloatingIPService object
  463. """
  464. pass
  465. @abstractproperty
  466. def _gateways(self):
  467. """
  468. Provides access to internet gateways for this provider.
  469. This service is not iterable.
  470. :rtype: :class:`.GatewayService`
  471. :return: a GatewayService object
  472. """
  473. pass
  474. class NetworkService(PageableObjectMixin, CloudService):
  475. """
  476. Base interface for a Network Service.
  477. """
  478. __metaclass__ = ABCMeta
  479. @abstractmethod
  480. def get(self, network_id):
  481. """
  482. Returns a Network given its ID or ``None`` if not found.
  483. :type network_id: ``str``
  484. :param network_id: The ID of the network to retrieve.
  485. :rtype: ``object`` of :class:`.Network`
  486. :return: a Network object
  487. """
  488. pass
  489. @abstractmethod
  490. def list(self, limit=None, marker=None):
  491. """
  492. List all networks.
  493. :rtype: ``list`` of :class:`.Network`
  494. :return: list of Network objects
  495. """
  496. pass
  497. @abstractmethod
  498. def find(self, **kwargs):
  499. """
  500. Searches for a network by a given list of attributes.
  501. Supported attributes: name, label
  502. :rtype: List of ``object`` of :class:`.Network`
  503. :return: A list of Network objects matching the supplied attributes.
  504. """
  505. pass
  506. @abstractmethod
  507. def create(self, label, cidr_block):
  508. """
  509. Create a new network.
  510. :type label: ``str``
  511. :param label: A label for the network.
  512. :type cidr_block: ``str``
  513. :param cidr_block: The cidr block for this network. Some providers
  514. will respect this at the network level, while others
  515. will only respect it at subnet level. However, to
  516. write portable code, you should make sure that any
  517. subnets you create fall within this initially
  518. specified range. Note that the block size should be
  519. between a /16 netmask (65,536 IP addresses) and /28
  520. netmask (16 IP addresses), e.g. 10.0.0.0/16.
  521. :rtype: ``object`` of :class:`.Network`
  522. :return: A Network object
  523. """
  524. pass
  525. @abstractmethod
  526. def delete(self, network):
  527. """
  528. Delete an existing Network.
  529. :type network: ``str`` or :class:`.Network`
  530. :param network: The object or id of the network to be deleted.
  531. """
  532. pass
  533. @abstractproperty
  534. def subnets(self):
  535. """
  536. Provides access to subnets.
  537. Example:
  538. .. code-block:: python
  539. # Print all subnets
  540. for s in provider.networking.subnets:
  541. print(s.id, s.name, s.label)
  542. # Get subnet by ID
  543. s = provider.networking.subnets.get('subnet-id')
  544. print(s.id, s.name, s.label)
  545. :rtype: :class:`.SubnetService`
  546. :return: a SubnetService object
  547. """
  548. pass
  549. class SubnetService(PageableObjectMixin, CloudService):
  550. """
  551. Base interface for a Subnet Service.
  552. """
  553. __metaclass__ = ABCMeta
  554. @abstractmethod
  555. def get(self, subnet_id):
  556. """
  557. Returns a Subnet given its ID or ``None`` if not found.
  558. :type subnet_id: :class:`.Network` object or ``str``
  559. :param subnet_id: The ID of the subnet to retrieve.
  560. :rtype: ``object`` of :class:`.Subnet`
  561. :return: a Subnet object
  562. """
  563. pass
  564. @abstractmethod
  565. # pylint:disable=arguments-differ
  566. def list(self, network=None, limit=None, marker=None):
  567. """
  568. List all subnets or filter them by the supplied network ID.
  569. :type network: ``str``
  570. :param network: Network object or ID with which to filter the subnets.
  571. :rtype: ``list`` of :class:`.Subnet`
  572. :return: list of Subnet objects
  573. """
  574. pass
  575. @abstractmethod
  576. def find(self, **kwargs):
  577. """
  578. Searches for a subnet by a given list of attributes.
  579. Supported attributes: name, label
  580. :rtype: List of ``object`` of :class:`.Subnet`
  581. :return: A list of Subnet objects matching the supplied attributes.
  582. """
  583. pass
  584. @abstractmethod
  585. def create(self, label, network, cidr_block):
  586. """
  587. Create a new subnet within the supplied network.
  588. :type label: ``str``
  589. :param label: The subnet label.
  590. :type network: :class:`.Network` object or ``str``
  591. :param network: Network object or ID under which to create the subnet.
  592. :type cidr_block: ``str``
  593. :param cidr_block: CIDR block within the Network to assign to the
  594. subnet.
  595. :rtype: ``object`` of :class:`.Subnet`
  596. :return: A Subnet object
  597. """
  598. pass
  599. @abstractmethod
  600. def get_or_create_default(self):
  601. """
  602. Return a default subnet for the account or create one if not found.
  603. This provides a convenience method for obtaining a network if you
  604. are not particularly concerned with how the network is structured.
  605. A default network is one marked as such by the provider or matches the
  606. default label used by this library (e.g., cloudbridge-net).
  607. :rtype: ``object`` of :class:`.Subnet`
  608. :return: A Subnet object
  609. """
  610. pass
  611. @abstractmethod
  612. def delete(self, subnet):
  613. """
  614. Delete an existing Subnet.
  615. :type subnet: :class:`.Subnet` object or ``str``
  616. :param subnet: Subnet object or ID of the subnet to delete.
  617. """
  618. pass
  619. class RouterService(PageableObjectMixin, CloudService):
  620. """
  621. Manage networking router actions and resources.
  622. """
  623. __metaclass__ = ABCMeta
  624. @abstractmethod
  625. def get(self, router_id):
  626. """
  627. Returns a Router object given its ID.
  628. :type router_id: ``str``
  629. :param router_id: The ID of the router to retrieve.
  630. :rtype: ``object`` of :class:`.Router` or ``None``
  631. :return: a Router object of ``None`` if not found.
  632. """
  633. pass
  634. @abstractmethod
  635. def list(self, limit=None, marker=None):
  636. """
  637. List all routers.
  638. :rtype: ``list`` of :class:`.Router`
  639. :return: list of Router objects
  640. """
  641. pass
  642. @abstractmethod
  643. def find(self, **kwargs):
  644. """
  645. Searches for a router by a given list of attributes.
  646. Supported attributes: label
  647. :rtype: List of ``object`` of :class:`.Router`
  648. :return: A list of Router objects matching the supplied attributes.
  649. """
  650. pass
  651. @abstractmethod
  652. def create(self, label, network):
  653. """
  654. Create a new router.
  655. :type label: ``str``
  656. :param label: A router label.
  657. :type network: :class:`.Network` object or ``str``
  658. :param network: Network object or ID under which to create the router.
  659. :rtype: ``object`` of :class:`.Router`
  660. :return: A Router object
  661. """
  662. pass
  663. @abstractmethod
  664. def delete(self, router):
  665. """
  666. Delete an existing Router.
  667. :type router: :class:`.Router` object or ``str``
  668. :param router: Router object or ID of the router to delete.
  669. """
  670. pass
  671. class BucketService(PageableObjectMixin, CloudService):
  672. """
  673. The Bucket Service interface provides access to the underlying
  674. object storage capabilities of this provider. This service is optional and
  675. the :func:`CloudProvider.has_service()` method should be used to verify its
  676. availability before using the service.
  677. """
  678. __metaclass__ = ABCMeta
  679. @abstractmethod
  680. def get(self, bucket_id):
  681. """
  682. Returns a bucket given its ID. Returns ``None`` if the bucket
  683. does not exist. On some providers, such as AWS and OpenStack,
  684. the bucket id is the same as its name.
  685. Example:
  686. .. code-block:: python
  687. bucket = provider.storage.buckets.get('my_bucket_id')
  688. print(bucket.id, bucket.name)
  689. :rtype: :class:`.Bucket`
  690. :return: a Bucket instance
  691. """
  692. pass
  693. @abstractmethod
  694. def find(self, **kwargs):
  695. """
  696. Searches for a bucket by a given list of attributes.
  697. Supported attributes: name
  698. Example:
  699. .. code-block:: python
  700. buckets = provider.storage.buckets.find(name='my_bucket_name')
  701. for bucket in buckets:
  702. print(bucket.id, bucket.name)
  703. :rtype: :class:`.Bucket`
  704. :return: a Bucket instance
  705. """
  706. pass
  707. @abstractmethod
  708. def list(self, limit=None, marker=None):
  709. """
  710. List all buckets.
  711. Example:
  712. .. code-block:: python
  713. buckets = provider.storage.buckets.find(name='my_bucket_name')
  714. for bucket in buckets:
  715. print(bucket.id, bucket.name)
  716. :rtype: :class:`.Bucket`
  717. :return: list of bucket objects
  718. """
  719. pass
  720. @abstractmethod
  721. def create(self, name, location=None):
  722. """
  723. Create a new bucket.
  724. If a bucket with the specified name already exists, return a reference
  725. to that bucket.
  726. Example:
  727. .. code-block:: python
  728. bucket = provider.storage.buckets.create('my_bucket_name')
  729. print(bucket.name)
  730. :type name: str
  731. :param name: The name of this bucket.
  732. :type location: ``object`` of :class:`.Region`
  733. :param location: The region in which to place this bucket.
  734. :return: a Bucket object
  735. :rtype: ``object`` of :class:`.Bucket`
  736. """
  737. pass
  738. class BucketObjectService(CloudService):
  739. """
  740. The Bucket Object Service interface provides access to the underlying
  741. object storage capabilities of this provider. This service is optional and
  742. the :func:`CloudProvider.has_service()` method should be used to verify its
  743. availability before using the service.
  744. """
  745. __metaclass__ = ABCMeta
  746. @abstractmethod
  747. def get(self, bucket, object_id):
  748. """
  749. Returns a bucket object given its ID and the ID of bucket containing
  750. it. Returns ``None`` if the bucket object or bucket does not exist.
  751. On some providers, such as AWS and OpenStack, the bucket id is the
  752. same as its name.
  753. Example:
  754. .. code-block:: python
  755. bucket = provider.storage.buckets.get('my_bucket_id')
  756. # pylint:disable=protected-access
  757. buck_obj = provider.storage._bucket_objects.get('my_object_id',
  758. bucket)
  759. print(buck_obj.id, buck_obj.name)
  760. :rtype: :class:`.BucketObject`
  761. :return: a BucketObject instance
  762. """
  763. pass
  764. @abstractmethod
  765. def find(self, bucket, **kwargs):
  766. """
  767. Searches for a bucket object in a bucket by a given list of attributes.
  768. Supported attributes: name
  769. Example:
  770. .. code-block:: python
  771. bucket = provider.storage.buckets.get('my_bucket_id')
  772. # pylint:disable=protected-access
  773. objs = provider.storage._bucket_objects.find(bucket,
  774. name='my_obj_name')
  775. for buck_obj in objs:
  776. print(buck_obj.id, buck_obj.name)
  777. :rtype: :class:`.BucketObject`
  778. :return: a BucketObject instance
  779. """
  780. pass
  781. @abstractmethod
  782. def list(self, bucket, limit=None, marker=None):
  783. """
  784. List all bucket objects within a bucket.
  785. Example:
  786. .. code-block:: python
  787. bucket = provider.storage.buckets.get('my_bucket_id')
  788. # pylint:disable=protected-access
  789. objs = provider.storage._bucket_objects.list(bucket)
  790. for buck_obj in objs:
  791. print(buck_obj.id, buck_obj.name)
  792. :rtype: :class:`.BucketObject`
  793. :return: a BucketObject instance
  794. """
  795. pass
  796. @abstractmethod
  797. def create(self, bucket, object_name):
  798. """
  799. Create a new bucket object within a bucket.
  800. Example:
  801. .. code-block:: python
  802. bucket = provider.storage.buckets.get('my_bucket_id')
  803. # pylint:disable=protected-access
  804. buck_obj = provider.storage._bucket_objects.create('my_name',
  805. bucket)
  806. print(buck_obj.name)
  807. :type object_name: str
  808. :param object_name: The name of this bucket.
  809. :type bucket: str
  810. :param bucket: A bucket object.
  811. :return: a BucketObject instance
  812. :rtype: ``object`` of :class:`.BucketObject`
  813. """
  814. pass
  815. class SecurityService(CloudService):
  816. """
  817. The security service interface can be used to access security related
  818. functions in the provider, such as firewall control and keypairs.
  819. """
  820. __metaclass__ = ABCMeta
  821. @abstractproperty
  822. def key_pairs(self):
  823. """
  824. Provides access to key pairs for this provider.
  825. Example:
  826. .. code-block:: python
  827. # print all keypairs
  828. for kp in provider.security.keypairs:
  829. print(kp.id, kp.name)
  830. # find keypair by name
  831. kp = provider.security.keypairs.find(name='my_key_pair')[0]
  832. print(kp.id, kp.name)
  833. :rtype: :class:`.KeyPairService`
  834. :return: a KeyPairService object
  835. """
  836. pass
  837. @abstractproperty
  838. def vm_firewalls(self):
  839. """
  840. Provides access to firewalls (security groups) for this provider.
  841. Example:
  842. .. code-block:: python
  843. # print all VM firewalls
  844. for fw in provider.security.vm_firewalls:
  845. print(fw.id, fw.name)
  846. # find firewall by name
  847. fw = provider.security.vm_firewalls.find(name='my_vm_fw')[0]
  848. print(fw.id, fw.name)
  849. :rtype: :class:`.VMFirewallService`
  850. :return: a VMFirewallService object
  851. """
  852. pass
  853. @abstractproperty
  854. def _vm_firewall_rules(self):
  855. """
  856. Provides access to firewall (security group) rules for this provider.
  857. This service is not iterable.
  858. :rtype: :class:`.VMFirewallRuleService`
  859. :return: a VMFirewallRuleService object
  860. """
  861. pass
  862. class KeyPairService(PageableObjectMixin, CloudService):
  863. """
  864. Base interface for key pairs.
  865. """
  866. __metaclass__ = ABCMeta
  867. @abstractmethod
  868. def get(self, key_pair_id):
  869. """
  870. Return a KeyPair given its ID or ``None`` if not found.
  871. On some providers, such as AWS and OpenStack, the KeyPair ID is
  872. the same as its name.
  873. Example:
  874. .. code-block:: python
  875. key_pair = provider.security.keypairs.get('my_key_pair_id')
  876. print(key_pair.id, key_pair.name)
  877. :rtype: :class:`.KeyPair`
  878. :return: a KeyPair instance
  879. """
  880. pass
  881. @abstractmethod
  882. def list(self, limit=None, marker=None):
  883. """
  884. List all key pairs associated with this account.
  885. :rtype: ``list`` of :class:`.KeyPair`
  886. :return: list of KeyPair objects
  887. """
  888. pass
  889. @abstractmethod
  890. def find(self, **kwargs):
  891. """
  892. Searches for a key pair by a given list of attributes.
  893. Supported attributes: name
  894. :rtype: ``object`` of :class:`.KeyPair`
  895. :return: a KeyPair object
  896. """
  897. pass
  898. @abstractmethod
  899. def create(self, name, public_key_material=None):
  900. """
  901. Create a new key pair or raise an exception if one already exists.
  902. If the public_key_material is provided, the material will be imported
  903. to create the new keypair. Otherwise, a new public and private key
  904. pair will be generated.
  905. :type name: str
  906. :param name: The name of the key pair to be created.
  907. :type public_key_material: str
  908. :param public_key_material: The key-pair material to import in OpenSSH
  909. format.
  910. :rtype: ``object`` of :class:`.KeyPair`
  911. :return: A keypair instance or ``None``.
  912. """
  913. pass
  914. @abstractmethod
  915. def delete(self, key_pair):
  916. """
  917. Delete an existing keypair.
  918. :type key_pair: ``str`` or :class:`.KeyPair`
  919. :param key_pair: The object or id of the key pair to be deleted.
  920. :rtype: ``bool``
  921. :return: ``True`` if the key does not exist, ``False`` otherwise. Note
  922. that this implies that the key may not have been deleted by
  923. this method but instead has not existed at all.
  924. """
  925. pass
  926. class VMFirewallService(PageableObjectMixin, CloudService):
  927. """
  928. Base interface for VM firewalls.
  929. """
  930. __metaclass__ = ABCMeta
  931. @abstractmethod
  932. def get(self, vm_firewall_id):
  933. """
  934. Returns a VMFirewall given its ID. Returns ``None`` if the
  935. VMFirewall does not exist.
  936. Example:
  937. .. code-block:: python
  938. fw = provider.security.vm_firewalls.get('my_fw_id')
  939. print(fw.id, fw.name)
  940. :rtype: :class:`.VMFirewall`
  941. :return: a VMFirewall instance
  942. """
  943. pass
  944. @abstractmethod
  945. def list(self, limit=None, marker=None):
  946. """
  947. List all VM firewalls associated with this account.
  948. :rtype: ``list`` of :class:`.VMFirewall`
  949. :return: list of VMFirewall objects
  950. """
  951. pass
  952. @abstractmethod
  953. def create(self, label, network, description=None):
  954. """
  955. Create a new VMFirewall.
  956. :type label: str
  957. :param label: The label for the new VM firewall.
  958. :type network: ``str``
  959. :param network: Network ID under which to create the VM firewall.
  960. :type description: str
  961. :param description: The description of the new VM firewall.
  962. :rtype: ``object`` of :class:`.VMFirewall`
  963. :return: A VMFirewall instance or ``None`` if one was not created.
  964. """
  965. pass
  966. @abstractmethod
  967. def find(self, **kwargs):
  968. """
  969. Get VM firewalls associated with your account filtered by name.
  970. Supported attributes: name
  971. :type name: str
  972. :param name: The name of the VM firewall to retrieve.
  973. :rtype: list of :class:`VMFirewall`
  974. :return: A list of VMFirewall objects or an empty list if none
  975. found.
  976. """
  977. pass
  978. @abstractmethod
  979. def delete(self, vm_firewall):
  980. """
  981. Delete an existing VMFirewall.
  982. :type vm_firewall: ``str`` or :class:`.VMFirewall`
  983. :param vm_firewall: The object or VM firewall ID to be deleted.
  984. """
  985. pass
  986. class VMFirewallRuleService(CloudService):
  987. """
  988. Base interface for Firewall rules.
  989. """
  990. __metaclass__ = ABCMeta
  991. @abstractmethod
  992. def get(self, firewall, rule_id):
  993. """
  994. Return a firewall rule given its ID.
  995. Returns ``None`` if the rule does not exist.
  996. Example:
  997. .. code-block:: python
  998. fw = provider.security.vm_firewalls.get('my_fw_id')
  999. rule = fw.rules.get('rule_id')
  1000. print(rule.id, rule.label)
  1001. :type firewall: ``VMFirewall``
  1002. :param firewall: The firewall to which the rule is attached
  1003. :type rule_id: str
  1004. :param rule_id: The ID of the desired firewall rule
  1005. :rtype: :class:`.FirewallRule`
  1006. :return: a FirewallRule instance
  1007. """
  1008. pass
  1009. @abstractmethod
  1010. def list(self, firewall, limit=None, marker=None):
  1011. """
  1012. List all firewall rules associated with this firewall.
  1013. :type firewall: ``VMFirewall``
  1014. :param firewall: The firewall to which the rules are attached
  1015. :rtype: ``list`` of :class:`.FirewallRule`
  1016. :return: list of Firewall rule objects
  1017. """
  1018. pass
  1019. @abstractmethod
  1020. def create(self, firewall, direction, protocol=None, from_port=None,
  1021. to_port=None, cidr=None, src_dest_fw=None):
  1022. """
  1023. Create a VM firewall rule.
  1024. If a matching rule already exists, return it.
  1025. Example:
  1026. .. code-block:: python
  1027. from cloudbridge.interfaces.resources import TrafficDirection
  1028. from cloudbridge.interfaces.resources import BaseNetwork
  1029. fw = provider.security.vm_firewalls.get('my_fw_id')
  1030. fw.rules.create(TrafficDirection.INBOUND, protocol='tcp',
  1031. from_port=80, to_port=80,
  1032. cidr=BaseNetwork.CB_DEFAULT_IPV4RANGE)
  1033. fw.rules.create(TrafficDirection.INBOUND, src_dest_fw=fw)
  1034. fw.rules.create(TrafficDirection.OUTBOUND, src_dest_fw=fw)
  1035. You need to pass in either ``src_dest_fw`` OR ``protocol`` AND
  1036. ``from_port``, ``to_port``, ``cidr``. In other words, either
  1037. you are authorizing another group or you are authorizing some
  1038. IP-based rule.
  1039. :type firewall: ``VMFirewall``
  1040. :param firewall: The firewall to which the rule should be attached
  1041. :type direction: :class:``.TrafficDirection``
  1042. :param direction: Either ``TrafficDirection.INBOUND`` |
  1043. ``TrafficDirection.OUTBOUND``
  1044. :type protocol: ``str``
  1045. :param protocol: Either ``tcp`` | ``udp`` | ``icmp``.
  1046. :type from_port: ``int``
  1047. :param from_port: The beginning port number you are enabling.
  1048. :type to_port: ``int``
  1049. :param to_port: The ending port number you are enabling.
  1050. :type cidr: ``str`` or list of ``str``
  1051. :param cidr: The CIDR block you are providing access to.
  1052. :type src_dest_fw: :class:`.VMFirewall`
  1053. :param src_dest_fw: The VM firewall object which is the
  1054. source/destination of the traffic, depending on
  1055. whether it's ingress/egress traffic.
  1056. :rtype: :class:`.VMFirewallRule`
  1057. :return: Rule object if successful or ``None``.
  1058. """
  1059. pass
  1060. @abstractmethod
  1061. def find(self, firewall, **kwargs):
  1062. """
  1063. Find a firewall rule filtered by the given parameters.
  1064. :type firewall: ``VMFirewall``
  1065. :param firewall: The firewall in which to look for rules
  1066. :type label: str
  1067. :param label: The label of the VM firewall to retrieve.
  1068. :type protocol: ``str``
  1069. :param protocol: Either ``tcp`` | ``udp`` | ``icmp``.
  1070. :type from_port: ``int``
  1071. :param from_port: The beginning port number you are enabling.
  1072. :type to_port: ``int``
  1073. :param to_port: The ending port number you are enabling.
  1074. :type cidr: ``str`` or list of ``str``
  1075. :param cidr: The CIDR block you are providing access to.
  1076. :type src_dest_fw: :class:`.VMFirewall`
  1077. :param src_dest_fw: The VM firewall object which is the
  1078. source/destination of the traffic, depending on
  1079. whether it's ingress/egress traffic.
  1080. :type src_dest_fw_id: :class:`.str`
  1081. :param src_dest_fw_id: The VM firewall id which is the
  1082. source/destination of the traffic, depending on
  1083. whether it's ingress/egress traffic.
  1084. :rtype: list of :class:`VMFirewallRule`
  1085. :return: A list of VMFirewall objects or an empty list if none
  1086. found.
  1087. """
  1088. pass
  1089. @abstractmethod
  1090. def delete(self, firewall, rule_id):
  1091. """
  1092. Delete an existing VMFirewall rule.
  1093. :type firewall: ``VMFirewall``
  1094. :param firewall: The firewall to which the rule is attached
  1095. :type rule_id: str
  1096. :param rule_id: The VM firewall rule to be deleted.
  1097. """
  1098. pass
  1099. class VMTypeService(PageableObjectMixin, CloudService):
  1100. __metaclass__ = ABCMeta
  1101. @abstractmethod
  1102. def get(self, vm_type_id):
  1103. """
  1104. Returns an VMType given its ID. Returns ``None`` if the
  1105. VMType does not exist.
  1106. Example:
  1107. .. code-block:: python
  1108. vm_type = provider.compute.vm_types.get('my_vm_type_id')
  1109. print(vm_type.id, vm_type.name)
  1110. :rtype: :class:`.VMType`
  1111. :return: an VMType instance
  1112. """
  1113. pass
  1114. @abstractmethod
  1115. def list(self, limit=None, marker=None):
  1116. """
  1117. List all VM types.
  1118. :rtype: ``list`` of :class:`.VMType`
  1119. :return: list of VMType objects
  1120. """
  1121. pass
  1122. @abstractmethod
  1123. def find(self, **kwargs):
  1124. """
  1125. Searches for instances by a given list of attributes.
  1126. Supported attributes: name
  1127. :rtype: ``object`` of :class:`.VMType`
  1128. :return: an Instance object
  1129. """
  1130. pass
  1131. class RegionService(PageableObjectMixin, CloudService):
  1132. """
  1133. Base interface for a Region service
  1134. """
  1135. __metaclass__ = ABCMeta
  1136. @abstractproperty
  1137. def current(self):
  1138. """
  1139. Returns the current region that this provider is connected to.
  1140. If the current region cannot be discovered, return ``None``.
  1141. :rtype: ``object`` of :class:`.Region`
  1142. :return: a Region instance or ``None``
  1143. """
  1144. pass
  1145. @abstractmethod
  1146. def get(self, region_id):
  1147. """
  1148. Returns a region given its id. Returns None if the region
  1149. does not exist.
  1150. :rtype: ``object`` of :class:`.Region`
  1151. :return: a Region instance
  1152. """
  1153. pass
  1154. @abstractmethod
  1155. def list(self, limit=None, marker=None):
  1156. """
  1157. List all regions.
  1158. :rtype: ``list`` of :class:`.Region`
  1159. :return: list of region objects
  1160. """
  1161. pass
  1162. @abstractmethod
  1163. def find(self, **kwargs):
  1164. """
  1165. Searches for a region by a given list of attributes.
  1166. Supported attributes: name
  1167. :rtype: ``object`` of :class:`.Region`
  1168. :return: a Region object
  1169. """
  1170. pass
  1171. class GatewayService(CloudService):
  1172. """
  1173. Manage internet gateway resources.
  1174. """
  1175. __metaclass__ = ABCMeta
  1176. @abstractmethod
  1177. def get_or_create(self, network):
  1178. """
  1179. Creates new or returns an existing internet gateway for a network.
  1180. The returned gateway object can subsequently be attached to a router to
  1181. provide internet routing to a network.
  1182. :type network: ``Network``
  1183. :param network: The network to which the gateway should be attached.
  1184. :rtype: ``object`` of :class:`.InternetGateway` or ``None``
  1185. :return: an InternetGateway object of ``None`` if not found.
  1186. """
  1187. pass
  1188. @abstractmethod
  1189. def delete(self, network, gateway):
  1190. """
  1191. Delete a gateway.
  1192. :type network: ``Network``
  1193. :param network: The network to which the gateway is attached.
  1194. :type gateway: :class:`.Gateway` object
  1195. :param gateway: Gateway object to delete.
  1196. """
  1197. pass
  1198. @abstractmethod
  1199. def list(self, network, limit=None, marker=None):
  1200. """
  1201. List all available internet gateways.
  1202. :type network: ``Network``
  1203. :param network: The network to which the gateway is attached.
  1204. :rtype: ``list`` of :class:`.InternetGateway` or ``None``
  1205. :return: Current list of internet gateways.
  1206. """
  1207. pass
  1208. class FloatingIPService(CloudService):
  1209. """
  1210. Base interface for a FloatingIP Service.
  1211. """
  1212. __metaclass__ = ABCMeta
  1213. @abstractmethod
  1214. def get(self, gateway, fip_id):
  1215. """
  1216. Returns a FloatingIP given its ID or ``None`` if not found.
  1217. :type gateway: ``Gateway``
  1218. :param gateway: The gateway to which the Floating IP is attached
  1219. :type fip_id: ``str``
  1220. :param fip_id: The ID of the FloatingIP to retrieve.
  1221. :rtype: ``object`` of :class:`.FloatingIP`
  1222. :return: a FloatingIP object
  1223. """
  1224. pass
  1225. @abstractmethod
  1226. def list(self, gateway, limit=None, marker=None):
  1227. """
  1228. List floating (i.e., static) IP addresses.
  1229. :type gateway: ``Gateway``
  1230. :param gateway: The gateway to which the Floating IPs are attached
  1231. :rtype: ``list`` of :class:`.FloatingIP`
  1232. :return: list of FloatingIP objects
  1233. """
  1234. pass
  1235. @abstractmethod
  1236. def find(self, gateway, **kwargs):
  1237. """
  1238. Searches for a FloatingIP by a given list of attributes.
  1239. Supported attributes: name, public_ip
  1240. Example:
  1241. .. code-block:: python
  1242. fip = provider.networking.gateways.get('id').floating_ips.find(
  1243. public_ip='public_ip')
  1244. :type gateway: ``Gateway``
  1245. :param gateway: The gateway to which the Floating IPs are attached
  1246. :rtype: List of ``object`` of :class:`.FloatingIP`
  1247. :return: A list of FloatingIP objects matching the supplied attributes.
  1248. """
  1249. pass
  1250. @abstractmethod
  1251. def create(self, gateway):
  1252. """
  1253. Allocate a new floating (i.e., static) IP address.
  1254. :type gateway: ``Gateway``
  1255. :param gateway: The gateway to which the Floating IP should be attached
  1256. :rtype: ``object`` of :class:`.FloatingIP`
  1257. :return: A FloatingIP object
  1258. """
  1259. pass
  1260. @abstractmethod
  1261. def delete(self, gateway, fip):
  1262. """
  1263. Delete an existing FloatingIP.
  1264. :type gateway: ``Gateway``
  1265. :param gateway: The gateway to which the Floating IP is attached
  1266. :type fip: ``str``
  1267. :param fip: The FloatingIP to be deleted.
  1268. """
  1269. pass