executor: pf_api_pki_profiles_users
input:
  ca_id: ""
  name: ""
  validity: ""
  key_type: ""
  digest: ""
  key_usage: ""
  extended_key_usage: ""
  key_size: ""
  organisational_unit: ""
  organisation: ""
  country: ""
  state: ""
  locality: ""
  ocsp_url: ""
  scep_enabled: ""
  scep_challenge_password: ""
  scep_days_before_renewal: ""
steps:
- type: get_login_token

- type: http
  method: POST
  url: '{{.pfserver_webadmin_url}}/api/v1/pki/profiles'
  ignore_verify_ssl: true
  body: >-
    {
      "ca_id": "{{.input.ca_id}}",
      "name": "{{.input.name}}",
      "validity": "{{.input.validity}}",
      "key_type": "{{.input.key_type}}",
      "digest": "{{.input.digest}}",
      "key_usage": "{{.input.key_usage}}",
      "extended_key_usage": "{{.input.extended_key_usage}}",
      "key_size": "{{.input.key_size}}",
      "organisational_unit": "{{.input.organisational_unit}}",
      "organisation": "{{.input.organisation}}",
      "country": "{{.input.country}}",
      "state": "{{.input.state}}",
      "locality": "{{.input.locality}}",
      "ocsp_url": "{{.input.ocsp_url}}",
      "scep_enabled": {{.input.scep_enabled}},
      "scep_challenge_password": "{{.input.scep_challenge_password}}",
      "scep_days_before_renewal": "{{.input.scep_days_before_renewal}}"
    }
  headers:
    "Authorization": "{{.result.token}}"
    "Content-Type": "application/json"
  assertions:
    - result.statuscode ShouldEqual 200
    - result.bodyjson.__type__ ShouldEqual Map
  vars:
    profiles_tmp:
      from: result.bodyjson

output:
  pf_api_pki_profiles_id: "{{.profiles_tmp.items.items0.id}}"
