name: "example_s3"
description: "Exordos example S3 element"
schema_version: 1
version: "0.0.1-dev+20260520104257.42c86574"
api_version: "v1"

requirements:
  core:
    from_version: "0.0.0"
  s3aas:
    from_version: "0.0.0"

resources:

  $s3aas.types.s3.instances:
    example_s3:
      name: "example-s3"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      cpu: $example_s3.imports.$var_default_cores:value
      ram: $example_s3.imports.$var_default_ram:value
      disk_size: 50
      nodes_number: 1
      kind: "single_node"
      version: $example_s3.imports.$rustfs_1:uuid

  $s3aas.types.s3.instances.$example_s3.policies:
    test_user_policy:
      name: "test-user-policy"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $s3aas.types.s3.instances.$example_s3:uuid
      content:
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Action:
              - "s3:GetObject"
              - "s3:PutObject"
              - "s3:DeleteObject"
              - "s3:ListBucket"
            Resource:
              - f"arn:aws:s3:::{$s3aas.types.s3.instances.$example_s3.buckets.$test_bucket:name}"
              - f"arn:aws:s3:::{$s3aas.types.s3.instances.$example_s3.buckets.$test_bucket:name}/*"
    compliance_user_policy:
      name: "compliance-user-policy"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $s3aas.types.s3.instances.$example_s3:uuid
      content:
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Action:
              - "s3:GetObject"
              - "s3:PutObject"
              - "s3:DeleteObject"
              - "s3:ListBucket"
            Resource:
              - f"arn:aws:s3:::{$s3aas.types.s3.instances.$example_s3.buckets.$compliance_bucket:name}"
              - f"arn:aws:s3:::{$s3aas.types.s3.instances.$example_s3.buckets.$compliance_bucket:name}/*"

  $s3aas.types.s3.instances.$example_s3.users:
    test_user:
      name: "test-user"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $s3aas.types.s3.instances.$example_s3:uuid
    compliance_user:
      name: "compliance-user"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $s3aas.types.s3.instances.$example_s3:uuid

  $s3aas.types.s3.instances.$example_s3.users.$test_user.policies:
    test_user_policy_attachment:
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      policy: $s3aas.types.s3.instances.$example_s3.policies.$test_user_policy:uuid
      user: $s3aas.types.s3.instances.$example_s3.users.$test_user:uuid
      instance: $s3aas.types.s3.instances.$example_s3:uuid

  $s3aas.types.s3.instances.$example_s3.users.$compliance_user.policies:
    compliance_user_policy_attachment:
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      policy: $s3aas.types.s3.instances.$example_s3.policies.$compliance_user_policy:uuid
      user: $s3aas.types.s3.instances.$example_s3.users.$compliance_user:uuid
      instance: $s3aas.types.s3.instances.$example_s3:uuid

  $s3aas.types.s3.instances.$example_s3.users.$test_user.access_keys:
    test_user_access_key:
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      access_key: $core.secret.passwords.$s3aas_test_access_key:value
      secret_key: $core.secret.passwords.$s3aas_test_secret_key:value
      user: $s3aas.types.s3.instances.$example_s3.users.$test_user:uuid
      instance: $s3aas.types.s3.instances.$example_s3:uuid

  $s3aas.types.s3.instances.$example_s3.users.$compliance_user.access_keys:
    compliance_user_access_key:
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      access_key: $core.secret.passwords.$s3aas_compliance_access_key:value
      secret_key: $core.secret.passwords.$s3aas_compliance_secret_key:value
      user: $s3aas.types.s3.instances.$example_s3.users.$compliance_user:uuid
      instance: $s3aas.types.s3.instances.$example_s3:uuid

  $core.secret.passwords:
    s3aas_test_access_key:
      name: s3aas_test_access_key
      description: "S3aaS test access key"
      default_length: 20
      constructor:
        kind: plain
      method: AUTO_HEX
    s3aas_test_secret_key:
      name: s3aas_test_secret_key
      description: "S3aaS test secret key"
      default_length: 40
      constructor:
        kind: plain
      method: AUTO_HEX
    s3aas_compliance_access_key:
      name: s3aas_compliance_access_key
      description: "S3aaS compliance user access key"
      default_length: 20
      constructor:
        kind: plain
      method: AUTO_HEX
    s3aas_compliance_secret_key:
      name: s3aas_compliance_secret_key
      description: "S3aaS compliance user secret key"
      default_length: 40
      constructor:
        kind: plain
      method: AUTO_HEX

  $s3aas.types.s3.instances.$example_s3.buckets:
    test_bucket:
      name: "test-bucket"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $s3aas.types.s3.instances.$example_s3:uuid
      versioning_enabled: false
      quota_bytes: 0
      object_lock_enabled: false
      public: true
    compliance_bucket:
      name: "compliance-bucket"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $s3aas.types.s3.instances.$example_s3:uuid
      versioning_enabled: true
      quota_bytes: 0
      object_lock_enabled: true
      public: false
      default_retention_mode: "COMPLIANCE"
      default_retention_days: 30

imports:
  rustfs_1:
    element: "$s3aas"
    kind: "resource"
    link: "$s3aas.types.s3.versions.$rustfs_1"
  var_default_cores:
    element: "$core"
    kind: "resource"
    link: "$core.vs.variables.$default_cores"
  var_default_ram:
    element: "$core"
    kind: "resource"
    link: "$core.vs.variables.$default_ram"

exports:
  instance:
    link: "$s3aas.types.s3.instances.$example_s3"
  test_user:
    link: "$s3aas.types.s3.instances.$example_s3.users.$test_user"
  compliance_user:
    link: "$s3aas.types.s3.instances.$example_s3.users.$compliance_user"
  test_bucket:
    link: "$s3aas.types.s3.instances.$example_s3.buckets.$test_bucket"
  compliance_bucket:
    link: "$s3aas.types.s3.instances.$example_s3.buckets.$compliance_bucket"