openapi: 3.0.0
info:
  title: Instance Scaling Groups API
  description: |-
    Instance Scaling Groups dynamically adjust their number of Instances based on defined scaling policies. Scaling actions (scale up or down) are triggered when the monitored metric exceeds the configured thresholds from your policies. Instance Scaling Groups rely on the Cockpit product to gather the Instance metrics, such as RAM or bandwidth usage. The Load Balancer of your choice, which handles traffic for the given Instance group, is automatically configured according to the scaling action so that connections are properly distributed among the set of Instances.

    The purpose of this product is to maintain optimal application performance and cost efficiency by scaling your Instance group up during peak traffic and scaling it down when demand decreases. This ensures that applications have the necessary resources to handle varying loads without manual intervention, providing high availability and fault tolerance. Instance Scaling Groups are particularly useful for dynamic workloads, enabling businesses to optimize resource usage and reduce operational overhead.

    (switchcolumn)
    <Message type="note">
    This product is currently in [Public Beta](https://www.scaleway.com/en/betas/).
    </Message>
    (switchcolumn)

    ## Quickstart

    1. Configure your environment variables.

        <Message type="note">
        This is an optional step that seeks to simplify your usage of the Instance Scaling Groups API.
        </Message>

        ```bash
        export SCW_SECRET_KEY="<API secret key>"
        export SCW_DEFAULT_ZONE="<Scaleway default Availability Zone>"
        export SCW_PROJECT_ID="<Scaleway Project ID>"
        ```

    2. **Create an Instance Template**: run the following command to create an Instance template. The created template will be used by the group during scaling to start new Instances, according to the given settings.

        ```bash
        curl -X POST \
          -H "X-Auth-Token: $SCW_SECRET_KEY" \
          -H "Content-Type: application/json" \
          "https://api.scaleway.com/autoscaling/v1alpha1/zones/$SCW_DEFAULT_ZONE/instance-templates" \
          -d '{
            "name": "my_template",
            "commercial_type": "PLAY2-NANO",
            "volumes": {
                "0": {
                    "name": "boot volume",
                    "from_snapshot": {
                        "snapshot_id": "<SNAPSHOT_ID>"
                    },
                    "volume_type": "sbs",
                    "boot": true
                }
            },
            "private_network_ids": [
                "<PRIVATE_NETWORK_ID>"
            ],
            "project_id": "'"$SCW_PROJECT_ID"'"
          }'
        ```

    3. **Create an Instance Group**: run the following command to create an Instance group. You must have already configured a Load Balancer, so that the Instance group can update its backend servers list during scaling actions. You can specify the Private Network to be used for traffic between your Load Balancer and the Instances. If specified, the given Private Network must be already attached to the Load Balancer.

        ```bash
        curl -X POST \
          -H "X-Auth-Token: $SCW_SECRET_KEY" \
          -H "Content-Type: application/json" \
          "https://api.scaleway.com/autoscaling/v1alpha1/zones/$SCW_DEFAULT_ZONE/instance-groups" \
          -d '{
            "project_id": "'"$SCW_PROJECT_ID"'",
            "name": "my_instance_group",
            "template_id": "<AUTOSCALING_TEMPLATE_ID>",
            "capacity": {
              "max_replicas": 5,
              "min_replicas": 1,
              "cooldown_delay": "300s"
            },
            "loadbalancer":{
                "id": "<LOAD_BALANCER_ID>",
                "backend_ids": ["<BACKEND_ID>"],
                "private_network_id": "<PRIVATE_NETWORK_ID>"
            }
          }'
        ```

    3. **Create Scaling Policies**: run the following command to create scaling policies. Scaling policies are a set of rules which define criteria for scaling actions. Create at least 2 policies for both scaling up and down actions.

        ```bash
        curl -X POST \
          -H "X-Auth-Token: $SCW_SECRET_KEY" \
          -H "Content-Type: application/json" \
          "https://api.scaleway.com/autoscaling/v1alpha1/zones/$SCW_DEFAULT_ZONE/instance-policies" \
          -d '{
            "name": "my-policy-scale-up",
            "metric": {
              "name": "cpu scale up",
              "managed_metric": "managed_metric_instance_cpu",
              "operator": "operator_greater_than",
              "aggregate": "aggregate_average",
              "sampling_range_min": 5,
              "threshold": 70
            },
            "action": "scale_up",
            "type": "flat_count",
            "value": 1,
            "priority": 1,
            "instance_group_id": "<AUTOSCALING_INSTANCE_GROUP_ID>"
          }'

        curl -X POST \
          -H "X-Auth-Token: $SCW_SECRET_KEY" \
          -H "Content-Type: application/json" \
          "https://api.scaleway.com/autoscaling/v1alpha1/zones/$SCW_DEFAULT_ZONE/instance-policies" \
          -d '{
            "name": "my-policy-scale-down",
            "metric": {
              "name": "cpu scale down",
              "managed_metric": "managed_metric_instance_cpu",
              "operator": "operator_less_than",
              "aggregate": "aggregate_average",
              "sampling_range_min": 5,
              "threshold": 40
            },
            "action": "scale_down",
            "type": "flat_count",
            "value": 1,
            "priority": 2,
            "instance_group_id": "<AUTOSCALING_INSTANCE_GROUP_ID>"
          }'
        ```

    3. **Get a list of scaling events**: run the following command to get a list of all the scaling events which occurred for the given Instance group:

        ```bash
        curl -X GET \
          -H "Content-Type: application/json" \
          -H "X-Auth-Token: $SCW_SECRET_KEY" \
          "https://api.scaleway.com/autoscaling/v1alpha1/zones/$SCW_DEFAULT_ZONE/instance-groups/<INSTANCE_GROUP_ID>/events"
        ```

    4. **Delete your Instance Group**: run the following command to delete an Instance group. Ensure that you replace `<INSTANCE_GROUP_ID>` in the URL with the ID of the Instance group you want to delete.

        ```bash
        curl -X DELETE \
          -H "Content-Type: application/json" \
          -H "X-Auth-Token: $SCW_SECRET_KEY" \
          "https://api.scaleway.com/autoscaling/v1alpha1/zones/$SCW_DEFAULT_ZONE/instance-groups/<INSTANCE_GROUP_ID>"
        ```

    (switchcolumn)
    <Message type="requirement">
    - You have a [Scaleway account](https://console.scaleway.com/)
    - You have created an [API key](https://www.scaleway.com/en/docs/iam/how-to/create-api-keys/) and that the API key has sufficient [IAM permissions](https://www.scaleway.com/en/docs/iam/reference-content/permission-sets/) to perform the actions described on this page
    - You have [installed `curl`](https://curl.se/download.html)
    </Message>
    (switchcolumn)

    ## Technical information

    Instance Scaling Groups rely on the [Cockpit](https://www.scaleway.com/en/docs/cockpit/) product to gather metrics and take scaling actions based on defined policies. Scaling can thus occur every 5 minutes, which is the time to re-fetch metrics from Cockpit after a previous iteration.

    ### Availability Zones

    The Scaleway Instance Scaling Groups API is a **zoned** API, meaning that each call must specify in its path parameters the Availability Zone for the resources concerned by the call.

    The following Availability Zones are available for Instance Scaling Groups:

    | Name      | API ID                           |
    |-----------|----------------------------------|
    | Paris     | `fr-par-1` `fr-par-2`            |

    ## Technical limitations

    - When you update an Instance template, changes are not replicated to existing Instances. If you need to refresh all existing Instances so that they comply with the new template, you must terminate them so that the group can create new Instances based on the updated template.
    - Custom metrics are not supported yet. You can only set scaling policies according to pre-defined "managed metrics".
    - Instance Scaling Groups do not handle the creation of Load Balancers and their associated backends. Only backend server updates for the given existing backend are managed by the group.
    - Instance Scaling Groups rely on the Instance status to determine whether it is healthy or not, not on the Load Balancer health check mechanism.

    ## Going further

    For more help using Scaleway Instance Scaling Groups, check out the following resources:
    - Our [Slack Community](https://www.scaleway.com/en/docs/tutorials/scaleway-slack-community/)
    - Our [support ticketing system](https://www.scaleway.com/en/docs/account/how-to/open-a-support-ticket/).
  version: v1alpha1
servers:
- url: https://api.scaleway.com
tags:
- name: Instance Groups
  description: Instance Groups are the core components which allow the number of Instances
    to be automatically adjusted to meet demand.
- name: Instance Templates
  description: Instance templates are models of Instances which are used by Instance
    groups when scaling up.
- name: Scaling Policies
  description: Scaling policies contain the rules which trigger scaling events, based
    on defined metrics and thresholds.
components:
  schemas:
    scaleway.autoscaling.v1alpha1.InstanceGroup:
      type: object
      properties:
        id:
          type: string
          description: Instance group ID.
        project_id:
          type: string
          description: Project ID of the Instance group.
        name:
          type: string
          description: Name of the Instance group.
        tags:
          type: array
          description: Instance group tags.
          items:
            type: string
        instance_template_id:
          type: string
          description: Template ID (ID of the Instance template to attach to the Instance
            group).
        capacity:
          type: object
          description: Specification of the minimum and maximum replicas for the Instance
            group, and the cooldown interval between two scaling events.
          properties:
            max_replicas:
              type: integer
              description: Maximum count of Instances for the Instance group.
              format: uint32
            min_replicas:
              type: integer
              description: Minimum count of Instances for the Instance group.
              format: uint32
            cooldown_delay:
              type: string
              description: Time (in seconds) after a scaling action during which requests
                to carry out a new scaling action will be denied. (in seconds)
              example: 2.5s
              nullable: true
          x-properties-order:
          - max_replicas
          - min_replicas
          - cooldown_delay
        loadbalancer:
          type: object
          description: Specification of the Load Balancer linked to the Instance group.
          properties:
            id:
              type: string
              description: Load Balancer ID.
            backend_ids:
              type: array
              description: Load Balancer backend IDs.
              items:
                type: string
            private_network_id:
              type: string
              description: ID of the Private Network attached to the Load Balancer.
          x-properties-order:
          - id
          - backend_ids
          - private_network_id
        error_messages:
          type: array
          description: Any configuration errors for dependencies (Load Balancer, Private
            Network, Instance template etc.).
          items:
            type: string
        created_at:
          type: string
          description: Date on which the Instance group was created. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        updated_at:
          type: string
          description: Date on which the Instance group was last updated. (RFC 3339
            format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
      required:
      - capacity
      - loadbalancer
      x-properties-order:
      - id
      - project_id
      - name
      - tags
      - instance_template_id
      - capacity
      - loadbalancer
      - error_messages
      - created_at
      - updated_at
    scaleway.autoscaling.v1alpha1.InstanceGroupEvent:
      type: object
      properties:
        id:
          type: string
          description: Instance group event ID.
        source:
          type: string
          description: Log source.
          enum:
          - unknown_source
          - watcher
          - scaler
          - instance_manager
          - supervisor
          x-enum-descriptions:
            values:
              unknown_source: Unknown source event
              watcher: Responsible for collecting and analyzing metrics
              scaler: Responsible for processing the policy and generating Instance
                scale up/down tasks
              instance_manager: Responsible for managing the creation and deletion
                of Instances, and configuring the Load Balancer attached to the Instance
                group
              supervisor: Global Instance groups supervisor
          default: unknown_source
        level:
          type: string
          description: The severity of the log.
          enum:
          - info
          - success
          - error
          x-enum-descriptions:
            values:
              info: Informational log about the Instance group
              success: Success log for Instance scaling or Load Balancer configuration
              error: Error log for Instance group configuration or Instance group
                operation
          default: info
        name:
          type: string
          description: Log title.
        created_at:
          type: string
          description: Date and time of the log. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        details:
          type: string
          description: Full text of the log.
          nullable: true
      x-properties-order:
      - id
      - source
      - level
      - name
      - created_at
      - details
    scaleway.autoscaling.v1alpha1.InstancePolicy:
      type: object
      properties:
        id:
          type: string
          description: Scaling policy ID.
        name:
          type: string
          description: Name of scaling policy.
        metric:
          type: object
          description: Managed metric to use for this policy. These are available
            by default in Cockpit without any configuration or `node_exporter`. The
            chosen metric forms the basis of the condition that will be checked to
            determine whether a scaling action should be triggered.
          properties:
            name:
              type: string
              description: Name or description of the metric policy.
            managed_metric:
              type: string
              description: Managed metric to use for this policy. These are available
                by default in Cockpit without any configuration or `node_exporter`.
                The chosen metric forms the basis of the condition that will be checked
                to determine whether a scaling action should be triggered.
              enum:
              - managed_metric_unknown
              - managed_metric_instance_cpu
              - managed_metric_instance_network_in
              - managed_metric_instance_network_out
              - managed_loadbalancer_backend_connections_rate
              - managed_loadbalancer_backend_throughput
              x-enum-descriptions:
                values:
                  managed_metric_instance_cpu: Percentage of CPU usage across the
                    whole Instance group
                  managed_metric_instance_network_in: Rate input, in bytes/sec, of
                    the Instance's public interface
                  managed_metric_instance_network_out: Rate output, in bytes/sec,
                    of the Instance's public interface
                  managed_loadbalancer_backend_connections_rate: Cumulative number
                    of connections established to the Load Balancer backend related
                    to the Instance group
                  managed_loadbalancer_backend_throughput: Rate, in bytes/sec, of
                    all traffic forwarded to all Load Balancer backend servers
              nullable: true
              default: managed_metric_unknown
              x-one-of: metric_type
            cockpit_metric_name:
              type: string
              description: Custom metric to use for this policy. This must be stored
                in Scaleway Cockpit. The metric forms the basis of the condition that
                will be checked to determine whether a scaling action should be triggered.
              nullable: true
              x-one-of: metric_type
            operator:
              type: string
              description: Operator used when comparing the threshold value of the
                chosen `metric` to the actual sampled and aggregated value.
              enum:
              - operator_unknown
              - operator_greater_than
              - operator_less_than
              x-enum-descriptions:
                values:
                  operator_greater_than: Equivalent of a greater than symbol (>)
                  operator_less_than: Equivalent of a less than symbol (<)
              default: operator_unknown
            aggregate:
              type: string
              description: How the values sampled for the `metric` should be aggregated.
              enum:
              - aggregate_unknown
              - aggregate_average
              - aggregate_max
              - aggregate_min
              - aggregate_sum
              x-enum-descriptions:
                values:
                  aggregate_average: The average value of all sample points during
                    the specified interval.
                  aggregate_max: The maximum value of all sample points during the
                    specified interval.
                  aggregate_min: The minimum value of all sample points during the
                    specified interval.
                  aggregate_sum: The sum of all sample values during the specified
                    interval.
              default: aggregate_unknown
            sampling_range_min:
              type: integer
              description: Interval of time, in minutes, during which metric is sampled.
              format: uint32
            threshold:
              type: number
              description: Threshold value to measure the aggregated sampled `metric`
                value against. Combined with the `operator` field, determines whether
                a scaling action should be triggered.
              format: float
          nullable: true
          x-properties-order:
          - name
          - managed_metric
          - cockpit_metric_name
          - operator
          - aggregate
          - sampling_range_min
          - threshold
          x-one-of: trigger
        action:
          type: string
          description: Action to execute when the metric-based condition is met.
          enum:
          - unknown_action
          - scale_up
          - scale_down
          x-enum-descriptions:
            values:
              unknown_action: Action of unknown type
              scale_up: Create one or many new Instances (based on policy type and
                value)
              scale_down: Stop and remove one or many Instances (based on policy type
                and value)
          default: unknown_action
        type:
          type: string
          description: How to use the number defined in `value` when determining by
            how many Instances to scale up/down.
          enum:
          - unknown_type
          - flat_count
          - percent_of_total_group
          - set_total_group
          x-enum-descriptions:
            values:
              unknown_type: Action of unknown type.
              flat_count: Add or delete a fixed number of Instances. This must be
                a positive integer.
              percent_of_total_group: Add or delete a percentage of the total Instance
                group size
              set_total_group: Set the total number of Instances in the group to this
                arbitrary number. This must be a positive integer.
          default: unknown_type
        value:
          type: integer
          description: Number representing the magnitude of the scaling action to
            take for the Instance group.
          format: uint32
        priority:
          type: integer
          description: Priority of this policy compared to all other scaling policies.
            The lower the number, the higher the priority (higher priority will be
            processed sooner in the order).
          format: uint32
        instance_group_id:
          type: string
          description: Instance group ID related to this policy.
      x-properties-order:
      - id
      - name
      - metric
      - action
      - type
      - value
      - priority
      - instance_group_id
    scaleway.autoscaling.v1alpha1.InstanceTemplate:
      type: object
      properties:
        id:
          type: string
          description: ID of Instance template resource.
        commercial_type:
          type: string
          description: Name of Instance commercial type.
        image_id:
          type: string
          description: Instance image ID. Can be an ID of a marketplace or personal
            image. This image must be compatible with `volume` and `commercial_type`
            template.
          nullable: true
        volumes:
          type: object
          description: Template of Instance volume.
          properties:
            <volumeKey>:
              $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.VolumeInstanceTemplate'
          additionalProperties: true
        tags:
          type: array
          description: List of tags for the Instance template.
          items:
            type: string
        security_group_id:
          type: string
          description: Instance security group ID (optional).
          nullable: true
        placement_group_id:
          type: string
          description: Instance placement group ID. This is optional, but it is highly
            recommended to set a preference for Instance location within Availability
            Zone.
          nullable: true
        public_ips_v4_count:
          type: integer
          description: Number of flexible IPv4 addresses to attach to the new Instance.
          format: uint32
        public_ips_v6_count:
          type: integer
          description: Number of flexible IPv6 addresses to attach to the new Instance.
          format: uint32
        project_id:
          type: string
          description: ID of the Project containing the Instance template resource.
        name:
          type: string
          description: Name of Instance template.
        private_network_ids:
          type: array
          description: Private Network IDs to attach to the new Instance.
          items:
            type: string
        status:
          type: string
          description: Status of Instance template.
          enum:
          - unknown_status
          - ready
          - error
          x-enum-descriptions:
            values:
              unknown_status: Unknown status.
              ready: Template is ready and healthy.
              error: Template is in error state, see events log.
          default: unknown_status
        cloud_init:
          type: string
          description: Cloud-config file must be passed in Base64 format. Cloud-config
            files are special scripts designed to be run by the cloud-init process.
            These are generally used for initial configuration on the very first boot
            of a server.
        created_at:
          type: string
          description: Date on which the Instance template was created. (RFC 3339
            format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        updated_at:
          type: string
          description: Date on which the Instance template was last updated. (RFC
            3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
      x-properties-order:
      - id
      - commercial_type
      - image_id
      - volumes
      - tags
      - security_group_id
      - placement_group_id
      - public_ips_v4_count
      - public_ips_v6_count
      - project_id
      - name
      - private_network_ids
      - status
      - cloud_init
      - created_at
      - updated_at
    scaleway.autoscaling.v1alpha1.ListInstanceGroupEventsResponse:
      type: object
      properties:
        instance_events:
          type: array
          description: Paginated list of Instance groups.
          items:
            $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceGroupEvent'
        total_count:
          type: integer
          description: Count of all Instance groups matching the requested criteria.
          format: uint64
      x-properties-order:
      - instance_events
      - total_count
    scaleway.autoscaling.v1alpha1.ListInstanceGroupsResponse:
      type: object
      properties:
        instance_groups:
          type: array
          description: Paginated list of Instance groups.
          items:
            $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceGroup'
        total_count:
          type: integer
          description: Count of all Instance groups matching the requested criteria.
          format: uint64
      x-properties-order:
      - instance_groups
      - total_count
    scaleway.autoscaling.v1alpha1.ListInstancePoliciesResponse:
      type: object
      properties:
        policies:
          type: array
          description: Paginated list of policies.
          items:
            $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstancePolicy'
        total_count:
          type: integer
          description: Count of all policies matching the requested criteria.
          format: uint64
      x-properties-order:
      - policies
      - total_count
    scaleway.autoscaling.v1alpha1.ListInstanceTemplatesResponse:
      type: object
      properties:
        total_count:
          type: integer
          description: Count of all templates matching the requested criteria.
          format: uint64
        instance_templates:
          type: array
          description: Paginated list of Instance templates.
          items:
            $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceTemplate'
      x-properties-order:
      - total_count
      - instance_templates
    scaleway.autoscaling.v1alpha1.VolumeInstanceTemplate:
      type: object
      properties:
        name:
          type: string
          description: Name of the volume.
        perf_iops:
          type: integer
          description: The maximum IO/s expected, according to the different options
            available in stock (`5000 | 15000`).
          format: uint32
          nullable: true
          x-one-of: requirements
        from_empty:
          type: object
          description: Specify the size of the new volume if creating a new one from
            scratch.
          properties:
            size:
              type: integer
              description: (in bytes)
              format: uint64
          nullable: true
          x-properties-order:
          - size
          x-one-of: from
        from_snapshot:
          type: object
          description: Specify the snapshot ID of the original snapshot.
          properties:
            size:
              type: integer
              description: (in bytes)
              format: uint64
              nullable: true
            snapshot_id:
              type: string
          nullable: true
          x-properties-order:
          - size
          - snapshot_id
          x-one-of: from
        tags:
          type: array
          description: List of tags assigned to the volume.
          items:
            type: string
        boot:
          type: boolean
          description: Force the Instance to boot on this volume.
          default: "false"
        volume_type:
          type: string
          description: Type of the volume.
          enum:
          - unknown_volume_type
          - l_ssd
          - sbs
          x-enum-descriptions:
            values:
              unknown_volume_type: Unknown volume type
              l_ssd: Local storage
              sbs: Block storage
          default: unknown_volume_type
      required:
      - name
      x-properties-order:
      - name
      - perf_iops
      - from_empty
      - from_snapshot
      - tags
      - boot
      - volume_type
  securitySchemes:
    scaleway:
      in: header
      name: X-Auth-Token
      type: apiKey
paths:
  /autoscaling/v1alpha1/zones/{zone}/instance-groups:
    get:
      tags:
      - Instance Groups
      operationId: ListInstanceGroups
      summary: List Instance groups
      description: List all Instance groups, for a Scaleway Organization or Scaleway
        Project. By default, the Instance groups returned in the list are ordered
        by creation date in ascending order, though this can be modified via the `order_by`
        field.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: query
        name: order_by
        description: Sort order of Instance groups in the response.
        schema:
          type: string
          description: Sort order of Instance groups in the response.
          enum:
          - created_at_desc
          - created_at_asc
          x-enum-descriptions:
            values:
              created_at_desc: Order by creation date (descending chronological order)
              created_at_asc: Order by creation date (ascending chronological order)
          default: created_at_desc
      - in: query
        name: page
        description: Page number to return, from the paginated results.
        schema:
          type: integer
          description: Page number to return, from the paginated results.
          format: int32
      - in: query
        name: page_size
        description: Number of Instance groups to return per page.
        schema:
          type: integer
          description: Number of Instance groups to return per page.
          format: uint32
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.ListInstanceGroupsResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups" \
            X-Auth-Token:$SCW_SECRET_KEY
    post:
      tags:
      - Instance Groups
      operationId: CreateInstanceGroup
      summary: Create Instance group
      description: Create a new Instance group. You must specify a `template_id`,
        capacity and Load Balancer object.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceGroup'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                project_id:
                  type: string
                  description: Project ID to filter for, only Instance groups from
                    this Project will be returned.
                name:
                  type: string
                  description: Name of Instance group.
                tags:
                  type: array
                  description: List of tags for the Instance group.
                  items:
                    type: string
                template_id:
                  type: string
                  description: Template ID (ID of the Instance template to attach
                    to the Instance group).
                capacity:
                  type: object
                  description: Specification of the minimum and maximum replicas for
                    the Instance group, and the cooldown interval between two scaling
                    events.
                  properties:
                    max_replicas:
                      type: integer
                      description: Maximum count of Instances for the Instance group.
                      format: uint32
                    min_replicas:
                      type: integer
                      description: Minimum count of Instances for the Instance group.
                      format: uint32
                    cooldown_delay:
                      type: string
                      description: Time (in seconds) after a scaling action during
                        which requests to carry out a new scaling action will be denied.
                        (in seconds)
                      example: 2.5s
                      nullable: true
                  x-properties-order:
                  - max_replicas
                  - min_replicas
                  - cooldown_delay
                loadbalancer:
                  type: object
                  description: Specification of the Load Balancer to link to the Instance
                    group.
                  properties:
                    id:
                      type: string
                      description: Load Balancer ID.
                    backend_ids:
                      type: array
                      description: Load Balancer backend IDs.
                      items:
                        type: string
                    private_network_id:
                      type: string
                      description: ID of the Private Network attached to the Load
                        Balancer.
                  x-properties-order:
                  - id
                  - backend_ids
                  - private_network_id
              required:
              - project_id
              - name
              - template_id
              - capacity
              - loadbalancer
              x-properties-order:
              - project_id
              - name
              - tags
              - template_id
              - capacity
              - loadbalancer
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "capacity": {
                  "cooldown_delay": "2.5s",
                  "max_replicas": 42,
                  "min_replicas": 42
              },
              "loadbalancer": {
                  "backend_ids": [
                      "string"
                  ],
                  "id": "string",
                  "private_network_id": "string"
              },
              "name": "string",
              "project_id": "string",
              "template_id": "string"
            }' \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups" \
            X-Auth-Token:$SCW_SECRET_KEY \
            capacity:='{
              "cooldown_delay": "2.5s",
              "max_replicas": 42,
              "min_replicas": 42
            }' \
            loadbalancer:='{
              "backend_ids": [
                  "string"
              ],
              "id": "string",
              "private_network_id": "string"
            }' \
            name="string" \
            project_id="string" \
            template_id="string"
  /autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}:
    get:
      tags:
      - Instance Groups
      operationId: GetInstanceGroup
      summary: Get Instance group
      description: Retrieve information about an existing Instance group, specified
        by its `instance_group_id`. Its full details, including errors, are returned
        in the response object.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: instance_group_id
        description: ID of the requested Instance group.
        required: true
        schema:
          type: string
          description: ID of the requested Instance group.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceGroup'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    patch:
      tags:
      - Instance Groups
      operationId: UpdateInstanceGroup
      summary: Update Instance group
      description: Update the parameters of an existing Instance group, specified
        by its `instance_group_id`.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: instance_group_id
        description: Instance group ID to update.
        required: true
        schema:
          type: string
          description: Instance group ID to update.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceGroup'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of Instance group.
                  nullable: true
                tags:
                  type: array
                  description: List of tags for the Load Balancer.
                  nullable: true
                  items:
                    type: string
                capacity:
                  type: object
                  description: Specification of the minimum and maximum replicas for
                    the Instance group, and the cooldown interval between two scaling
                    events.
                  properties:
                    max_replicas:
                      type: integer
                      description: Maximum count of Instances for the Instance group.
                      format: uint32
                      nullable: true
                    min_replicas:
                      type: integer
                      description: Minimum count of Instances for the Instance group.
                      format: uint32
                      nullable: true
                    cooldown_delay:
                      type: string
                      description: Time (in seconds) after a scaling action during
                        which requests to carry out a new scaling action will be denied.
                        (in seconds)
                      example: 2.5s
                      nullable: true
                  x-properties-order:
                  - max_replicas
                  - min_replicas
                  - cooldown_delay
                loadbalancer:
                  type: object
                  description: Specification of the Load Balancer to link to the Instance
                    group.
                  properties:
                    backend_ids:
                      type: array
                      description: Load Balancer backend IDs.
                      nullable: true
                      items:
                        type: string
                  x-properties-order:
                  - backend_ids
              required:
              - name
              x-properties-order:
              - name
              - tags
              - capacity
              - loadbalancer
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X PATCH \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{"name":"string"}' \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}"
      - lang: HTTPie
        source: |-
          http PATCH "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}" \
            X-Auth-Token:$SCW_SECRET_KEY \
            name="string"
    delete:
      tags:
      - Instance Groups
      operationId: DeleteInstanceGroup
      summary: Delete  Instance group
      description: Delete an existing Instance group, specified by its `instance_group_id`.
        Deleting an Instance group is permanent, and cannot be undone.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: instance_group_id
        description: ID of the Instance group to delete.
        required: true
        schema:
          type: string
          description: ID of the Instance group to delete.
      responses:
        "204":
          description: ""
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X DELETE \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}"
      - lang: HTTPie
        source: |-
          http DELETE "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
  /autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}/events:
    get:
      tags:
      - Instance Groups
      operationId: ListInstanceGroupEvents
      summary: List events
      description: List all events for a given Instance group. By default, the events
        are ordered by creation date in descending order, though this can be modified
        via the `order_by` field.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: instance_group_id
        description: List all event logs for the Instance group ID.
        required: true
        schema:
          type: string
          description: List all event logs for the Instance group ID.
      - in: query
        name: order_by
        description: Sort order of Instance groups in the response.
        schema:
          type: string
          description: Sort order of Instance groups in the response.
          enum:
          - created_at_desc
          - created_at_asc
          x-enum-descriptions:
            values:
              created_at_desc: Order by creation date (descending chronological order)
              created_at_asc: Order by creation date (ascending chronological order)
          default: created_at_desc
      - in: query
        name: page
        description: Page number to return, from the paginated results.
        schema:
          type: integer
          description: Page number to return, from the paginated results.
          format: int32
      - in: query
        name: page_size
        description: Number of Instance groups to return per page.
        schema:
          type: integer
          description: Number of Instance groups to return per page.
          format: uint32
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.ListInstanceGroupEventsResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}/events"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-groups/{instance_group_id}/events" \
            X-Auth-Token:$SCW_SECRET_KEY
  /autoscaling/v1alpha1/zones/{zone}/instance-policies:
    get:
      tags:
      - Scaling Policies
      operationId: ListInstancePolicies
      summary: List scaling policies
      description: List all scaling policies, for a Scaleway Organization or Scaleway
        Project. By default, the policies returned in the list are ordered by creation
        date in ascending order, though this can be modified via the `order_by` field.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: query
        name: order_by
        description: Sort order of Instance groups in the response.
        schema:
          type: string
          description: Sort order of Instance groups in the response.
          enum:
          - created_at_desc
          - created_at_asc
          x-enum-descriptions:
            values:
              created_at_desc: Order by creation date (descending chronological order)
              created_at_asc: Order by creation date (ascending chronological order)
          default: created_at_desc
      - in: query
        name: instance_group_id
        description: Instance group ID.
        required: true
        schema:
          type: string
          description: Instance group ID.
      - in: query
        name: page
        description: Page number to return, from the paginated results.
        schema:
          type: integer
          description: Page number to return, from the paginated results.
          format: int32
      - in: query
        name: page_size
        description: Number of scaling policies to return per page.
        schema:
          type: integer
          description: Number of scaling policies to return per page.
          format: uint32
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.ListInstancePoliciesResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies?instance_group_id=string"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies" \
            X-Auth-Token:$SCW_SECRET_KEY \
            instance_group_id==string
    post:
      tags:
      - Scaling Policies
      operationId: CreateInstancePolicy
      summary: Create scaling policy
      description: Create a new scaling policy. You must specify a `policy_id`, capacity
        and Load Balancer object.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstancePolicy'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the policy.
                metric:
                  type: object
                  description: Cockpit metric to use when determining whether to trigger
                    a scale up/down action.
                  properties:
                    name:
                      type: string
                      description: Name or description of the metric policy.
                    managed_metric:
                      type: string
                      description: Managed metric to use for this policy. These are
                        available by default in Cockpit without any configuration
                        or `node_exporter`. The chosen metric forms the basis of the
                        condition that will be checked to determine whether a scaling
                        action should be triggered.
                      enum:
                      - managed_metric_unknown
                      - managed_metric_instance_cpu
                      - managed_metric_instance_network_in
                      - managed_metric_instance_network_out
                      - managed_loadbalancer_backend_connections_rate
                      - managed_loadbalancer_backend_throughput
                      x-enum-descriptions:
                        values:
                          managed_metric_instance_cpu: Percentage of CPU usage across
                            the whole Instance group
                          managed_metric_instance_network_in: Rate input, in bytes/sec,
                            of the Instance's public interface
                          managed_metric_instance_network_out: Rate output, in bytes/sec,
                            of the Instance's public interface
                          managed_loadbalancer_backend_connections_rate: Cumulative
                            number of connections established to the Load Balancer
                            backend related to the Instance group
                          managed_loadbalancer_backend_throughput: Rate, in bytes/sec,
                            of all traffic forwarded to all Load Balancer backend
                            servers
                      nullable: true
                      default: managed_metric_unknown
                      x-one-of: metric_type
                    cockpit_metric_name:
                      type: string
                      description: Custom metric to use for this policy. This must
                        be stored in Scaleway Cockpit. The metric forms the basis
                        of the condition that will be checked to determine whether
                        a scaling action should be triggered.
                      nullable: true
                      x-one-of: metric_type
                    operator:
                      type: string
                      description: Operator used when comparing the threshold value
                        of the chosen `metric` to the actual sampled and aggregated
                        value.
                      enum:
                      - operator_unknown
                      - operator_greater_than
                      - operator_less_than
                      x-enum-descriptions:
                        values:
                          operator_greater_than: Equivalent of a greater than symbol
                            (>)
                          operator_less_than: Equivalent of a less than symbol (<)
                      default: operator_unknown
                    aggregate:
                      type: string
                      description: How the values sampled for the `metric` should
                        be aggregated.
                      enum:
                      - aggregate_unknown
                      - aggregate_average
                      - aggregate_max
                      - aggregate_min
                      - aggregate_sum
                      x-enum-descriptions:
                        values:
                          aggregate_average: The average value of all sample points
                            during the specified interval.
                          aggregate_max: The maximum value of all sample points during
                            the specified interval.
                          aggregate_min: The minimum value of all sample points during
                            the specified interval.
                          aggregate_sum: The sum of all sample values during the specified
                            interval.
                      default: aggregate_unknown
                    sampling_range_min:
                      type: integer
                      description: Interval of time, in minutes, during which metric
                        is sampled.
                      format: uint32
                    threshold:
                      type: number
                      description: Threshold value to measure the aggregated sampled
                        `metric` value against. Combined with the `operator` field,
                        determines whether a scaling action should be triggered.
                      format: float
                  nullable: true
                  x-properties-order:
                  - name
                  - managed_metric
                  - cockpit_metric_name
                  - operator
                  - aggregate
                  - sampling_range_min
                  - threshold
                  x-one-of: trigger
                action:
                  type: string
                  description: Action to execute when the metric-based condition is
                    met.
                  enum:
                  - unknown_action
                  - scale_up
                  - scale_down
                  x-enum-descriptions:
                    values:
                      unknown_action: Action of unknown type
                      scale_up: Create one or many new Instances (based on policy
                        type and value)
                      scale_down: Stop and remove one or many Instances (based on
                        policy type and value)
                  default: unknown_action
                type:
                  type: string
                  description: How to use the number defined in `value` when determining
                    by how many Instances to scale up/down.
                  enum:
                  - unknown_type
                  - flat_count
                  - percent_of_total_group
                  - set_total_group
                  x-enum-descriptions:
                    values:
                      unknown_type: Action of unknown type.
                      flat_count: Add or delete a fixed number of Instances. This
                        must be a positive integer.
                      percent_of_total_group: Add or delete a percentage of the total
                        Instance group size
                      set_total_group: Set the total number of Instances in the group
                        to this arbitrary number. This must be a positive integer.
                  default: unknown_type
                value:
                  type: integer
                  description: Value representing the magnitude of the scaling action
                    to take for the Instance group. Depending on the `type` parameter,
                    this number could represent a total number of Instances in the
                    group, a number of Instances to add, or a percentage to scale
                    the group by.
                  format: uint32
                priority:
                  type: integer
                  description: Priority of this policy compared to all other scaling
                    policies. This determines the processing order. The lower the
                    number, the higher the priority.
                  format: uint32
                instance_group_id:
                  type: string
                  description: Instance group ID related to this policy.
              required:
              - name
              - action
              - type
              - value
              - instance_group_id
              x-properties-order:
              - name
              - metric
              - action
              - type
              - value
              - priority
              - instance_group_id
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "action": "unknown_action",
              "instance_group_id": "string",
              "name": "string",
              "priority": 42,
              "type": "unknown_type",
              "value": 42
            }' \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies" \
            X-Auth-Token:$SCW_SECRET_KEY \
            action="unknown_action" \
            instance_group_id="string" \
            name="string" \
            priority:=42 \
            type="unknown_type" \
            value:=42
  /autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}:
    get:
      tags:
      - Scaling Policies
      operationId: GetInstancePolicy
      summary: Get scaling policy
      description: Retrieve information about an existing scaling policy, specified
        by its `policy_id`. Its full details are returned in the response object.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: policy_id
        description: Policy ID.
        required: true
        schema:
          type: string
          description: Policy ID.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstancePolicy'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    patch:
      tags:
      - Scaling Policies
      operationId: UpdateInstancePolicy
      summary: Update scaling policy
      description: Update the parameters of an existing scaling policy, specified
        by its `policy_id`.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: policy_id
        description: Policy ID to update.
        required: true
        schema:
          type: string
          description: Policy ID to update.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstancePolicy'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Policy name to update.
                  nullable: true
                metric:
                  type: object
                  description: Metric specification to update (Cockpit metric to use
                    when determining whether to trigger a scale up/down action).
                  properties:
                    name:
                      type: string
                      description: Name or description of your metric policy.
                      nullable: true
                    managed_metric:
                      type: string
                      description: Managed metric to use for this policy. These are
                        available by default in Cockpit without any configuration
                        or `node_exporter`. The chosen metric forms the basis of the
                        condition that will be checked to determine whether a scaling
                        action should be triggered.
                      enum:
                      - managed_metric_unknown
                      - managed_metric_instance_cpu
                      - managed_metric_instance_network_in
                      - managed_metric_instance_network_out
                      - managed_loadbalancer_backend_connections_rate
                      - managed_loadbalancer_backend_throughput
                      x-enum-descriptions:
                        values:
                          managed_metric_instance_cpu: Percentage of CPU usage across
                            the whole Instance group
                          managed_metric_instance_network_in: Rate input, in bytes/sec,
                            of the Instance's public interface
                          managed_metric_instance_network_out: Rate output, in bytes/sec,
                            of the Instance's public interface
                          managed_loadbalancer_backend_connections_rate: Cumulative
                            number of connections established to the Load Balancer
                            backend related to the Instance group
                          managed_loadbalancer_backend_throughput: Rate, in bytes/sec,
                            of all traffic forwarded to all Load Balancer backend
                            servers
                      nullable: true
                      default: managed_metric_unknown
                      x-one-of: metric_type
                    cockpit_metric_name:
                      type: string
                      description: Custom metric to use for this policy. This must
                        be stored in Scaleway Cockpit. The metric forms the basis
                        of the condition that will be checked to determine whether
                        a scaling action should be triggered.
                      nullable: true
                      x-one-of: metric_type
                    operator:
                      type: string
                      description: Operator used when comparing the threshold value
                        of the chosen `metric` to the actual sampled and aggregated
                        value.
                      enum:
                      - operator_unknown
                      - operator_greater_than
                      - operator_less_than
                      x-enum-descriptions:
                        values:
                          operator_greater_than: Equivalent of a greater than symbol
                            (>)
                          operator_less_than: Equivalent of a less than symbol (<)
                      default: operator_unknown
                    aggregate:
                      type: string
                      description: How the values sampled for the `metric` should
                        be aggregated.
                      enum:
                      - aggregate_unknown
                      - aggregate_average
                      - aggregate_max
                      - aggregate_min
                      - aggregate_sum
                      x-enum-descriptions:
                        values:
                          aggregate_average: The average value of all sample points
                            during the specified interval.
                          aggregate_max: The maximum value of all sample points during
                            the specified interval.
                          aggregate_min: The minimum value of all sample points during
                            the specified interval.
                          aggregate_sum: The sum of all sample values during the specified
                            interval.
                      default: aggregate_unknown
                    sampling_range_min:
                      type: integer
                      description: Interval of time, in minutes, during which metric
                        is sampled.
                      format: uint32
                      nullable: true
                    threshold:
                      type: object
                      description: Threshold value to measure the aggregated sampled
                        `metric` value against. Combined with the `operator` field,
                        determines whether a scaling action should be triggered.
                      properties:
                        value:
                          type: number
                          format: float
                      x-properties-order:
                      - value
                  nullable: true
                  x-properties-order:
                  - name
                  - managed_metric
                  - cockpit_metric_name
                  - operator
                  - aggregate
                  - sampling_range_min
                  - threshold
                  x-one-of: trigger
                action:
                  type: string
                  description: Action to update (action to execute when the metric-based
                    condition is met).
                  enum:
                  - unknown_action
                  - scale_up
                  - scale_down
                  x-enum-descriptions:
                    values:
                      unknown_action: Action of unknown type
                      scale_up: Create one or many new Instances (based on policy
                        type and value)
                      scale_down: Stop and remove one or many Instances (based on
                        policy type and value)
                  default: unknown_action
                type:
                  type: string
                  description: Type to update (how to use the number defined in `value`
                    when determining by how many Instances to scale up/down).
                  enum:
                  - unknown_type
                  - flat_count
                  - percent_of_total_group
                  - set_total_group
                  x-enum-descriptions:
                    values:
                      unknown_type: Action of unknown type.
                      flat_count: Add or delete a fixed number of Instances. This
                        must be a positive integer.
                      percent_of_total_group: Add or delete a percentage of the total
                        Instance group size
                      set_total_group: Set the total number of Instances in the group
                        to this arbitrary number. This must be a positive integer.
                  default: unknown_type
                value:
                  type: integer
                  description: Value to update (number representing the magnitude
                    of the scaling action to take for the Instance group).
                  format: uint32
                  nullable: true
                priority:
                  type: integer
                  description: Priority to update (priority of this policy compared
                    to all other scaling policies. The lower the number, the higher
                    the priority).
                  format: uint32
                  nullable: true
              x-properties-order:
              - name
              - metric
              - action
              - type
              - value
              - priority
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X PATCH \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{}' \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}"
      - lang: HTTPie
        source: |-
          http PATCH "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    delete:
      tags:
      - Scaling Policies
      operationId: DeleteInstancePolicy
      summary: Delete scaling policy
      description: Delete an existing scaling policy, specified by its `policy_id`.
        Deleting a scaling policy is permanent, and cannot be undone.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: policy_id
        description: ID of the policy to delete.
        required: true
        schema:
          type: string
          description: ID of the policy to delete.
      responses:
        "204":
          description: ""
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X DELETE \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}"
      - lang: HTTPie
        source: |-
          http DELETE "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-policies/{policy_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
  /autoscaling/v1alpha1/zones/{zone}/instance-templates:
    get:
      tags:
      - Instance Templates
      operationId: ListInstanceTemplates
      summary: List Instance templates
      description: List all Instance templates, for a Scaleway Organization or Scaleway
        Project. By default, the Instance templates returned in the list are ordered
        by creation date in ascending order, though this can be modified via the `order_by`
        field.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: query
        name: order_by
        description: Sort order of Instance groups in the response.
        schema:
          type: string
          description: Sort order of Instance groups in the response.
          enum:
          - created_at_desc
          - created_at_asc
          x-enum-descriptions:
            values:
              created_at_desc: Order by creation date (descending chronological order)
              created_at_asc: Order by creation date (ascending chronological order)
          default: created_at_desc
      - in: query
        name: page
        description: Page number to return, from the paginated results.
        schema:
          type: integer
          description: Page number to return, from the paginated results.
          format: int32
      - in: query
        name: page_size
        description: Number of Instance groups to return per page.
        schema:
          type: integer
          description: Number of Instance groups to return per page.
          format: uint32
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.ListInstanceTemplatesResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates" \
            X-Auth-Token:$SCW_SECRET_KEY
    post:
      tags:
      - Instance Templates
      operationId: CreateInstanceTemplate
      summary: Create Instance template
      description: Create a new Instance template. This specifies the details of the
        Instance (commercial type, zone, image, volumes etc.) that will be in the
        Instance group.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceTemplate'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                commercial_type:
                  type: string
                  description: Name of Instance commercial type.
                image_id:
                  type: string
                  description: Instance image ID. Can be an ID of a marketplace or
                    personal image. This image must be compatible with `volume` and
                    `commercial_type` template.
                  nullable: true
                volumes:
                  type: object
                  description: Template of Instance volume.
                  properties:
                    <volumeKey>:
                      $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.VolumeInstanceTemplate'
                  additionalProperties: true
                tags:
                  type: array
                  description: List of tags for the Instance template.
                  items:
                    type: string
                security_group_id:
                  type: string
                  description: Instance security group ID (optional).
                  nullable: true
                placement_group_id:
                  type: string
                  description: Instance placement group ID. This is optional, but
                    it is highly recommended to set a preference for Instance location
                    within Availability Zone.
                  nullable: true
                public_ips_v4_count:
                  type: integer
                  description: Number of flexible IPv4 addresses to attach to the
                    new Instance.
                  format: uint32
                public_ips_v6_count:
                  type: integer
                  description: Number of flexible IPv6 addresses to attach to the
                    new Instance.
                  format: uint32
                project_id:
                  type: string
                  description: ID of the Project containing the Instance template
                    resource.
                name:
                  type: string
                  description: Name of Instance template.
                private_network_ids:
                  type: array
                  description: Private Network IDs to attach to the new Instance.
                  items:
                    type: string
                cloud_init:
                  type: string
                  description: Cloud-config file must be passed in Base64 format.
                    Cloud-config files are special scripts designed to be run by the
                    cloud-init process. These are generally used for initial configuration
                    on the very first boot of a server.
              required:
              - commercial_type
              - image_id
              - volumes
              - project_id
              - name
              x-properties-order:
              - commercial_type
              - image_id
              - volumes
              - tags
              - security_group_id
              - placement_group_id
              - public_ips_v4_count
              - public_ips_v6_count
              - project_id
              - name
              - private_network_ids
              - cloud_init
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "commercial_type": "string",
              "image_id": "string",
              "name": "string",
              "project_id": "string",
              "volumes": {
                  "\u003cvolumeKey\u003e": ""
              }
            }' \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates" \
            X-Auth-Token:$SCW_SECRET_KEY \
            commercial_type="string" \
            image_id="string" \
            name="string" \
            project_id="string" \
            volumes:='{
              "\u003cvolumeKey\u003e": ""
            }'
  /autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}:
    get:
      tags:
      - Instance Templates
      operationId: GetInstanceTemplate
      summary: Get Instance template
      description: Get an existing Instance template from its `template_id`.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: template_id
        description: Template ID of the resource.
        required: true
        schema:
          type: string
          description: Template ID of the resource.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceTemplate'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    patch:
      tags:
      - Instance Templates
      operationId: UpdateInstanceTemplate
      summary: Update Instance template
      description: Update an Instance template, such as its commercial offer type,
        image or volume template.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: template_id
        description: Template ID of the resource.
        required: true
        schema:
          type: string
          description: Template ID of the resource.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.InstanceTemplate'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                commercial_type:
                  type: string
                  description: Name of Instance commercial type.
                  nullable: true
                image_id:
                  type: string
                  description: Instance image ID. Can be an ID of a marketplace or
                    personal image. This image must be compatible with `volume` and
                    `commercial_type` template.
                  nullable: true
                volumes:
                  type: object
                  description: Template of Instance volume.
                  properties:
                    <volumeKey>:
                      $ref: '#/components/schemas/scaleway.autoscaling.v1alpha1.VolumeInstanceTemplate'
                  additionalProperties: true
                tags:
                  type: array
                  description: List of tags for the Instance template.
                  nullable: true
                  items:
                    type: string
                security_group_id:
                  type: string
                  description: Instance security group ID (optional).
                  nullable: true
                placement_group_id:
                  type: string
                  description: Instance placement group ID. This is optional, but
                    it is highly recommended to set a preference for Instance location
                    within Availability Zone.
                  nullable: true
                public_ips_v4_count:
                  type: integer
                  description: Number of flexible IPv4 addresses to attach to the
                    new Instance.
                  format: uint32
                public_ips_v6_count:
                  type: integer
                  description: Number of flexible IPv6 addresses to attach to the
                    new Instance.
                  format: uint32
                name:
                  type: string
                  description: Name of Instance template.
                  nullable: true
                private_network_ids:
                  type: array
                  description: Private Network IDs to attach to the new Instance.
                  nullable: true
                  items:
                    type: string
                cloud_init:
                  type: string
                  description: Cloud-config file must be passed in Base64 format.
                    Cloud-config files are special scripts designed to be run by the
                    cloud-init process. These are generally used for initial configuration
                    on the very first boot of a server.
              x-properties-order:
              - commercial_type
              - image_id
              - volumes
              - tags
              - security_group_id
              - placement_group_id
              - public_ips_v4_count
              - public_ips_v6_count
              - name
              - private_network_ids
              - cloud_init
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X PATCH \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{"volumes":{"\u003cvolumeKey\u003e":""}}' \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}"
      - lang: HTTPie
        source: |-
          http PATCH "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}" \
            X-Auth-Token:$SCW_SECRET_KEY \
            volumes:='{"\u003cvolumeKey\u003e":""}'
    delete:
      tags:
      - Instance Templates
      operationId: DeleteInstanceTemplate
      summary: Delete Instance template
      description: Delete an existing Instance template. This action is permanent
        and cannot be undone.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
      - in: path
        name: template_id
        description: ID of the template to delete.
        required: true
        schema:
          type: string
          description: ID of the template to delete.
      responses:
        "204":
          description: ""
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X DELETE \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}"
      - lang: HTTPie
        source: |-
          http DELETE "https://api.scaleway.com/autoscaling/v1alpha1/zones/{zone}/instance-templates/{template_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
