release_tracks: [ALPHA, BETA, GA]
help_text:
  brief: |
    Create TrustConfig.
  description: |
    Create a TrustConfig.
  examples: |
      To create a TrustConfig from PEM certificate files, run:

        $ {command} my-trust-config --description="my description" --labels=my-key1=my-value1,my-key2=my-value2 --trust-store=trust-anchors=ta.pem,intermediate-cas="ica1.pem;ica2.pem"

request:
  collection: certificatemanager.projects.locations.trustConfigs
  api_version: v1

arguments:
  resource:
    spec: !REF googlecloudsdk.command_lib.certificate_manager.resources:trustConfig
    help_text: |
      Name of the TrustConfig to create.
  params:
  - arg_name: description
    api_field: trustConfig.description
    help_text: |
      Human-readable description of the resource.
  - arg_name: tags
    hidden: true
    api_field: trustConfig.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
  - group:
      required: true
      params:
      - arg_name: trust-store
        api_field: trustConfig.trustStores
        # If we allow multiple trust stores, they can be provided by repeating the --trust-store flag.
        # Example:
        #   gcloud certificate-manager trust-configs create NAME \
        #     --trust-store trust-anchors=ta.pem,intermediate-cas=ica.pem \
        #     --trust-store trust-anchors=ta2.pem,intermediate-cas=ica2.pem [...]
        # Include that in help_text when it happens.
        help_text: |
          Trust Store with the given trust anchor and intermediate CA PEM-encoded certificates.
          Certificates should be provided in files. For multiple file names, separate them by a semicolon (';') and quote them ('"').
          One file can contain multiple certificates.
          Intermediate CAs are optional.

          Examples:

            Single files: --trust-store trust-anchors=ta.pem,intermediate-cas=ica.pem

            No intermediate CAs: --trust-store trust-anchors=ta.pem

            Multiple files: --trust-store trust-anchors="ta1.pem;ta2.pem",intermediate-cas="ica1.pem;ica2.pem"
        type:
          arg_dict:
            flatten: false
            spec:
            - arg_name: trust-anchors
              api_field: trustAnchors
              type: "googlecloudsdk.command_lib.certificate_manager.arg_parsers:SemicolonSeparatedPemCertificatesFilesList:"
              required: true
            - arg_name: intermediate-cas
              api_field: intermediateCas
              type: "googlecloudsdk.command_lib.certificate_manager.arg_parsers:SemicolonSeparatedPemCertificatesFilesList:"
              required: false
      - arg_name: allowlisted-certificates
        api_field: trustConfig.allowlistedCertificates
        help_text: |
          Allowlisted PEM-encoded certificates.
          Certificates should be provided in files. For multiple file names, separate them by a comma (',').
          One file can contain multiple certificates.

          Examples:

            Single file: --allowlisted-certificates=ac.pem

            Multiple files: --allowlisted-certificates=ac1.pem,ac2.pem
        type: "googlecloudsdk.command_lib.certificate_manager.arg_parsers:CommaSeparatedPemCertificatesFilesList:"
  labels:
    api_field: trustConfig.labels

async:
  collection: certificatemanager.projects.locations.operations

output:
  format: yaml
