Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Diego Lima
/
aws-price-parser
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fa6bf9ca
authored
May 15, 2018
by
Diego Lima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adicionar suporte a licenciamento de SO
1 parent
74c0691f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
aws_parser.py
azure_parser.py
gce_parser.py
aws_parser.py
View file @
fa6bf9c
...
@@ -50,10 +50,12 @@ with open(FCATALOG) as url:
...
@@ -50,10 +50,12 @@ with open(FCATALOG) as url:
if
key
:
if
key
:
cost
=
key
[
sku
+
'.'
+
TERM_ONDEMAND
][
'priceDimensions'
][
sku
+
'.'
+
TERM_ONDEMAND
+
'.'
+
HOURLY_DIMENSION
][
'pricePerUnit'
][
'USD'
]
cost
=
key
[
sku
+
'.'
+
TERM_ONDEMAND
][
'priceDimensions'
][
sku
+
'.'
+
TERM_ONDEMAND
+
'.'
+
HOURLY_DIMENSION
][
'pricePerUnit'
][
'USD'
]
if
cost
!=
'0.0000000000'
:
if
cost
!=
'0.0000000000'
:
name
=
DATA
[
'products'
][
product
][
'attributes'
][
'instanceType'
]
name
=
DATA
[
'products'
][
product
][
'attributes'
][
'instanceType'
]
region
=
locationmap
(
DATA
[
'products'
][
product
][
'attributes'
][
'location'
])
region
=
locationmap
(
DATA
[
'products'
][
product
][
'attributes'
][
'location'
])
cpu
=
DATA
[
'products'
][
product
][
'attributes'
][
'vcpu'
]
cpu
=
DATA
[
'products'
][
product
][
'attributes'
][
'vcpu'
]
memory
=
str
(
DATA
[
'products'
][
product
][
'attributes'
][
'memory'
])
.
replace
(
','
,
''
)
memory
=
str
(
DATA
[
'products'
][
product
][
'attributes'
][
'memory'
])
.
replace
(
','
,
''
)
license
=
DATA
[
'products'
][
product
][
'attributes'
][
'licenseModel'
]
software
=
DATA
[
'products'
][
product
][
'attributes'
][
'preInstalledSw'
]
if
PRODUCT_TYPE
==
'compute'
:
if
PRODUCT_TYPE
==
'compute'
:
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'operatingSystem'
]
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'operatingSystem'
]
family
=
str
(
name
[:
1
])
family
=
str
(
name
[:
1
])
...
@@ -62,7 +64,7 @@ with open(FCATALOG) as url:
...
@@ -62,7 +64,7 @@ with open(FCATALOG) as url:
else
:
else
:
sharedcores
=
'nonshared'
sharedcores
=
'nonshared'
if
DATA
[
'products'
][
product
][
'attributes'
][
'tenancy'
]
==
'Shared'
:
if
DATA
[
'products'
][
product
][
'attributes'
][
'tenancy'
]
==
'Shared'
:
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
sharedcores
,
sku
))
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
,
%
s,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
sharedcores
,
sku
,
license
,
software
))
elif
PRODUCT_TYPE
==
'database'
:
elif
PRODUCT_TYPE
==
'database'
:
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'databaseEngine'
]
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'databaseEngine'
]
edition
=
DATA
[
'products'
][
product
][
'attributes'
]
.
get
(
'databaseEdition'
)
edition
=
DATA
[
'products'
][
product
][
'attributes'
]
.
get
(
'databaseEdition'
)
...
...
azure_parser.py
View file @
fa6bf9c
...
@@ -46,8 +46,11 @@ with urllib.request.urlopen(CATALOG) as url:
...
@@ -46,8 +46,11 @@ with urllib.request.urlopen(CATALOG) as url:
cores
=
prod
[
"cores"
]
cores
=
prod
[
"cores"
]
memory
=
str
(
prod
[
"ram"
])
+
" GB"
memory
=
str
(
prod
[
"ram"
])
+
" GB"
sharedcores
=
'shared'
if
name
[:
1
]
==
'b'
else
'nonshared'
sharedcores
=
'shared'
if
name
[:
1
]
==
'b'
else
'nonshared'
sku
=
''
license
=
'No License required'
software
=
'NA'
for
region
in
REGIONS
:
for
region
in
REGIONS
:
cost
=
prod
[
"prices"
]
.
get
(
region
)
cost
=
prod
[
"prices"
]
.
get
(
region
)
if
cost
:
if
cost
:
cost
=
cost
[
'value'
]
cost
=
cost
[
'value'
]
print
(
"azure,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s"
%
(
name
,
cores
,
memory
,
cost
,
region
,
os
,
sharedcores
))
print
(
"azure,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s"
%
(
name
,
cores
,
memory
,
cost
,
region
,
os
,
sharedcores
,
sku
,
license
,
software
))
gce_parser.py
View file @
fa6bf9c
...
@@ -95,7 +95,10 @@ with open(FCATALOG) as url:
...
@@ -95,7 +95,10 @@ with open(FCATALOG) as url:
else
:
else
:
sharedcores
=
'nonshared'
sharedcores
=
'nonshared'
realcpu
=
cpu
realcpu
=
cpu
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
name
,
realcpu
,
memory
,
cost
,
region
,
os
,
sharedcores
))
sku
=
''
license
=
'No License required'
software
=
'NA'
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
name
,
realcpu
,
memory
,
cost
,
region
,
os
,
sharedcores
,
sku
,
license
,
software
))
else
:
else
:
realname
=
realname
.
replace
(
'pg-'
,
''
)
realname
=
realname
.
replace
(
'pg-'
,
''
)
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
realname
,
cpu
,
memory
,
cost
,
region
,
os
))
print
(
'google,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s'
%
(
realname
,
cpu
,
memory
,
cost
,
region
,
os
))
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment