-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
456 update of the dds instance (#476)
456 update of the dds instance Reviewed-by: Anton Sidelnikov
- Loading branch information
1 parent
9039868
commit b52a872
Showing
21 changed files
with
1,288 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ DDS v3 | |
v3/datastore | ||
v3/flavor | ||
v3/instance | ||
v3/eip | ||
v3/job | ||
v3/recycle_instance | ||
v3/recycle_policy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
otcextensions.sdk.dds.v3.eip | ||
================================ | ||
|
||
.. automodule:: otcextensions.sdk.dds.v3.eip | ||
|
||
The Eip Class | ||
------------------- | ||
|
||
The ``Eip`` class inherits from | ||
:class:`~otcextensions.sdk.sdk_resource.Resource`. | ||
|
||
.. autoclass:: otcextensions.sdk.dds.v3.eip.Eip | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
otcextensions.sdk.dds.v3.job | ||
================================ | ||
|
||
.. automodule:: otcextensions.sdk.dds.v3.job | ||
|
||
The Job Class | ||
------------------- | ||
|
||
The ``Job`` class inherits from | ||
:class:`~otcextensions.sdk.sdk_resource.Resource`. | ||
|
||
.. autoclass:: otcextensions.sdk.dds.v3.job.Job | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
otcextensions.sdk.dds.v3.recycle_instance | ||
========================================== | ||
|
||
.. automodule:: otcextensions.sdk.dds.v3.recycle_instance | ||
|
||
The RecycleInstance Class | ||
---------------------------- | ||
|
||
The ``RecycleInstance`` class inherits from | ||
:class:`~otcextensions.sdk.sdk_resource.Resource`. | ||
|
||
.. autoclass:: otcextensions.sdk.dds.v3.recycle_instance.RecycleInstance | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
otcextensions.sdk.dds.v3.recycle_policy | ||
========================================== | ||
|
||
.. automodule:: otcextensions.sdk.dds.v3.recycle_policy | ||
|
||
The RecyclePolicy Class | ||
---------------------------- | ||
|
||
The ``RecyclePolicy`` class inherits from | ||
:class:`~otcextensions.sdk.sdk_resource.Resource`. | ||
|
||
.. autoclass:: otcextensions.sdk.dds.v3.recycle_policy.RecyclePolicy | ||
:members: |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env python3 | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
""" | ||
Create instance | ||
""" | ||
import openstack | ||
from otcextensions import sdk | ||
|
||
openstack.enable_logging(True) | ||
conn = openstack.connect(cloud='otc') | ||
sdk.register_otc_extensions(conn) | ||
|
||
datastore = { | ||
'type': 'DDS-Community', | ||
'version': '3.4', | ||
'storage_engine': 'wiredTiger' | ||
} | ||
region = 'eu-de' | ||
availability_zone = 'eu-de-01' | ||
vpc_id = 'vpc-1' | ||
subnet_id = 'subnet-1' | ||
security_group_id = 'sg-1' | ||
password = 'Test@123!' | ||
mode = 'Sharding' | ||
flavor = [ | ||
{ | ||
"type": "mongos", | ||
"num": 2, | ||
"spec_code": "dds.mongodb.s2.medium.4.mongos" | ||
}, | ||
{ | ||
"type": "shard", | ||
"num": 2, | ||
"storage": "ULTRAHIGH", | ||
"size": 20, | ||
"spec_code": "dds.mongodb.s2.medium.4.shard" | ||
}, | ||
{ | ||
"type": "config", | ||
"num": 1, | ||
"storage": "ULTRAHIGH", | ||
"size": 20, | ||
"spec_code": "dds.mongodb.s2.large.2.config" | ||
} | ||
] | ||
backup_strategy = { | ||
'start_time': '23:00-00:00', | ||
'keep_days': '8' | ||
} | ||
instance = conn.dds.create_instance(name='test-dds', | ||
datastore=datastore, | ||
region=region, | ||
availability_zone=availability_zone, | ||
vpc_id=vpc_id, | ||
subnet_id=subnet_id, | ||
security_group_id=security_group_id, | ||
password=password, | ||
mode=mode, | ||
flavor=flavor, | ||
backup_strategy=backup_strategy) | ||
print(instance) |
Oops, something went wrong.