- release_tracks: [BETA]

  help_text:
    brief: Update a Router appliance spoke.
    description: Update the details of a Router appliance spoke.

    examples: |
      To update the description of a Router appliance spoke named ``my-spoke'', run:

        $ {command} my-spoke --region=us-central1 --description="new spoke description"

      To replace the router appliance instances linked to a spoke with two new instances, run:

        $ {command} my-spoke --region=us-central1 --router-appliance=instance=https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/vm1,ip=10.10.0.1 --router-appliance=instance=https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/vm2,ip=10.10.0.2

  arguments:
    resource:
      spec: !REF googlecloudsdk.command_lib.network_connectivity.resources:spoke
      help_text: Name of the spoke to update.
    params:
    - arg_name: description
      api_field: googleCloudNetworkconnectivityV1betaSpoke.description
      help_text: New description of the spoke.
    - arg_name: router-appliance
      api_field: googleCloudNetworkconnectivityV1betaSpoke.linkedRouterApplianceInstances.instances
      type:
        arg_dict:
          flatten: false
          spec:
          - api_field: virtualMachine
            arg_name: instance
            type: str
          - api_field: ipAddress
            arg_name: ip
            type: str
      help_text: |
        Router appliance instance(s) with which to replace the set of instances already
        linked to this spoke. Pass this flag multiple times to replace with multiple instances.
        For example, use `--router-appliance=instance=new_ins_uri,ip=10.10.0.1` for a single router appliance instance,
        or `--router-appliance=instance=new_ins_uri_1,ip=10.10.0.1 --router-appliance=instance=new_ins_uri_2,ip=10.10.0.2 ...`
        for multiple instances.
    - arg_name: include-import-ranges
      api_field: googleCloudNetworkconnectivityV1betaSpoke.linkedRouterApplianceInstances.includeImportRanges
      type: arg_list
      help_text: |
        IP address range(s) allowed to be imported from hub subnets. Only ``ALL_IPV4_RANGES`` can be
        added to the list. If it's empty, the spoke does not import any subnets from the hub.
    - arg_name: exclude-import-ranges
      api_field: googleCloudNetworkconnectivityV1betaSpoke.linkedRouterApplianceInstances.excludeImportRanges
      type: arg_list
      hidden: true
      help_text: |
        Hub routes overlapped/encompassed by exclude import ranges are excluded during import from hub.
    - arg_name: include-export-ranges
      api_field: googleCloudNetworkconnectivityV1betaSpoke.linkedRouterApplianceInstances.includeExportRanges
      type: arg_list
      hidden: true
      help_text: |
        Dynamic routes fully encompassed by include export ranges are included during export to hub.
        If it's empty, the spoke exports all dynamic routes to the hub.
    - arg_name: exclude-export-ranges
      api_field: googleCloudNetworkconnectivityV1betaSpoke.linkedRouterApplianceInstances.excludeExportRanges
      type: arg_list
      hidden: true
      help_text: |
        Dynamic routes overlapped/encompassed by exclude export ranges are excluded during export to hub.
    labels:
      api_field: googleCloudNetworkconnectivityV1betaSpoke.labels

  update:
    read_modify_update: true

  async:
    collection: networkconnectivity.projects.locations.operations

  request:
    api_version: v1beta
    collection: networkconnectivity.projects.locations.spokes
    method: patch

- release_tracks: [GA]

  help_text:
    brief: Update a Router appliance spoke.
    description: Update the details of a Router appliance spoke.

    examples: |
      To update the description of a Router appliance spoke named ``my-spoke'', run:

        $ {command} my-spoke --region=us-central1 --description="new spoke description"

      To replace the router appliance instances linked to a spoke with two new instances, run:

        $ {command} my-spoke --region=us-central1 --router-appliance=instance=https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/vm1,ip=10.10.0.1 --router-appliance=instance=https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances/vm2,ip=10.10.0.2

  arguments:
    resource:
      spec: !REF googlecloudsdk.command_lib.network_connectivity.resources:spoke
      help_text: Name of the spoke to update.
    params:
    - arg_name: description
      api_field: spoke.description
      help_text: New description of the spoke.
    - arg_name: router-appliance
      api_field: spoke.linkedRouterApplianceInstances.instances
      type:
        arg_dict:
          flatten: false
          spec:
          - api_field: virtualMachine
            arg_name: instance
            type: str
          - api_field: ipAddress
            arg_name: ip
            type: str
      help_text: |
        Router appliance instance(s) with which to replace the set of instances already
        linked to this spoke. Pass this flag multiple times to replace with multiple instances.
        For example, use `--router-appliance=instance=new_ins_uri,ip=10.10.0.1` for a single router appliance instance,
        or `--router-appliance=instance=new_ins_uri_1,ip=10.10.0.1 --router-appliance=instance=new_ins_uri_2,ip=10.10.0.2 ...`
        for multiple instances.
    - arg_name: include-import-ranges
      api_field: spoke.linkedRouterApplianceInstances.includeImportRanges
      type: arg_list
      help_text: |
        IP address range(s) allowed to be imported from hub subnets. Only ``ALL_IPV4_RANGES`` can be
        added to the list. If it's empty, the spoke does not import any subnets from the hub.
    - arg_name: exclude-import-ranges
      api_field: spoke.linkedRouterApplianceInstances.excludeImportRanges
      type: arg_list
      hidden: true
      help_text: |
        Hub routes overlapped/encompassed by exclude import ranges are excluded during import from hub.
    - arg_name: include-export-ranges
      api_field: spoke.linkedRouterApplianceInstances.includeExportRanges
      type: arg_list
      hidden: true
      help_text: |
        Dynamic routes fully encompassed by include export ranges are included during export to hub.
        If it's empty, the spoke exports all dynamic routes to the hub.
    - arg_name: exclude-export-ranges
      api_field: spoke.linkedRouterApplianceInstances.excludeExportRanges
      type: arg_list
      hidden: true
      help_text: |
        Dynamic routes overlapped/encompassed by exclude export ranges are excluded during export to hub.
    labels:
      api_field: spoke.labels

  update:
    read_modify_update: true

  async:
    collection: networkconnectivity.projects.locations.operations

  request:
    api_version: v1
    collection: networkconnectivity.projects.locations.spokes
    method: patch
