Skip to content

Commit

Permalink
456 update of the dds instance (#476)
Browse files Browse the repository at this point in the history
456 update of the dds instance

Reviewed-by: Anton Sidelnikov
  • Loading branch information
RusselSand authored Oct 17, 2024
1 parent 9039868 commit b52a872
Show file tree
Hide file tree
Showing 21 changed files with 1,288 additions and 56 deletions.
37 changes: 36 additions & 1 deletion doc/source/sdk/proxies/dds_v3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,39 @@ Instance Operations
.. autoclass:: otcextensions.sdk.dds.v3._proxy.Proxy
:noindex:
:members: create_instance, delete_instance, get_instance,
find_instance, instances
find_instance, instances, restart_instance,
enlarge_instance, add_instance_nodes, resize_instance,
switchover_instance, enable_instance_ssl,
change_instance_name, change_instance_port,
change_instance_security_group,
change_instance_private_ip, create_instance_ip,
configure_client_network, wait_normal_instance

Job Operations
^^^^^^^^^^^^^^^^

.. autoclass:: otcextensions.sdk.dds.v3._proxy.Proxy
:noindex:
:members: get_job, wait_job


Eip Operations
^^^^^^^^^^^^^^^

.. autoclass:: otcextensions.sdk.dds.v3._proxy.Proxy
:noindex:
:members: bind_eip, unbind_eip

Recycle Bin Policy Operations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: otcextensions.sdk.dds.v3._proxy.Proxy
:noindex:
:members: get_policy, create_policy

Recycle Instances Operations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: otcextensions.sdk.dds.v3._proxy.Proxy
:noindex:
:members: recycle_instances
4 changes: 4 additions & 0 deletions doc/source/sdk/resources/dds/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ DDS v3
v3/datastore
v3/flavor
v3/instance
v3/eip
v3/job
v3/recycle_instance
v3/recycle_policy
13 changes: 13 additions & 0 deletions doc/source/sdk/resources/dds/v3/eip.rst
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:
13 changes: 13 additions & 0 deletions doc/source/sdk/resources/dds/v3/job.rst
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:
13 changes: 13 additions & 0 deletions doc/source/sdk/resources/dds/v3/recycle_instance.rst
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:
13 changes: 13 additions & 0 deletions doc/source/sdk/resources/dds/v3/recycle_policy.rst
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 added examples/dds/__init__.py
Empty file.
71 changes: 71 additions & 0 deletions examples/dds/create_instance.py
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)
Loading

0 comments on commit b52a872

Please sign in to comment.