metadata:
  name: abapEnvironmentCreateSystem
  description: Creates a SAP BTP ABAP Environment system (aka Steampunk system)
  longDescription: |
    This step creates a SAP BTP ABAP Environment system (aka Steampunk system) via the cloud foundry command line interface (cf CLI). This can be done by providing a service manifest as a configuration file (parameter `serviceManifest`) or by passing the configuration values directly via the other parameters of this step.

spec:
  inputs:
    secrets:
      - name: cfCredentialsId
        description: Jenkins 'Username with password' credentials ID containing user and password to authenticate to the Cloud Foundry API.
        type: jenkins
        aliases:
          - name: cloudFoundry/credentialsId
    params:
      - name: cfApiEndpoint
        type: string
        description: Cloud Foundry API endpoint
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: true
        aliases:
          - name: cloudFoundry/apiEndpoint
        default: "https://api.cf.eu10.hana.ondemand.com"
      - name: username
        type: string
        description: User or E-Mail for CF
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
        secret: true
        resourceRef:
          - name: cfCredentialsId
            type: secret
            param: username
          - type: vaultSecret
            name: cloudfoundryVaultSecretName
            default: cloudfoundry-$(org)-$(space)
      - name: password
        type: string
        description: Password for Cloud Foundry User
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
        secret: true
        resourceRef:
          - name: cfCredentialsId
            type: secret
            param: password
          - type: vaultSecret
            name: cloudfoundryVaultSecretName
            default: cloudfoundry-$(org)-$(space)
      - name: cfOrg
        type: string
        description: Cloud Foundry org
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: true
        aliases:
          - name: cloudFoundry/org
      - name: cfSpace
        type: string
        description: Cloud Foundry Space
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: true
        aliases:
          - name: cloudFoundry/space
      - name: cfService
        type: string
        description: Parameter for Cloud Foundry Service to be used for creating Cloud Foundry Service
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: false
        aliases:
          - name: cloudFoundry/service
      - name: cfServicePlan
        type: string
        description: Parameter for Cloud Foundry Service Plan to be used when creating a Cloud Foundry Service
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: false
        aliases:
          - name: cloudFoundry/servicePlan
      - name: cfServiceInstance
        type: string
        description: Parameter for naming the Service Instance when creating a Cloud Foundry Service
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: false
        aliases:
          - name: cloudFoundry/serviceInstance
      - name: serviceManifest
        type: string
        description: Path to Cloud Foundry Service Manifest in YAML format for multiple service creations that are being passed to a Create-Service-Push Cloud Foundry cli plugin
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        mandatory: false
        aliases:
          - name: cloudFoundry/serviceManifest
          - name: cfServiceManifest
      - name: abapSystemAdminEmail
        type: string
        description: Admin E-Mail address for the initial administrator of the system
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
      - name: abapSystemDescription
        description: Description for the ABAP Environment system
        type: string
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        default: 'Test system created by an automated pipeline'
      - name: abapSystemIsDevelopmentAllowed
        type: bool
        description: This parameter determines, if development is allowed on the system
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        default: true
      - name: abapSystemID
        description: The three character name of the system - maps to 'sapSystemName'
        type: string
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
        default: 'H02'
      - name: abapSystemSizeOfPersistence
        description: The size of the persistence
        type: int
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
      - name: abapSystemSizeOfRuntime
        description: The size of the runtime
        type: int
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
      - name: addonDescriptorFileName
        description: The file name of the addonDescriptor
        type: string
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
          - GENERAL
      - name: includeAddon
        description: Must be set to true to install the addon provided via 'addonDescriptorFileName'
        type: bool
        scope:
          - PARAMETERS
          - STAGES
        default: false
  containers:
    - name: cf
      image: ppiper/cf-cli:7
