diff --git a/scaleway-async/scaleway_async/mongodb/v1alpha1/api.py b/scaleway-async/scaleway_async/mongodb/v1alpha1/api.py index e81ca3884..9667d1fc9 100644 --- a/scaleway-async/scaleway_async/mongodb/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/mongodb/v1alpha1/api.py @@ -12,6 +12,7 @@ ) from scaleway_core.utils import ( WaitForOptions, + random_name, validate_path_param, fetch_all_pages_async, wait_for_resource_async, @@ -391,7 +392,6 @@ async def wait_for_instance( async def create_instance( self, *, - name: str, version: str, node_number: int, node_type: str, @@ -399,6 +399,7 @@ async def create_instance( password: str, region: Optional[Region] = None, project_id: Optional[str] = None, + name: Optional[str] = None, tags: Optional[List[str]] = None, volume: Optional[CreateInstanceRequestVolumeDetails] = None, endpoints: Optional[List[EndpointSpec]] = None, @@ -406,7 +407,6 @@ async def create_instance( """ Create a MongoDB™ Database Instance. Create a new MongoDB™ Database Instance. - :param name: Name of the Database Instance. :param version: Version of the MongoDB™ engine. :param node_number: Number of node to use for the Database Instance. :param node_type: Type of node to use for the Database Instance. @@ -414,6 +414,7 @@ async def create_instance( :param password: Password of the initial user. :param region: Region to target. If none is passed will use default region from the config. :param project_id: The Project ID on which the Database Instance will be created. + :param name: Name of the Database Instance. :param tags: Tags to apply to the Database Instance. :param volume: Instance volume information. :param endpoints: One or multiple EndpointSpec used to expose your Database Instance. @@ -423,7 +424,6 @@ async def create_instance( :: result = await api.create_instance( - name="example", version="example", node_number=1, node_type="example", @@ -441,7 +441,6 @@ async def create_instance( f"/mongodb/v1alpha1/regions/{param_region}/instances", body=marshal_CreateInstanceRequest( CreateInstanceRequest( - name=name, version=version, node_number=node_number, node_type=node_type, @@ -449,6 +448,7 @@ async def create_instance( password=password, region=region, project_id=project_id, + name=name or random_name(prefix="mgdb"), tags=tags, volume=volume, endpoints=endpoints, diff --git a/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py index e3012a10b..d486ad668 100644 --- a/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py @@ -656,9 +656,6 @@ def marshal_CreateInstanceRequest( ) -> Dict[str, Any]: output: Dict[str, Any] = {} - if request.name is not None: - output["name"] = request.name - if request.version is not None: output["version"] = request.version @@ -677,6 +674,9 @@ def marshal_CreateInstanceRequest( if request.project_id is not None: output["project_id"] = request.project_id or defaults.default_project_id + if request.name is not None: + output["name"] = request.name + if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py b/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py index 547b27cf8..e93d3f8b5 100644 --- a/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py @@ -513,11 +513,6 @@ class RestoreSnapshotRequestVolumeDetails: @dataclass class CreateInstanceRequest: - name: str - """ - Name of the Database Instance. - """ - version: str """ Version of the MongoDB™ engine. @@ -553,6 +548,11 @@ class CreateInstanceRequest: The Project ID on which the Database Instance will be created. """ + name: Optional[str] + """ + Name of the Database Instance. + """ + tags: Optional[List[str]] """ Tags to apply to the Database Instance. diff --git a/scaleway/scaleway/mongodb/v1alpha1/api.py b/scaleway/scaleway/mongodb/v1alpha1/api.py index 80bdc6415..6e5ce9d52 100644 --- a/scaleway/scaleway/mongodb/v1alpha1/api.py +++ b/scaleway/scaleway/mongodb/v1alpha1/api.py @@ -12,6 +12,7 @@ ) from scaleway_core.utils import ( WaitForOptions, + random_name, validate_path_param, fetch_all_pages, wait_for_resource, @@ -389,7 +390,6 @@ def wait_for_instance( def create_instance( self, *, - name: str, version: str, node_number: int, node_type: str, @@ -397,6 +397,7 @@ def create_instance( password: str, region: Optional[Region] = None, project_id: Optional[str] = None, + name: Optional[str] = None, tags: Optional[List[str]] = None, volume: Optional[CreateInstanceRequestVolumeDetails] = None, endpoints: Optional[List[EndpointSpec]] = None, @@ -404,7 +405,6 @@ def create_instance( """ Create a MongoDB™ Database Instance. Create a new MongoDB™ Database Instance. - :param name: Name of the Database Instance. :param version: Version of the MongoDB™ engine. :param node_number: Number of node to use for the Database Instance. :param node_type: Type of node to use for the Database Instance. @@ -412,6 +412,7 @@ def create_instance( :param password: Password of the initial user. :param region: Region to target. If none is passed will use default region from the config. :param project_id: The Project ID on which the Database Instance will be created. + :param name: Name of the Database Instance. :param tags: Tags to apply to the Database Instance. :param volume: Instance volume information. :param endpoints: One or multiple EndpointSpec used to expose your Database Instance. @@ -421,7 +422,6 @@ def create_instance( :: result = api.create_instance( - name="example", version="example", node_number=1, node_type="example", @@ -439,7 +439,6 @@ def create_instance( f"/mongodb/v1alpha1/regions/{param_region}/instances", body=marshal_CreateInstanceRequest( CreateInstanceRequest( - name=name, version=version, node_number=node_number, node_type=node_type, @@ -447,6 +446,7 @@ def create_instance( password=password, region=region, project_id=project_id, + name=name or random_name(prefix="mgdb"), tags=tags, volume=volume, endpoints=endpoints, diff --git a/scaleway/scaleway/mongodb/v1alpha1/marshalling.py b/scaleway/scaleway/mongodb/v1alpha1/marshalling.py index e3012a10b..d486ad668 100644 --- a/scaleway/scaleway/mongodb/v1alpha1/marshalling.py +++ b/scaleway/scaleway/mongodb/v1alpha1/marshalling.py @@ -656,9 +656,6 @@ def marshal_CreateInstanceRequest( ) -> Dict[str, Any]: output: Dict[str, Any] = {} - if request.name is not None: - output["name"] = request.name - if request.version is not None: output["version"] = request.version @@ -677,6 +674,9 @@ def marshal_CreateInstanceRequest( if request.project_id is not None: output["project_id"] = request.project_id or defaults.default_project_id + if request.name is not None: + output["name"] = request.name + if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/mongodb/v1alpha1/types.py b/scaleway/scaleway/mongodb/v1alpha1/types.py index 547b27cf8..e93d3f8b5 100644 --- a/scaleway/scaleway/mongodb/v1alpha1/types.py +++ b/scaleway/scaleway/mongodb/v1alpha1/types.py @@ -513,11 +513,6 @@ class RestoreSnapshotRequestVolumeDetails: @dataclass class CreateInstanceRequest: - name: str - """ - Name of the Database Instance. - """ - version: str """ Version of the MongoDB™ engine. @@ -553,6 +548,11 @@ class CreateInstanceRequest: The Project ID on which the Database Instance will be created. """ + name: Optional[str] + """ + Name of the Database Instance. + """ + tags: Optional[List[str]] """ Tags to apply to the Database Instance.