@@ -16,14 +16,14 @@ class OpenStack
1616 private $ builder ;
1717
1818 /**
19- * @param array $options Supported options:
19+ * @param array $options User-defined options
2020 *
21- * username (string) Your OpenStack username [REQUIRED]
22- * password (string) Your OpenStack password [REQUIRED]
23- * tenantId (string) Your tenant ID [either tenantId or tenantName must be required ]
24- * tenantName (string) Your tenant name [either tenantId or tenantName must be required ]
25- * authUrl (string) The Keystone URL [REQUIRED]
26- * debug (bool) Whether to enable HTTP logging [OPTIONAL]
21+ * $options[' username'] = (string) Your OpenStack username [REQUIRED]
22+ * [' password'] = (string) Your OpenStack password [REQUIRED]
23+ * [' tenantId'] = (string) Your tenant ID [REQUIRED if tenantName omitted ]
24+ * [' tenantName'] = (string) Your tenant name [REQUIRED if tenantId omitted ]
25+ * [' authUrl'] = (string) The Keystone URL [REQUIRED]
26+ * [' debug'] = (bool) Whether to enable HTTP logging [OPTIONAL]
2727 */
2828 public function __construct (array $ options = [], Builder $ builder = null )
2929 {
@@ -39,10 +39,8 @@ public function __construct(array $options = [], Builder $builder = null)
3939 */
4040 public function computeV2 (array $ options = [])
4141 {
42- return $ this ->builder ->createService ('Compute ' , 2 , array_merge ($ options , [
43- 'catalogName ' => 'nova ' ,
44- 'catalogType ' => 'compute '
45- ]));
42+ $ defaults = ['catalogName ' => 'nova ' , 'catalogType ' => 'compute ' ];
43+ return $ this ->builder ->createService ('Compute ' , 2 , array_merge ($ defaults , $ options ));
4644 }
4745
4846 /**
@@ -54,10 +52,8 @@ public function computeV2(array $options = [])
5452 */
5553 public function networkingV2 (array $ options = [])
5654 {
57- return $ this ->builder ->createService ('Networking ' , 2 , array_merge ($ options , [
58- 'catalogName ' => 'neutron ' ,
59- 'catalogType ' => 'network '
60- ]));
55+ $ defaults = ['catalogName ' => 'neutron ' , 'catalogType ' => 'network ' ];
56+ return $ this ->builder ->createService ('Networking ' , 2 , array_merge ($ defaults , $ options ));
6157 }
6258
6359 /**
@@ -69,10 +65,8 @@ public function networkingV2(array $options = [])
6965 */
7066 public function identityV2 (array $ options = [])
7167 {
72- return $ this ->builder ->createService ('Identity ' , 2 , array_merge ($ options , [
73- 'catalogName ' => false ,
74- 'catalogType ' => false ,
75- ]));
68+ $ defaults = ['catalogName ' => false , 'catalogType ' => false ];
69+ return $ this ->builder ->createService ('Identity ' , 2 , array_merge ($ defaults , $ options ));
7670 }
7771
7872 /**
@@ -84,10 +78,8 @@ public function identityV2(array $options = [])
8478 */
8579 public function identityV3 (array $ options = [])
8680 {
87- return $ this ->builder ->createService ('Identity ' , 3 , array_merge ($ options , [
88- 'catalogName ' => false ,
89- 'catalogType ' => false ,
90- ]));
81+ $ defaults = ['catalogName ' => false , 'catalogType ' => false ];
82+ return $ this ->builder ->createService ('Identity ' , 3 , array_merge ($ defaults , $ options ));
9183 }
9284
9385 /**
@@ -99,9 +91,20 @@ public function identityV3(array $options = [])
9991 */
10092 public function objectStoreV1 (array $ options = [])
10193 {
102- return $ this ->builder ->createService ('ObjectStore ' , 1 , array_merge ($ options , [
103- 'catalogName ' => 'swift ' ,
104- 'catalogType ' => 'object-store ' ,
105- ]));
94+ $ defaults = ['catalogName ' => 'swift ' , 'catalogType ' => 'object-store ' ];
95+ return $ this ->builder ->createService ('ObjectStore ' , 1 , array_merge ($ defaults , $ options ));
96+ }
97+
98+ /**
99+ * Creates a new Block Storage v2 service.
100+ *
101+ * @param array $options Options that will be used in configuring the service.
102+ *
103+ * @return \OpenStack\BlockStorage\v2\Service
104+ */
105+ public function blockStorageV2 (array $ options = [])
106+ {
107+ $ defaults = ['catalogName ' => 'cinderv2 ' , 'catalogType ' => 'volumev2 ' ];
108+ return $ this ->builder ->createService ('BlockStorage ' , 2 , array_merge ($ defaults , $ options ));
106109 }
107110}
0 commit comments