Skip to content

Commit 8637092

Browse files
committed
initial commit
0 parents  commit 8637092

40 files changed

+2545
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
/vendor

Examples/OSSnapshotsTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Compute\Snapshot;
6+
7+
require 'setAccountTest.php';
8+
9+
10+
$snapshotClient = new Snapshot(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
11+
12+
//list of all virtual servers under JP East 1 Region
13+
echo $snapshotClient->getSnapshots('jp-east-1');

Examples/authTokensTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
require 'setAccountTest.php';
6+
7+
8+
$tokenClient = new Auth(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false); //set last parameter to TRUE for a global token instead
9+
10+
//get the authentication token information
11+
$authInfo = $tokenClient->getAuthToken();
12+
13+
//token used for making each API call
14+
echo $authInfo['token'];
15+
16+
// your project(tenant) id
17+
echo $authInfo['project_id'];
18+
19+
// your domain id
20+
echo $authInfo['domain_id'];

Examples/firewallsTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Networking\Firewall;
6+
7+
require 'setAccountTest.php';
8+
9+
10+
$fwClient = new Firewall(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
11+
12+
13+
//list of all firewalls under JP East 1 Region
14+
echo $fwClient->getFirewalls('jp-east-1');
15+
16+
17+
//get firewall policies
18+
echo $fwClient->getFirewallPolicies('jp-east-1');
19+
20+
21+
//get firewall rules
22+
echo $fwClient->getFirewallRules('jp-east-1');

Examples/imagesTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Image\Image;
6+
7+
require 'setAccountTest.php';
8+
9+
10+
$imageClient = new Image(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
11+
12+
//list of all images under JP East 1 Region
13+
echo $imageClient->getImages('jp-east-1');

Examples/k5_hot.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
heat_template_version: 2013-05-23
2+
3+
description: >
4+
Hello world HOT template that just defines a single server.
5+
Contains just base features to verify base HOT support.
6+
7+
parameters:
8+
key_name:
9+
type: string
10+
description: Name of an existing key pair to use for the server
11+
default: haruka_keypair
12+
flavor:
13+
type: string
14+
description: Flavor for the server to be created
15+
default: S-1
16+
image:
17+
type: string
18+
description: Image ID or image name to use for the server
19+
default: 58fd966f-b055-4cd0-9012-cf6af7a4c32b
20+
az:
21+
type: string
22+
description: the availability zone
23+
default: jp-east-1a
24+
network:
25+
type: string
26+
description: network uuid
27+
default: c3b7914e-8320-4c85-89fa-dac343c7d321
28+
vm_name:
29+
type: string
30+
description: name of vm
31+
default: mo-stack-machine0905
32+
sg_name:
33+
type: string
34+
description: security group
35+
default: 2e8dfe2d-2531-498e-8743-e97f5a9a7c11
36+
37+
resources:
38+
sys-vol:
39+
type: OS::Cinder::Volume
40+
properties:
41+
name: ""
42+
size: 30
43+
volume_type: "M1"
44+
availability_zone: { get_param: az }
45+
image: { get_param: image }
46+
server:
47+
type: OS::Nova::Server
48+
properties:
49+
key_name: { get_param: key_name }
50+
flavor: { get_param: flavor }
51+
image: { get_param: image }
52+
networks: ["uuid": {get_param: network} ]
53+
name: { get_param: vm_name }
54+
security_groups: [{ get_param: sg_name }]
55+
block_device_mapping: [{"volume_size": "80", "volume_id": {get_resource: sys-vol}, "delete_on_termination": True, "device_name": "/dev/vda"}]
56+
57+
outputs:
58+
server_networks:
59+
description: The networks of the deployed server
60+
value: { get_attr: [server, networks] }

Examples/listGroupsTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Identity\Group;
6+
7+
require 'setAccountTest.php';
8+
9+
$groupClient = new Group(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
10+
11+
//list of all groups
12+
echo $groupClient->getGroups();
13+
14+
15+
//create a group
16+
//THIS WILL ACTUALLY CREATE A NEW GROUP ON YOUR ACCOUNT
17+
die();
18+
echo $groupClient->createGroup(
19+
'test-Group01', //project name
20+
'description-Group-01' //project description
21+
);

Examples/networksTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Networking\Network;
6+
7+
require 'setAccountTest.php';
8+
9+
10+
$networkClient = new Network(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
11+
12+
13+
//list of all networks under JP East 1 Region
14+
echo $networkClient->getNetworks('jp-east-1');
15+
16+
//Get details of a specific network
17+
//Replace '53bdc6d8-fff8-46e2-b88e-bd9adb633609' with your own network id
18+
echo $networkClient->getNetworksDetail('jp-east-1', '53bdc6d8-fff8-46e2-b88e-bd9adb633609');

Examples/portsTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Networking\Port;
6+
7+
require 'setAccountTest.php';
8+
9+
$portClient = new Port(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
10+
11+
//list of all groups
12+
echo $portClient->getPorts('jp-east-1');
13+
14+
15+
//create a port (a.k.a network interface)
16+
$data = array(
17+
'port'=>array(
18+
'name' => 'my-test-port',
19+
'network_id' => '', //network to be linked
20+
'fixed_ips' => array (
21+
array(
22+
'subnet_id' => '', //subnet to be linked
23+
'ip_address' => '' //ip to be assigned
24+
)
25+
),
26+
'availability_zone' => '' //jp-east-1a, etc.
27+
)
28+
);
29+
$data = json_encode($data, JSON_HEX_QUOT);
30+
die();
31+
$portClient->createPort('jp-east-1',$data);

Examples/projectsTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use K5\Identity\Project;
6+
7+
require 'setAccountTest.php';
8+
9+
$projectClient = new Project(K5_USERNAME,K5_PASSWORD,K5_CONTRACT,false);
10+
11+
12+
13+
//list of all projects
14+
echo $projectClient->getProjects();
15+
16+
//create a project
17+
//THIS WILL ACTUALLY CREATE A NEW PROJECT ON YOUR ACCOUNT!
18+
die;
19+
echo $projectClient->createProject(
20+
'test-Project01', //project name
21+
'description-Project-01' //project description
22+
);

0 commit comments

Comments
 (0)