# Copyright 2023 Google LLC. All Rights Reserved.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
info:
  title: Compute/Subnetwork
  description: The Compute Subnetwork resource
  x-dcl-struct-name: Subnetwork
  x-dcl-has-iam: false
paths:
  get:
    description: The function used to get information about a Subnetwork
    parameters:
    - name: subnetwork
      required: true
      description: A full instance of a Subnetwork
  apply:
    description: The function used to apply information about a Subnetwork
    parameters:
    - name: subnetwork
      required: true
      description: A full instance of a Subnetwork
  delete:
    description: The function used to delete a Subnetwork
    parameters:
    - name: subnetwork
      required: true
      description: A full instance of a Subnetwork
  deleteAll:
    description: The function used to delete all Subnetwork
    parameters:
    - name: project
      required: true
      schema:
        type: string
    - name: region
      required: true
      schema:
        type: string
  list:
    description: The function used to list information about many Subnetwork
    parameters:
    - name: project
      required: true
      schema:
        type: string
    - name: region
      required: true
      schema:
        type: string
components:
  schemas:
    Subnetwork:
      title: Subnetwork
      x-dcl-id: projects/{{project}}/regions/{{region}}/subnetworks/{{name}}
      x-dcl-locations:
      - region
      x-dcl-parent-container: project
      x-dcl-has-create: true
      x-dcl-has-iam: false
      x-dcl-read-timeout: 0
      x-dcl-apply-timeout: 0
      x-dcl-delete-timeout: 0
      type: object
      required:
      - ipCidrRange
      - name
      - network
      - region
      - project
      properties:
        creationTimestamp:
          type: string
          format: date-time
          x-dcl-go-name: CreationTimestamp
          readOnly: true
          description: Creation timestamp in RFC3339 text format.
          x-kubernetes-immutable: true
        description:
          type: string
          x-dcl-go-name: Description
          description: 'An optional description of this resource. Provide this property
            when you create the resource. This field can be set only at resource creation
            time. '
          x-kubernetes-immutable: true
        enableFlowLogs:
          type: boolean
          x-dcl-go-name: EnableFlowLogs
          description: Whether to enable flow logging for this subnetwork. If this
            field is not explicitly set, it will not appear in `get` listings. If
            not set the default behavior is to disable flow logging. This field isn't
            supported with the `purpose` field set to `INTERNAL_HTTPS_LOAD_BALANCER`.
          x-kubernetes-immutable: true
          x-dcl-server-default: true
        fingerprint:
          type: string
          x-dcl-go-name: Fingerprint
          readOnly: true
          description: 'Fingerprint of this resource. This field is used internally
            during updates of this resource. '
          x-kubernetes-immutable: true
        gatewayAddress:
          type: string
          x-dcl-go-name: GatewayAddress
          readOnly: true
          description: 'The gateway address for default routes to reach destination
            addresses outside this subnetwork. '
          x-kubernetes-immutable: true
        ipCidrRange:
          type: string
          x-dcl-go-name: IPCidrRange
          description: 'The range of internal addresses that are owned by this subnetwork.
            Provide this property when you create the subnetwork. For example, 10.0.0.0/8
            or 192.168.0.0/16. Ranges must be unique and non-overlapping within a
            network. Only IPv4 is supported. '
        logConfig:
          type: object
          x-dcl-go-name: LogConfig
          x-dcl-go-type: SubnetworkLogConfig
          description: 'Denotes the logging options for the subnetwork flow logs.
            If logging is enabled logs will be exported to Cloud Logging. '
          properties:
            aggregationInterval:
              type: string
              x-dcl-go-name: AggregationInterval
              x-dcl-go-type: SubnetworkLogConfigAggregationIntervalEnum
              description: 'Can only be specified if VPC flow logging for this subnetwork
                is enabled. Toggles the aggregation interval for collecting flow logs.
                Increasing the interval time will reduce the amount of generated flow
                logs for long lasting connections. Default is an interval of 5 seconds
                per connection. Possible values are INTERVAL_5_SEC, INTERVAL_30_SEC,
                INTERVAL_1_MIN, INTERVAL_5_MIN, INTERVAL_10_MIN, INTERVAL_15_MIN '
              default: INTERVAL_5_SEC
              enum:
              - INTERVAL_5_SEC
              - INTERVAL_30_SEC
              - INTERVAL_1_MIN
              - INTERVAL_5_MIN
              - INTERVAL_10_MIN
              - INTERVAL_15_MIN
            flowSampling:
              type: number
              format: double
              x-dcl-go-name: FlowSampling
              description: 'Can only be specified if VPC flow logging for this subnetwork
                is enabled. The value of the field must be in [0, 1]. Set the sampling
                rate of VPC flow logs within the subnetwork where 1.0 means all collected
                logs are reported and 0.0 means no logs are reported. Default is 0.5
                which means half of all collected logs are reported. '
              default: 0.5
            metadata:
              type: string
              x-dcl-go-name: Metadata
              x-dcl-go-type: SubnetworkLogConfigMetadataEnum
              description: 'Can only be specified if VPC flow logging for this subnetwork
                is enabled. Configures whether metadata fields should be added to
                the reported VPC flow logs. Default is `INCLUDE_ALL_METADATA`.  Possible
                values: EXCLUDE_ALL_METADATA, INCLUDE_ALL_METADATA'
              default: INCLUDE_ALL_METADATA
              enum:
              - EXCLUDE_ALL_METADATA
              - INCLUDE_ALL_METADATA
        name:
          type: string
          x-dcl-go-name: Name
          description: 'The name of the resource, provided by the client when initially
            creating the resource. The name must be 1-63 characters long, and comply
            with RFC1035. Specifically, the name must be 1-63 characters long and
            match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means
            the first character must be a lowercase letter, and all following characters
            must be a dash, lowercase letter, or digit, except the last character,
            which cannot be a dash. '
          x-kubernetes-immutable: true
        network:
          type: string
          x-dcl-go-name: Network
          description: 'The network this subnet belongs to. Only networks that are
            in the distributed mode can have subnetworks. '
          x-kubernetes-immutable: true
          x-dcl-references:
          - resource: Compute/Network
            field: selfLink
        privateIPGoogleAccess:
          type: boolean
          x-dcl-go-name: PrivateIPGoogleAccess
          description: 'When enabled, VMs in this subnetwork without external IP addresses
            can access Google APIs and services by using Private Google Access. '
        project:
          type: string
          x-dcl-go-name: Project
          description: The project id of the resource.
          x-kubernetes-immutable: true
          x-dcl-references:
          - resource: Cloudresourcemanager/Project
            field: name
            parent: true
        purpose:
          type: string
          x-dcl-go-name: Purpose
          x-dcl-go-type: SubnetworkPurposeEnum
          description: 'The purpose of the resource. This field can be either PRIVATE
            or INTERNAL_HTTPS_LOAD_BALANCER. A subnetwork with purpose set to INTERNAL_HTTPS_LOAD_BALANCER
            is a user-created subnetwork that is reserved for Internal HTTP(S) Load
            Balancing. If unspecified, the purpose defaults to PRIVATE.  If set to
            INTERNAL_HTTPS_LOAD_BALANCER you must also set the role. '
          x-kubernetes-immutable: true
          x-dcl-server-default: true
          enum:
          - INTERNAL_HTTPS_LOAD_BALANCER
          - PRIVATE
          - AGGREGATE
          - PRIVATE_SERVICE_CONNECT
          - CLOUD_EXTENSION
          - PRIVATE_NAT
        region:
          type: string
          x-dcl-go-name: Region
          description: 'The GCP region for this subnetwork. '
          x-kubernetes-immutable: true
        role:
          type: string
          x-dcl-go-name: Role
          x-dcl-go-type: SubnetworkRoleEnum
          description: 'The role of subnetwork. Currenly, this field is only used
            when purpose = INTERNAL_HTTPS_LOAD_BALANCER. The value can be set to ACTIVE
            or BACKUP. An ACTIVE subnetwork is one that is currently being used for
            Internal HTTP(S) Load Balancing. A BACKUP subnetwork is one that is ready
            to be promoted to ACTIVE or is currently draining. '
          enum:
          - ACTIVE
          - BACKUP
        secondaryIPRanges:
          type: array
          x-dcl-go-name: SecondaryIPRanges
          description: 'An array of configurations for secondary IP ranges for VM
            instances contained in this subnetwork. The primary IP of such VM must
            belong to the primary ipCidrRange of the subnetwork. The alias IPs may
            belong to either primary or secondary ranges. This field uses attr-as-block
            mode to avoid breaking users during the 0.12 upgrade. See [the Attr-as-Block
            page](https://www.terraform.io/docs/configuration/attr-as-blocks.html)
            for more details. '
          x-dcl-server-default: true
          x-dcl-send-empty: true
          x-dcl-list-type: list
          items:
            type: object
            x-dcl-go-type: SubnetworkSecondaryIPRanges
            required:
            - rangeName
            - ipCidrRange
            properties:
              ipCidrRange:
                type: string
                x-dcl-go-name: IPCidrRange
                description: 'The range of IP addresses belonging to this subnetwork
                  secondary range. Provide this property when you create the subnetwork.
                  Ranges must be unique and non-overlapping with all primary and secondary
                  IP ranges within a network. Only IPv4 is supported. '
              rangeName:
                type: string
                x-dcl-go-name: RangeName
                description: 'The name associated with this subnetwork secondary range,
                  used when adding an alias IP range to a VM instance. The name must
                  be 1-63 characters long, and comply with RFC1035. The name must
                  be unique within the subnetwork. '
        selfLink:
          type: string
          x-dcl-go-name: SelfLink
          readOnly: true
          description: '[Output Only] Server-defined URL for the resource.'
          x-kubernetes-immutable: true
