Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
libocci
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
330deb56
authored
Apr 25, 2017
by
Fukász Rómeó Ervin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added functions to get all computes (or their ids) a user has access to
parent
b872ee23
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
0 deletions
+46
-0
Makefile
+17
-0
compute.cpp
+22
-0
compute.h
+6
-0
occilib.i
+1
-0
No files found.
Makefile
View file @
330deb56
# Copyright 2017 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
CPP
=
g++
CC
=
gcc
AR
=
ar
...
...
compute.cpp
View file @
330deb56
...
...
@@ -16,6 +16,7 @@
// with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
#include <string>
#include <vector>
#include <memory>
#include "json.hpp"
#include "resource.h"
...
...
@@ -24,6 +25,7 @@
#include "compute.h"
using
std
::
string
;
using
std
::
vector
;
using
nlohmann
::
json
;
using
std
::
shared_ptr
;
using
std
::
make_shared
;
...
...
@@ -72,6 +74,26 @@ shared_ptr<Compute> Compute::createComputeInstance(OcciSession* session, Templat
return
make_shared
<
Compute
>
(
Compute
(
session
,
instance
));
}
vector
<
shared_ptr
<
Compute
>>
Compute
::
getComputeInstances
(
OcciSession
*
session
){
auto
result
=
vector
<
shared_ptr
<
Compute
>>
();
auto
data
=
session
->
get
(
"compute/"
);
for
(
auto
&
computeRendering
:
data
[
"resources"
])
{
auto
computeInstance
=
make_shared
<
Compute
>
(
Compute
(
session
,
computeRendering
));
result
.
push_back
(
computeInstance
);
}
return
result
;
}
vector
<
string
>
Compute
::
getComputeInstanceIds
(
OcciSession
*
session
){
auto
computes
=
getComputeInstances
(
session
);
auto
ids
=
vector
<
string
>
();
for
(
auto
&
compute
:
computes
)
{
ids
.
push_back
(
compute
->
getId
());
}
return
ids
;
}
string
Compute
::
getState
(){
return
this
->
state
;
}
...
...
compute.h
View file @
330deb56
...
...
@@ -19,6 +19,8 @@
#define OCCILIB_COMPUTE_H_
#include <string>
#include <vector>
#include <memory>
#include "json.hpp"
#include "resource.h"
...
...
@@ -58,6 +60,10 @@ namespace OcciClient {
static
std
::
shared_ptr
<
Compute
>
createComputeInstance
(
OcciSession
*
session
,
Template
t
);
static
std
::
vector
<
std
::
shared_ptr
<
Compute
>>
getComputeInstances
(
OcciSession
*
session
);
static
std
::
vector
<
std
::
string
>
getComputeInstanceIds
(
OcciSession
*
session
);
std
::
string
getState
();
std
::
string
getStateMessage
();
...
...
occilib.i
View file @
330deb56
...
...
@@ -36,4 +36,5 @@
namespace std {
%template(TemplateVector) vector<Template>;
%template(ComputeInstanceVector) vector<shared_ptr<OcciClient::Compute>>;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment