-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Sahara data processing support #157
base: master
Are you sure you want to change the base?
Changes from all commits
b86acf2
610bae9
bd2a9a5
77c025c
3733cca
77ac624
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$options = [ | ||
'pluginName' => '{pluginName}', | ||
'hadoopVersion' => '{hadoopVersion}', | ||
'clusterTemplateId' => '{clusterTemplateId}', | ||
'defaultImageId' => '{defaultImageId}', | ||
//user keypair id is optional | ||
'userKeypairId' => '{userKeypairId}', | ||
'name' => '{name}', | ||
'neutronManagementNetwork' => '{neutronManagementNetworkId}', | ||
]; | ||
|
||
$cluster = $sahara->createCluster($options); | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$options = [ | ||
'pluginName' => '{pluginName}', | ||
'hadoopVersion' => '{hadoopVersion}', | ||
'clusterTemplateId' => '{clusterTemplateId}', | ||
'defaultImageId' => '{defaultImageId}', | ||
//user keypair id is optional | ||
'userKeypairId' => '{userKeypairId}', | ||
'name' => '{name}', | ||
'neutronManagementNetwork' => '{neutronManagementNetworkId}', | ||
'count' => '{count}', | ||
//optional | ||
'clusterConfigs' => ['foo' => 'bar'], | ||
]; | ||
|
||
$clusters = $sahara->createCluster($options); | ||
foreach ($clusters as $cluster) { | ||
print_r($cluster); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hint |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$cluster = $sahara->getCluster(['id' => '{clusterId}']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hint |
||
$cluster->delete(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$cluster = $sahara->getCluster(['id' => '{clusterId}']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hint |
||
$cluster->retrieve(); | ||
print_r($cluster); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$options = [ | ||
'limit' => '{limit}', | ||
'marker' => '{marker}', | ||
'sortKey' => '{sortKey}' | ||
]; | ||
|
||
$clusters = $sahara->listClusters($options); | ||
foreach ($clusters as $cluster) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hint to |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$options = [ | ||
'id' => '{clusterId}', | ||
'addNodeGroups' => [[ | ||
'count' => '{count}', | ||
'name' => '{name}', | ||
'nodeGroupTemplateId' => '{nodeGroupTemplateId}', | ||
]], | ||
'resizeNodeGroups' => [[ | ||
'count' => '{count}', | ||
'name' => '{name}', | ||
]], | ||
]; | ||
|
||
$cluster = $sahara->scaleCluster($options); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$cluster = $sahara->getCluster(['id' => '{clusterId}']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hint |
||
$cluster->name = '{newName}'; | ||
$cluster->isPublic = '{trueOrFalse}'; | ||
$cluster->isProtected = '{trueOrFalse}'; | ||
$cluster->update(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
$options = [ | ||
'pluginName' => '{pluginName}', | ||
'hadoopVersion' => '{hadoopVersion}', | ||
'nodeGroups' => [[ | ||
'name' => '{nodeGroupName}', | ||
'count' => '{count}', | ||
'nodeGroupTemplateId' => '{nodeGroupTemplateId}', | ||
], | ||
[ | ||
'name' => '{nodeGroupName}', | ||
'count' => '{count}', | ||
'nodeGroupTemplateId' => '{nodeGroupTemplateId}', | ||
], | ||
[ | ||
'name' => '{NodeGroupname}', | ||
'count' => '{count}', | ||
'nodeGroupTemplateId' => '{nodeGroupTemplateId}', | ||
], | ||
], | ||
'name' => '{ClusterTemplateName}', | ||
]; | ||
|
||
$clusterTemplate = $sahara->createClusterTemplate($options); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hint |
||
print_r($clusterTemplate); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$cluster = $sahara->getClusterTemplate(['id' => '{clusterTemplateId}']); | ||
$cluster->delete(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$clusterTemplate = $sahara->getClusterTemplate(['id' => '{clusterTemplateId}']); | ||
$clusterTemplate->retrieve(); | ||
print_r($clusterTemplate); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$options = [ | ||
'limit' => '{limit}', | ||
'sortBy' => '{sortBy}', | ||
]; | ||
|
||
$clusterTemplates = $sahara->listClusterTemplates($options); | ||
foreach ($clusterTemplates as $clusterTemplate) { | ||
print_r($clusterTemplate); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use OpenStack\OpenStack; | ||
|
||
$openstack = new OpenStack([ | ||
'authUrl' => '{authUrl}', | ||
'user' => [ | ||
'name' => '{userName}', | ||
'password' => '{password}', | ||
'domain' => ['name' => '{userDomain}'], | ||
], | ||
'scope' => [ | ||
'project' => [ | ||
'name' => '{projectName}', | ||
'domain' => ['name' => '{projectDomain}'], | ||
], | ||
], | ||
]); | ||
|
||
$sahara = $openstack->dataProcessingV1(['region' => '{region}']); | ||
|
||
$clusterTemplate = $sahara->getClusterTemplate(['id' => '{clusterTemplateId}']); | ||
$clusterTemplate->name = '{newName}'; | ||
$clusterTemplate->isPublic = '{trueOrFalse}'; | ||
$clusterTemplate->pluginName = '{newPluginName}'; | ||
$clusterTemplate->hadoopVersion = '{newHadoopVersion}'; | ||
$clusterTemplate->update(); | ||
print_r($clusterTemplate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add type hint to
$cluster
e.g.
/**@var OpenStack\DataProcessing\v1\Models\Cluster $cluster */