# flake8: noqa
# pylint: skip-file

DOCUMENTATION = '''
---
module: oc_secret
short_description: Module to manage openshift secrets
description:
  - Manage openshift secrets programmatically.
options:
  state:
    description:
    - State controls the action that will be taken with resource
    - present - the secret will be created if it doesn't exist or updated if different.
    - absent - the secret will be removed if present.
    - list - information about the secret will be gathered and returned as part of the Ansible call results.
    required: false
    default: present
    choices: ["present", "absent", "list"]
    aliases: []
  kubeconfig:
    description:
    - The path for the kubeconfig file to use for authentication
    required: false
    default: /etc/origin/master/admin.kubeconfig
    aliases: []
  debug:
    description:
    - Turn on debug output.
    required: false
    default: False
    aliases: []
  name:
    description:
    - Name of the object that is being queried.
    required: false
    default: None
    aliases: []
  namespace:
    description:
    - The namespace where the object lives.
    required: false
    default: default
    aliases: []
  annotations:
    description:
    - Annotations to apply to the object
    required: false
    default: None
    aliases: []
  files:
    description:
    - A list of files provided for secrets
    required: false
    default: None
    aliases: []
  delete_after:
    description:
    - Whether or not to delete the files after processing them.
    required: false
    default: false
    aliases: []
  contents:
    description:
    - Content of the secrets
    required: false
    default: None
    aliases: []
  type:
    description:
    - The secret type.
    required: false
    default: None
    aliases: []
  force:
    description:
    - Whether or not to force the operation
    required: false
    default: false
    aliases: []
  decode:
    description:
    - base64 decode the object
    required: false
    default: false
    aliases: []
author:
- "Kenny Woodson <kwoodson@redhat.com>"
extends_documentation_fragment: []
'''

EXAMPLES = '''
- name: create secret
  oc_secret:
    state: present
    namespace: openshift-infra
    name: metrics-deployer
    files:
    - name: nothing
      path: /dev/null
  register: secretout
  run_once: true

- name: get ca from hawkular
  oc_secret:
    state: list
    namespace: openshift-infra
    name:  hawkular-metrics-certificate
    decode: True
  register: hawkout
  run_once: true

- name: Create secrets
  oc_secret:
    namespace: mynamespace
    name: mysecrets
    contents:
    - path: data.yml
      data: "{{ data_content }}"
    - path: auth-keys
      data: "{{ auth_keys_content }}"
    - path: configdata.yml
      data: "{{ configdata_content }}"
    - path: cert.crt
      data: "{{ cert_content }}"
    - path: key.pem
      data: "{{ osso_site_key_content }}"
    - path: ca.cert.pem
      data: "{{ ca_cert_content }}"
  register: secretout
'''
