Repository: microsoft/onefuzz
File: src/cli/onefuzz/api.py (Python)

Code before:
    endpoint = "scaleset"

    def _expand_scaleset_machine(
        self,
        scaleset_id: UUID_EXPANSION,
        machine_id: UUID_EXPANSION,
        *,
        include_auth: bool = False,
    ) -> Tuple[models.Scaleset, UUID]:
        scaleset = self.get(scaleset_id, include_auth=include_auth)

        if scaleset.nodes is None:
            raise Exception("no nodes defined in scaleset")
        nodes = scaleset.nodes

        machine_id_expanded = self._disambiguate_uuid(
            "machine_id", machine_id, lambda: [str(x.machine_id) for x in nodes]
        )
        return (scaleset, machine_id_expanded)

    def create(
        self,
        pool_name: primitives.PoolName,
        max_size: int,
        *,
        intialized_size: Optional[int] = 1,
        image: Optional[str] = None,
        vm_sku: Optional[str] = "Standard_D2s_v3",
        region: Optional[primitives.Region] = None,
        spot_instances: bool = False,
        ephemeral_os_disks: bool = False,
        tags: Optional[Dict[str, str]] = None,
        min_instances: Optional[int] = 0,
        scale_out_amount: Optional[int] = 1,
        scale_out_cooldown: Optional[int] = 10,
        scale_in_amount: Optional[int] = 1,
        scale_in_cooldown: Optional[int] = 15,
    ) -> models.Scaleset:
        self.logger.debug("create scaleset")

        if tags is None:
            tags = {}

        if image is None:
            pool = self.onefuzz.pools.get(pool_name)
            if pool.os == enums.OS.linux:
                image = DEFAULT_LINUX_IMAGE
            elif pool.os == enums.OS.windows:
                image = DEFAULT_WINDOWS_IMAGE
            else:
                raise NotImplementedError

Review comment (suggestion):
I think `initial_size` makes a bit more sense because the scaleset has not been created yet, so a past tense parameter is a little confusing.  We want to communicate that this is the size we will initialize the scale set to. 

Code after:
    endpoint = "scaleset"

    def _expand_scaleset_machine(
        self,
        scaleset_id: UUID_EXPANSION,
        machine_id: UUID_EXPANSION,
        *,
        include_auth: bool = False,
    ) -> Tuple[models.Scaleset, UUID]:
        scaleset = self.get(scaleset_id, include_auth=include_auth)

        if scaleset.nodes is None:
            raise Exception("no nodes defined in scaleset")
        nodes = scaleset.nodes

        machine_id_expanded = self._disambiguate_uuid(
            "machine_id", machine_id, lambda: [str(x.machine_id) for x in nodes]
        )
        return (scaleset, machine_id_expanded)

    def create(
        self,
        pool_name: primitives.PoolName,
        max_size: int,
        *,
        initial_size: Optional[int] = 1,
        image: Optional[str] = None,
        vm_sku: Optional[str] = "Standard_D2s_v3",
        region: Optional[primitives.Region] = None,
        spot_instances: bool = False,
        ephemeral_os_disks: bool = False,
        tags: Optional[Dict[str, str]] = None,
        min_instances: Optional[int] = 0,
        scale_out_amount: Optional[int] = 1,
        scale_out_cooldown: Optional[int] = 10,
        scale_in_amount: Optional[int] = 1,
        scale_in_cooldown: Optional[int] = 15,
    ) -> models.Scaleset:
        self.logger.debug("create scaleset")

        if tags is None:
            tags = {}

        if image is None:
            pool = self.onefuzz.pools.get(pool_name)
            if pool.os == enums.OS.linux:
                image = DEFAULT_LINUX_IMAGE
            elif pool.os == enums.OS.windows:
                image = DEFAULT_WINDOWS_IMAGE
            else:
                raise NotImplementedError