# -*- coding: utf-8 -*- #
# Copyright 2025 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.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
  - GA
  auto_generated: true
  help_text:
    brief: Create a Memorystore instance.
    description: |
      Create a Memorystore instance.

      A service connection policy for service class `gcp-memorystore` must already exist for the
      location and network. Refer to
      [creation prerequisites](https://cloud.google.com/memorystore/docs/valkey/networking#prerequisites_required_before_creating_an_instance)
      for more details.
    examples: |-
      To create a three shard Memorystore instance `my-instance` in project `my-project` and
      location `us-central1`, run:

      $ {command} my-instance --project=my-project --location=us-central1 --shard-count=3
        --psc-auto-connections="network=NETWORK,projectId=PROJECT_ID"

      To create a three shard Memorystore instance `my-instance` in project `my-project`,
      location `us-central1`, with one replica per shard, and TLS enabled, run:

      $ {command} my-instance --project=my-project --location=us-central1 --shard-count=3
        --psc-auto-connections="network=NETWORK,projectId=PROJECT_ID"
        --transit-encryption-mode=server-authentication --replica-count=1
  arguments:
    params:
    - group:
        mutex: true
        help_text: |-
          Arguments for the import sources.
        params:
        - group:
            api_field: instance.gcsSource
            required: false
            help_text: |-
              Backups that stored in Cloud Storage buckets.
              The Cloud Storage buckets need to be the same region as the instances.
            params:
            - arg_name: gcs-source-uris
              api_field: instance.gcsSource.uris
              required: false
              repeated: true
              help_text: |-
                Example: gs://bucket1/object1, gs://bucket2/folder2/object2
        - group:
            api_field: instance.managedBackupSource
            required: false
            help_text: |-
              Backups that generated and managed by memorystore.
            params:
            - arg_name: managed-backup-source
              api_field: instance.managedBackupSource.backup
              required: false
              repeated: false
              help_text: |-
                Example:
                //memorystore.googleapis.com/projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup}
                A shorter version (without the prefix) of the backup name is also
                supported, like
                projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup_id}
                In this case, it assumes the backup is under memorystore.googleapis.com.
    - group:
        mutex: true
        help_text: |-
          Arguments for the  replica count.
        params:
        - arg_name: replica-count
          api_field: instance.replicaCount
          required: false
          repeated: false
          type: int
          help_text: |-
            Number of replica nodes per shard. If omitted the default is 0 replicas.
    - group:
        mutex: true
        help_text: |-
          Arguments for the  deletion protection enabled.
        params:
        - arg_name: deletion-protection-enabled
          api_field: instance.deletionProtectionEnabled
          action: store_true
          required: false
          type: bool
          help_text: |-
            If set to true deletion of the instance will fail.
          default: null
    - group:
        mutex: true
        help_text: |-
          Arguments for the  simulate maintenance event.
        params:
        - arg_name: simulate-maintenance-event
          api_field: instance.simulateMaintenanceEvent
          action: store_true
          required: false
          type: bool
          help_text: |-
            Simulate a maintenance event.
          default: null
    - group:
        mutex: true
        help_text: |-
          Arguments for the  ondemand maintenance.
        params:
        - arg_name: ondemand-maintenance
          api_field: instance.ondemandMaintenance
          action: store_true
          required: false
          type: bool
          help_text: |-
            Ondemand maintenance for the instance.
          default: null
    - group:
        mutex: true
        help_text: |-
          Arguments for the  async instance endpoints deletion enabled.
        params:
        - arg_name: async-instance-endpoints-deletion-enabled
          api_field: instance.asyncInstanceEndpointsDeletionEnabled
          action: store_true
          required: false
          type: bool
          help_text: |-
            If true, instance endpoints that are created and registered by customers
            can be deleted asynchronously. That is, such an instance endpoint can be
            de-registered before the forwarding rules in the instance endpoint are
            deleted.
          default: null
    - group:
        mutex: true
        help_text: |-
          Arguments for the  kms key.
        params:
        - arg_name: kms-key
          help_text: |-
            The KMS key used to encrypt the at-rest data of the cluster.
          is_positional: false
          is_primary_resource: false
          resource_spec: !REF googlecloudsdk.command_lib.memorystore.v1_resources:projects_locations_key_rings_crypto_keys
          resource_method_params:
            instance.kmsKey: '{__relative_name__}'
          required: false
    - help_text: |-
        Identifier. Unique name of the instance.
        Format: projects/{project}/locations/{location}/instances/{instance}
      is_positional: true
      is_primary_resource: true
      request_id_field: instanceId
      resource_spec: !REF googlecloudsdk.command_lib.memorystore.v1_resources:projects_locations_instances
      required: true
    - arg_name: labels
      api_field: instance.labels
      required: false
      repeated: true
      help_text: |-
        Labels to represent user-provided metadata.
      spec:
      - api_field: key
      - api_field: value
    - arg_name: authorization-mode
      api_field: instance.authorizationMode
      required: false
      help_text: |-
        Authorization mode of the instance.
      choices:
      - arg_value: auth-disabled
        enum_value: AUTH_DISABLED
        help_text: |-
          Authorization disabled.
      - arg_value: iam-auth
        enum_value: IAM_AUTH
        help_text: |-
          IAM basic authorization.
    - arg_name: transit-encryption-mode
      api_field: instance.transitEncryptionMode
      required: false
      help_text: |-
        In-transit encryption mode of the instance.
      choices:
      - arg_value: transit-encryption-disabled
        enum_value: TRANSIT_ENCRYPTION_DISABLED
        help_text: |-
          In-transit encryption is disabled.
      - arg_value: server-authentication
        enum_value: SERVER_AUTHENTICATION
        help_text: |-
          Server-managed encryption is used for in-transit encryption.
    - arg_name: shard-count
      api_field: instance.shardCount
      required: false
      repeated: false
      type: int
      help_text: |-
        Number of shards for the instance.
    - arg_name: node-type
      api_field: instance.nodeType
      required: false
      help_text: |-
        Machine type for individual nodes of the instance.
      choices:
      - arg_value: shared-core-nano
        enum_value: SHARED_CORE_NANO
        help_text: |-
          Shared core nano.
      - arg_value: highmem-medium
        enum_value: HIGHMEM_MEDIUM
        help_text: |-
          High memory medium.
      - arg_value: highmem-xlarge
        enum_value: HIGHMEM_XLARGE
        help_text: |-
          High memory extra large.
      - arg_value: standard-small
        enum_value: STANDARD_SMALL
        help_text: |-
          Standard small.
    - group:
        api_field: instance.persistenceConfig
        required: false
        help_text: |-
          Represents persistence configuration for a instance.
        params:
        - arg_name: persistence-config-mode
          api_field: instance.persistenceConfig.mode
          required: false
          help_text: |-
            Current persistence mode.
          choices:
          - arg_value: disabled
            enum_value: DISABLED
            help_text: |-
              Persistence is disabled, and any snapshot data is deleted.
          - arg_value: rdb
            enum_value: RDB
            help_text: |-
              RDB based persistence is enabled.
          - arg_value: aof
            enum_value: AOF
            help_text: |-
              AOF based persistence is enabled.
        - group:
            api_field: instance.persistenceConfig.rdbConfig
            required: false
            help_text: |-
              Configuration for RDB based persistence.
            params:
            - arg_name: rdb-config-snapshot-period
              api_field: instance.persistenceConfig.rdbConfig.rdbSnapshotPeriod
              required: false
              help_text: |-
                Period between RDB snapshots.
              choices:
              - arg_value: one-hour
                enum_value: ONE_HOUR
                help_text: |-
                  One hour.
              - arg_value: six-hours
                enum_value: SIX_HOURS
                help_text: |-
                  Six hours.
              - arg_value: twelve-hours
                enum_value: TWELVE_HOURS
                help_text: |-
                  Twelve hours.
              - arg_value: twenty-four-hours
                enum_value: TWENTY_FOUR_HOURS
                help_text: |-
                  Twenty four hours.
            - arg_name: rdb-config-snapshot-start-time
              api_field: instance.persistenceConfig.rdbConfig.rdbSnapshotStartTime
              required: false
              repeated: false
              type: googlecloudsdk.core.util.times:ParseDateTime
              processor: googlecloudsdk.core.util.times:FormatDateTime
              help_text: |-
                Time that the first snapshot was/will be attempted, and to which future
                snapshots will be aligned. If not provided, the current time will be
                used.
        - group:
            api_field: instance.persistenceConfig.aofConfig
            required: false
            help_text: |-
              Configuration for AOF based persistence.
            params:
            - arg_name: aof-config-append-fsync
              api_field: instance.persistenceConfig.aofConfig.appendFsync
              required: false
              help_text: |-
                The fsync mode.
              choices:
              - arg_value: never
                enum_value: NEVER
                help_text: |-
                  Never fsync. Normally Linux will flush data every 30 seconds with this
                  configuration, but it's up to the kernel's exact tuning.
              - arg_value: every-sec
                enum_value: EVERY_SEC
                help_text: |-
                  Fsync every second. You may lose 1 second of data if there is a
                  disaster.
              - arg_value: always
                enum_value: ALWAYS
                help_text: |-
                  Fsync every time new write commands are appended to the AOF. The best
                  data loss protection at the cost of performance.
    - arg_name: engine-version
      api_field: instance.engineVersion
      required: false
      repeated: false
      help_text: |-
        Engine version of the instance.
    - arg_name: engine-configs
      api_field: instance.engineConfigs
      required: false
      repeated: true
      help_text: |-
        User-provided engine configurations for the instance.
      spec:
      - api_field: key
      - api_field: value
    - group:
        api_field: instance.zoneDistributionConfig
        required: false
        help_text: |-
          Zone distribution configuration for allocation of instance resources.
        params:
        - arg_name: zone-distribution-config
          api_field: instance.zoneDistributionConfig.zone
          required: false
          repeated: false
          help_text: |-
            Defines zone where all resources will be allocated with SINGLE_ZONE mode.
            Ignored for MULTI_ZONE mode.
        - arg_name: zone-distribution-config-mode
          api_field: instance.zoneDistributionConfig.mode
          required: false
          help_text: |-
            Current zone distribution mode. Defaults to MULTI_ZONE.
          choices:
          - arg_value: multi-zone
            enum_value: MULTI_ZONE
            help_text: |-
              Distribute resources across 3 zones picked at random within the
              region.
          - arg_value: single-zone
            enum_value: SINGLE_ZONE
            help_text: |-
              Provision resources in a single zone. Zone field must be specified.
    - arg_name: psc-auto-connections
      api_field: instance.pscAutoConnections
      required: false
      repeated: true
      help_text: |-
        Deprecated: Use the endpoints.connections.psc_auto_connection value
        instead.
      spec:
      - api_field: port
        one_of_index: 0
        help_text: |-
          port will only be set for Primary/Reader or Discovery endpoint.
      - api_field: projectId
        help_text: |-
          The consumer project_id where PSC connections are established.
          This should be the same project_id that the instance is being created in.
      - api_field: network
        resource_pattern: projects/{project}/global/networks/{network}
        help_text: |-
          The network where the PSC endpoints are created, in the form of
          projects/{project_id}/global/networks/{network_id}.
    - arg_name: endpoints
      api_field: instance.endpoints
      required: false
      repeated: true
      help_text: |-
        Endpoints for the instance.
      spec:
      - api_field: connections
        help_text: |-
          A group of PSC connections. They are created in the same VPC network, one
          for each service attachment in the cluster.
        spec:
        - api_field: pscAutoConnection
          one_of_index: 0
          help_text: |-
            Detailed information of a PSC connection that is created through
            service connectivity automation.
          spec:
          - api_field: port
            one_of_index: 0
            help_text: |-
              port will only be set for Primary/Reader or Discovery endpoint.
          - api_field: projectId
            help_text: |-
              The consumer project_id where PSC connections are established.
              This should be the same project_id that the instance is being created in.
          - api_field: network
            resource_pattern: projects/{project}/global/networks/{network}
            help_text: |-
              The network where the PSC endpoints are created, in the form of
              projects/{project_id}/global/networks/{network_id}.
    - arg_name: mode
      api_field: instance.mode
      required: false
      help_text: |-
        The mode config for the instance.
      choices:
      - arg_value: standalone
        enum_value: STANDALONE
        help_text: |-
          Deprecated: Use CLUSTER_DISABLED instead.
      - arg_value: cluster
        enum_value: CLUSTER
        help_text: |-
          Instance is in cluster mode.
      - arg_value: cluster-disabled
        enum_value: CLUSTER_DISABLED
        help_text: |-
          Cluster mode is disabled for the instance.
    - group:
        api_field: instance.maintenancePolicy
        required: false
        help_text: |-
          Maintenance policy per instance.
        params:
        - arg_name: maintenance-policy-weekly-window
          api_field: instance.maintenancePolicy.weeklyMaintenanceWindow
          required: false
          repeated: true
          help_text: |-
            Maintenance window that is applied to resources covered by this
            policy. Minimum 1. For the current version, the maximum number of
            weekly_window is expected to be one.
          spec:
          - api_field: day
            help_text: |-
              Allows to define schedule that runs specified day of the week.
          - api_field: startTime
            help_text: |-
              Start time of the window in UTC.
            spec:
            - api_field: hours
              help_text: |-
                Hours of a day in 24 hour format. Must be greater than or equal to 0 and
                typically must be less than or equal to 23. An API may choose to allow the
                value "24:00:00" for scenarios like business closing time.
            - api_field: minutes
              help_text: |-
                Minutes of an hour. Must be greater than or equal to 0 and less than or
                equal to 59.
            - api_field: seconds
              help_text: |-
                Seconds of a minute. Must be greater than or equal to 0 and typically must
                be less than or equal to 59. An API may allow the value 60 if it allows
                leap-seconds.
            - api_field: nanos
              help_text: |-
                Fractions of seconds, in nanoseconds. Must be greater than or equal to 0
                and less than or equal to 999,999,999.
    - group:
        api_field: instance.crossInstanceReplicationConfig
        required: false
        help_text: |-
          Cross instance replication config.
        params:
        - arg_name: cross-instance-replication-config-role
          api_field: instance.crossInstanceReplicationConfig.instanceRole
          required: true
          help_text: |-
            The role of the instance in cross instance replication.
          choices:
          - arg_value: none
            enum_value: NONE
            help_text: |-
              This instance does not participate in cross instance replication. It is
              an independent instance and does not replicate to or from any other
              instances.
          - arg_value: primary
            enum_value: PRIMARY
            help_text: |-
              A instance that allows both reads and writes. Any data written to this
              instance is also replicated to the attached secondary instances.
          - arg_value: secondary
            enum_value: SECONDARY
            help_text: |-
              A instance that allows only reads and replicates data from a primary
              instance.
        - group:
            api_field: instance.crossInstanceReplicationConfig.primaryInstance
            required: false
            help_text: |-
              Details of the remote instance associated with this instance in a cross
              instance replication setup.
            params:
            - arg_name: primary-instance
              help_text: |-
                The full resource path of the remote instance in
                the format: projects/<project>/locations/<region>/instances/<instance-id>
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.memorystore.v1_resources:projects_locations_instances
              resource_method_params:
                instance.crossInstanceReplicationConfig.primaryInstance.instance: '{__relative_name__}'
              required: false
        - arg_name: cross-instance-replication-config-secondary-instances
          api_field: instance.crossInstanceReplicationConfig.secondaryInstances
          required: false
          repeated: true
          help_text: |-
            List of secondary instances that are replicating from this primary
            instance.

            This field is only set for a primary instance.
          spec:
          - api_field: instance
            resource_pattern: projects/{project}/locations/{location}/instances/{instance}
            help_text: |-
              The full resource path of the remote instance in
              the format: projects/<project>/locations/<region>/instances/<instance-id>
    - group:
        api_field: instance.automatedBackupConfig
        required: false
        help_text: |-
          The automated backup config for an instance.
        params:
        - group:
            mutex: true
            help_text: |-
              Arguments for the schedule.
            params:
            - group:
                api_field: instance.automatedBackupConfig.fixedFrequencySchedule
                required: false
                help_text: |-
                  This schedule allows the backup to be triggered at a fixed frequency
                  (currently only daily is supported).
                params:
                - group:
                    api_field: instance.automatedBackupConfig.fixedFrequencySchedule.startTime
                    required: true
                    help_text: |-
                      Represents a time of day. The date and time zone are either not significant
                      or are specified elsewhere. An API may choose to allow leap seconds. Related
                      types are [google.type.Date][google.type.Date] and `google.protobuf.Timestamp`.
                    params:
                    - arg_name: fixed-frequency-schedule-start-time-hours
                      api_field: instance.automatedBackupConfig.fixedFrequencySchedule.startTime.hours
                      required: false
                      repeated: false
                      type: int
                      help_text: |-
                        Hours of a day in 24 hour format. Must be greater than or equal to 0 and
                        typically must be less than or equal to 23. An API may choose to allow the
                        value "24:00:00" for scenarios like business closing time.
                    - arg_name: fixed-frequency-schedule-start-time-minutes
                      api_field: instance.automatedBackupConfig.fixedFrequencySchedule.startTime.minutes
                      required: false
                      repeated: false
                      type: int
                      help_text: |-
                        Minutes of an hour. Must be greater than or equal to 0 and less than or
                        equal to 59.
                    - arg_name: fixed-frequency-schedule-start-time-seconds
                      api_field: instance.automatedBackupConfig.fixedFrequencySchedule.startTime.seconds
                      required: false
                      repeated: false
                      type: int
                      help_text: |-
                        Seconds of a minute. Must be greater than or equal to 0 and typically must
                        be less than or equal to 59. An API may allow the value 60 if it allows
                        leap-seconds.
                    - arg_name: fixed-frequency-schedule-start-time-nanos
                      api_field: instance.automatedBackupConfig.fixedFrequencySchedule.startTime.nanos
                      required: false
                      repeated: false
                      type: int
                      help_text: |-
                        Fractions of seconds, in nanoseconds. Must be greater than or equal to 0
                        and less than or equal to 999,999,999.
        - arg_name: automated-backup-config-mode
          api_field: instance.automatedBackupConfig.automatedBackupMode
          required: false
          help_text: |-
            The automated backup mode. If the mode is disabled, the other fields will
            be ignored.
          choices:
          - arg_value: disabled
            enum_value: DISABLED
            help_text: |-
              Automated backup config disabled.
          - arg_value: enabled
            enum_value: ENABLED
            help_text: |-
              Automated backup config enabled.
        - arg_name: automated-backup-config-retention
          api_field: instance.automatedBackupConfig.retention
          required: false
          repeated: false
          type: googlecloudsdk.core.util.times:ParseDuration
          processor: googlecloudsdk.core.util.times:FormatDurationForJson
          help_text: |-
            How long to keep automated backups before the backups are deleted. The
            value should be between 1 day and 365 days. If not specified, the default
            value is 35 days.
    - arg_name: allow-fewer-zones-deployment
      api_field: instance.allowFewerZonesDeployment
      action: store_true
      required: false
      type: bool
      hidden: true
      help_text: |-
        Allows customers to specify if they are okay with deploying a multi-zone
        instance in less than 3 zones. Once set, if there is a zonal outage during
        the instance creation, the instance will only be deployed in 2 zones, and
        stay within the 2 zones for its lifecycle.
      default: null
    - arg_name: request-id
      api_field: requestId
      required: false
      repeated: false
      help_text: |-
        An optional request ID to identify requests. Specify a unique request ID
        so that if you must retry your request, the server will know to ignore
        the request if it has already been completed. The server will guarantee
        that for at least 60 minutes since the first request.

        For example, consider a situation where you make an initial request and the
        request times out. If you make the request again with the same request
        ID, the server can check if original operation with the same request ID
        was received, and if so, will ignore the second request. This prevents
        clients from accidentally creating duplicate commitments.

        The request ID must be a valid UUID with the exception that zero UUID is
        not supported (00000000-0000-0000-0000-000000000000).
  request:
    api_version: v1
    collection:
    - memorystore.projects.locations.instances
  async:
    collection:
    - memorystore.projects.locations.operations
