File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
samples/data_processing/cluster Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ require 'vendor/autoload.php ' ;
4
+
5
+ use OpenStack \OpenStack ;
6
+
7
+ $ openstack = new OpenStack ([
8
+ 'authUrl ' => '{authUrl} ' ,
9
+ 'user ' => [
10
+ 'name ' => '{userName} ' ,
11
+ 'password ' => '{password} ' ,
12
+ 'domain ' => ['name ' => '{userDomain} ' ],
13
+ ],
14
+ 'scope ' => [
15
+ 'project ' => [
16
+ 'name ' => '{projectName} ' ,
17
+ 'domain ' => ['name ' => '{projectDomain} ' ],
18
+ ],
19
+ ],
20
+ ]);
21
+
22
+ $ sahara = $ openstack ->dataProcessingV1 (['region ' => '{region} ' ]);
23
+
24
+ $ options = [
25
+ 'pluginName ' => '{pluginName} ' ,
26
+ 'hadoopVersion ' => '{hadoopVersion} ' ,
27
+ 'clusterTemplateId ' => '{clusterTemplateId} ' ,
28
+ 'defaultImageId ' => '{defaultImageId} ' ,
29
+ //user keypair id is optional
30
+ 'userKeypairId ' => '{userKeypairId} ' ,
31
+ 'name ' => '{name} ' ,
32
+ 'neutronManagementNetwork ' => '{neutronManagementNetworkId} ' ,
33
+ 'count ' => '{count} ' ,
34
+ //optional
35
+ 'clusterConfigs ' => ['foo ' => 'bar ' ],
36
+ ];
37
+
38
+ $ clusters = $ sahara ->createCluster ($ options );
39
+ foreach ($ clusters as $ cluster ) {
40
+ print_r ($ cluster );
41
+ }
You can’t perform that action at this time.
0 commit comments