-
Notifications
You must be signed in to change notification settings - Fork 2
/
access-token.go
55 lines (44 loc) · 1.33 KB
/
access-token.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package resources
import (
"context"
"strconv"
"github.com/CheckPointSW/terraform-provider-infinity-next/internal/api"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func ResourceAccessToken() *schema.Resource {
return &schema.Resource{
Description: "Access Token",
CreateContext: resourceAccessTokenCreate,
ReadContext: resourceAccessTokenRead,
UpdateContext: resourceAccessTokenUpdate,
DeleteContext: resourceAccessTokenDelete,
Schema: map[string]*schema.Schema{
"value": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Sensitive: true,
},
},
}
}
func resourceAccessTokenCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
var diags diag.Diagnostics
c := meta.(*api.Client)
token := c.GetToken()
d.SetId(strconv.Itoa(schema.HashString(token)))
d.Set("value", token)
return diags
}
func resourceAccessTokenRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
return nil
}
func resourceAccessTokenUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
return nil
}
func resourceAccessTokenDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
var diags diag.Diagnostics
d.SetId("")
return diags
}