|
| 1 | +package rdb |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" |
| 6 | + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" |
| 7 | + |
| 8 | + "github.com/scaleway/terraform-provider-scaleway/v2/internal/cdf" |
| 9 | + "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional" |
| 10 | + "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify" |
| 11 | +) |
| 12 | + |
| 13 | +func ResourceSnapshot() *schema.Resource { |
| 14 | + return &schema.Resource{ |
| 15 | + CreateContext: ResourceRdbSnapshotCreate, |
| 16 | + ReadContext: ResourceRdbSnapshotRead, |
| 17 | + DeleteContext: ResourceRdbSnapshotDelete, |
| 18 | + Timeouts: &schema.ResourceTimeout{ |
| 19 | + Create: schema.DefaultTimeout(defaultInstanceTimeout), |
| 20 | + Read: schema.DefaultTimeout(defaultInstanceTimeout), |
| 21 | + Delete: schema.DefaultTimeout(defaultInstanceTimeout), |
| 22 | + }, |
| 23 | + Importer: &schema.ResourceImporter{ |
| 24 | + StateContext: schema.ImportStatePassthroughContext, |
| 25 | + }, |
| 26 | + Schema: map[string]*schema.Schema{ |
| 27 | + "instance_id": { |
| 28 | + Type: schema.TypeString, |
| 29 | + Required: true, |
| 30 | + ForceNew: true, |
| 31 | + ValidateDiagFunc: verify.IsUUIDorUUIDWithLocality(), |
| 32 | + Description: "UUID of the Database Instance on which the snapshot is applied.", |
| 33 | + }, |
| 34 | + "name": { |
| 35 | + Type: schema.TypeString, |
| 36 | + Required: true, |
| 37 | + Description: "Name of the snapshot.", |
| 38 | + }, |
| 39 | + "expires_at": { |
| 40 | + Type: schema.TypeString, |
| 41 | + Optional: true, |
| 42 | + Description: "Expiration date of the snapshot in ISO 8601 format (RFC 3339).", |
| 43 | + }, |
| 44 | + "status": { |
| 45 | + Type: schema.TypeString, |
| 46 | + Computed: true, |
| 47 | + Description: "Status of the snapshot.", |
| 48 | + }, |
| 49 | + "size": { |
| 50 | + Type: schema.TypeInt, |
| 51 | + Computed: true, |
| 52 | + Description: "Size of the snapshot in bytes.", |
| 53 | + }, |
| 54 | + "region": regional.Schema(), |
| 55 | + }, |
| 56 | + CustomizeDiff: cdf.LocalityCheck("instance_id"), |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +func ResourceRdbSnapshotCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { |
| 61 | + |
| 62 | + return ResourceRdbSnapshotRead(ctx, d, meta) |
| 63 | +} |
| 64 | + |
| 65 | +func ResourceRdbSnapshotRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { |
| 66 | + |
| 67 | + return nil |
| 68 | +} |
| 69 | + |
| 70 | +func ResourceRdbSnapshotDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { |
| 71 | + |
| 72 | + return nil |
| 73 | +} |
0 commit comments