Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_08_resize_a_cluster(self):
output = self.a.Clusters.modify_cluster_instance_size(cluster=self.TEST_CLUSTER3_NAME_UNIQUE,
new_cluster_size=InstanceSizeName.M20)
def test_04_create_basic_cluster(self):
myoutput = self.a.Clusters.create_basic_rs(name=self.TEST_CLUSTER2_NAME_UNIQUE, version=mdb_version.v4_2,
size=InstanceSizeName.M10)
self.assertEqual(type(myoutput), AtlasBasicReplicaSet)
pprint(myoutput.config.as_dict())
print('-------------------Waiting a bit to allow the cluster to be created......-------------')
sleep(30)
print('-----------------------------------Done Sleeping -------------------------------------')
:param size: Name of the cluster tier used for the Atlas cluster.
:param provider: Cloud service provider on which the servers are provisioned.
:param region: Physical location of your MongoDB cluster. The region you choose can affect network latency for
clients accessing your databases.
:param autoScaling: Contains the compute field which specifies the range of instance sizes to which your cluster
can scale.
:param diskIOPS: Maximum input/output operations per second (IOPS) the system can perform.
:param encryptEBSVolume: AWS only. If enabled, the Amazon EBS encryption feature encrypts the server’s root
volume for both data at rest within the volume and for data moving between the volume and the cluster.
:param volumeType: The type of AWS volume.
"""
self.volumeType = volumeType
self.encryptEBSVolume = encryptEBSVolume
self.diskIOPS = diskIOPS
self.autoScaling = autoScaling
self.instance_size_name: InstanceSizeName = size
self.provider_name: ProviderName = provider
self.region_name: str = region
def __init__(self, name: str,
size: InstanceSizeName = InstanceSizeName.M10,
disk_size: int = 10,
provider: ProviderName = ProviderName.AWS,
region: str = 'US_WEST_2',
version: MongoDBMajorVersion = MongoDBMajorVersion.v4_0,
) -> None:
provider_settings = ProviderSettings(size=size,
provider=provider, region=region)
regions_config = RegionConfig()
replication_specs = ReplicationSpecs(regions_config={region: regions_config.__dict__})
self.config: ClusterConfig = ClusterConfig(disk_size_gb=disk_size,
name=name,
mongodb_major_version=version,
providerSettings=provider_settings,
replication_specs=replication_specs)
def create_basic_rs(self, name: str,
size: InstanceSizeName = InstanceSizeName.M10,
disk_size: int = 10,
provider: ProviderName = ProviderName.AWS,
region: str = 'US_WEST_2',
version: MongoDBMajorVersion = MongoDBMajorVersion.v4_0) -> AtlasBasicReplicaSet:
"""
Simplified method for creating a basic replica set with basic options.
:param name: The name for the cluster
:param size: The Atlas Instance size, found in The InstanceSizeName enum
:param disk_size: The size in GB for disk
:param provider: The cloud provider, found in ProviderName enum
:param region: The provider region to place the cluster.
:param version: The mongodb major version (enum)
:return: AtlasBasicReplicaSet
"""
cluster: AtlasBasicReplicaSet = AtlasBasicReplicaSet(name=name, size=size, disk_size=disk_size,