- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief: Create a Certificate Issuance Config.
    description: |
      Create a new Certificate Issuance Config.
    examples: |
      To create a Certificate Issuance Config called `my-cic`, run:

        $ {command} my-cic --ca-pool=my-ca-pool

  request:
    collection: certificatemanager.projects.locations.certificateIssuanceConfigs
    api_version: v1
    modify_request_hooks:
    - googlecloudsdk.command_lib.certificate_manager.hooks:SetCAPoolURL

  async:
    collection: certificatemanager.projects.locations.operations

  arguments:
    resource:
      help_text: Name of the Certificate Issuance Config to create.
      spec: !REF googlecloudsdk.command_lib.certificate_manager.resources:certificateIssuanceConfig

    params:
    - arg_name: description
      api_field: certificateIssuanceConfig.description
      help_text: |
        Human-readable description of the resource.
    - arg_name: ca-pool
      api_field: certificateIssuanceConfig.certificateAuthorityConfig.certificateAuthorityServiceConfig.caPool
      required: true
      help_text: |
        CA Pool used for issuing certificates. For example:

         $ {command} --ca-pool=projects/test-project/locations/us-west1/caPools/my-ca-pool
    - arg_name: lifetime
      api_field: certificateIssuanceConfig.lifetime
      processor: googlecloudsdk.command_lib.certificate_manager.hooks:ParseIso8601LifetimeFlag
      default: P30D
      help_text: |
        Lifetime of issued certificates in ISO 8601 format. Use `gcloud topic datetimes` for details. Defaults to `P30D`.
    - arg_name: rotation-window-percentage
      api_field: certificateIssuanceConfig.rotationWindowPercentage
      default: 66
      help_text: |
        How long along the lifetime of the ceritificate to renew, expressed as a percentage. Defaults to `66`.
    - arg_name: key-algorithm
      api_field: certificateIssuanceConfig.keyAlgorithm
      default: "rsa-2048"
      help_text: |
        Key algorithm to use when generating the private key. Defaults to `rsa-2048`.
      choices:
      - arg_value: "rsa-2048"
        enum_value: RSA_2048
      - arg_value: "ecdsa-p256"
        enum_value: ECDSA_P256
    - arg_name: tags
      hidden: true
      api_field: certificateIssuanceConfig.tags.additionalProperties
      metavar: KEY=VALUE
      help_text: |
        List of tag KEY=VALUE pairs to add.
      type:
        arg_dict:
          flatten: true
          spec:
          - api_field: key
          - api_field: value
    labels:
      api_field: certificateIssuanceConfig.labels
