def Args(parser): reusable_config_group = parser.add_group( mutex=True, required=False, help='The X.509 configuration used for the CA certificate.') concept_parsers.ConceptParser([ presentation_specs.ResourcePresentationSpec( 'CERTIFICATE_AUTHORITY', privateca_resource_args.CreateCertificateAuthorityResourceSpec( 'Certificate Authority'), 'The name of the root CA to create.', required=True, # We'll get these from the KMS key resource. flag_name_overrides={ 'location': '', 'project': '', }), presentation_specs.ResourcePresentationSpec( '--kms-key-version', kms_resource_args.GetKmsKeyVersionResourceSpec(), 'The KMS key version backing this CA.', required=True), presentation_specs.ResourcePresentationSpec( '--reusable-config', privateca_resource_args.CreateReusableConfigResourceSpec( location_fallthrough=deps.Fallthrough( function=lambda: '', hint=('location will default to the same location as ' 'the CA'), active=False, plural=False)), 'The Reusable Config containing X.509 values for this CA.', flag_name_overrides={ 'location': '', 'project': '', }, group=reusable_config_group) ]).AddToParser(parser) flags.AddSubjectFlags(parser, subject_required=True) flags.AddPublishCaCertFlag(parser, use_update_help_text=False) flags.AddPublishCrlFlag(parser, use_update_help_text=False) flags.AddInlineReusableConfigFlags(reusable_config_group, is_ca=True) flags.AddValidityFlag(parser, resource_name='CA', default_value='P10Y', default_value_text='10 years') flags.AddCertificateAuthorityIssuancePolicyFlag(parser) labels_util.AddCreateLabelsFlags(parser)
def Args(parser): reusable_config_group = parser.add_group( mutex=True, required=False, help='The X.509 configuration used for the CA certificate.') issuer_configuration_group = parser.add_group( mutex=True, required=True, help='The issuer configuration used for this CA certificate.') concept_parsers.ConceptParser([ presentation_specs.ResourcePresentationSpec( 'CERTIFICATE_AUTHORITY', privateca_resource_args.CreateCertificateAuthorityResourceSpec( 'Certificate Authority'), 'The name of the subordinate CA to create.', required=True, # We'll get these from the KMS key resource. flag_name_overrides={ 'location': '', 'project': '', }), presentation_specs.ResourcePresentationSpec( '--issuer', privateca_resource_args.CreateCertificateAuthorityResourceSpec( 'Issuer'), 'The issuing certificate authority to use, if it is on Private CA.', prefixes=True, group=issuer_configuration_group), presentation_specs.ResourcePresentationSpec( '--kms-key-version', kms_resource_args.GetKmsKeyVersionResourceSpec(), 'The KMS key version backing this CA.', required=True), presentation_specs.ResourcePresentationSpec( '--reusable-config', privateca_resource_args.CreateReusableConfigResourceSpec( location_fallthrough=deps.Fallthrough( function=lambda: '', hint=( 'location will default to the same location as the ' 'CA'), active=False, plural=False)), 'The Reusable Config containing X.509 values for this CA.', flag_name_overrides={ 'location': '', 'project': '', }, group=reusable_config_group) ]).AddToParser(parser) flags.AddSubjectFlags(parser, subject_required=True) flags.AddPublishCaCertFlag(parser, use_update_help_text=False) flags.AddPublishCrlFlag(parser, use_update_help_text=False) flags.AddInlineReusableConfigFlags(reusable_config_group, is_ca=True) flags.AddValidityFlag(parser, resource_name='CA', default_value='P10Y', default_value_text='10 years') flags.AddCertificateAuthorityIssuancePolicyFlag(parser) labels_util.AddCreateLabelsFlags(parser) offline_issuer_group = issuer_configuration_group.add_group(help=( 'If the issuing CA is not hosted on Private CA, you must provide ' 'these settings:')) base.Argument( '--create-csr', help= ('Indicates that a CSR should be generated which can be signed by ' 'the issuing CA. This must be set if --issuer is not provided.'), action='store_const', const=True, default=False, required=True).AddToParser(offline_issuer_group) base.Argument( '--csr-output-file', help=( 'The path where the resulting PEM-encoded CSR file should be ' 'written.'), required=True).AddToParser(offline_issuer_group)