Просмотр исходного кода

Fix typo; add simple usage examples

Enis Afgan 10 лет назад
Родитель
Сommit
3ed9ba6c2b
2 измененных файлов с 13 добавлено и 2 удалено
  1. 1 1
      cloudbridge/cloud/base.py
  2. 12 1
      cloudbridge/cloud/interfaces/resources.py

+ 1 - 1
cloudbridge/cloud/base.py

@@ -246,7 +246,7 @@ class BaseLaunchConfig(LaunchConfig):
             is_volume=True, source=source, is_root=is_root, size=size,
             is_volume=True, source=source, is_root=is_root, size=size,
             delete_on_terminate=delete_on_terminate)
             delete_on_terminate=delete_on_terminate)
 
 
-    def add_network_iterface(self, net_id):
+    def add_network_interface(self, net_id):
         self.net_ids.append(net_id)
         self.net_ids.append(net_id)
 
 
 
 

+ 12 - 1
cloudbridge/cloud/interfaces/resources.py

@@ -391,10 +391,21 @@ class LaunchConfig(object):
         pass
         pass
 
 
     @abstractmethod
     @abstractmethod
-    def add_network_iterface(self, net_id):
+    def add_network_interface(self, net_id):
         """
         """
         Add a private network info to the launch configuration.
         Add a private network info to the launch configuration.
 
 
+        Examples:
+        ```
+        lc = provider.compute.instances.create_launch_config()
+
+        # 1. Add a VPC subnet for use with AWS
+        lc.add_network_interface('subnet-c24aeaff')
+
+        # 2. Add a network ID for use with OpenStack
+        lc.add_network_interface('5820c766-75fe-4fc6-96ef-798f67623238')
+        ```
+
         :type net_id: str
         :type net_id: str
         :param net_id: Network ID to launch an instance into. This is a
         :param net_id: Network ID to launch an instance into. This is a
                        preliminary implementation (pending full private cloud
                        preliminary implementation (pending full private cloud