File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
docs/examples/storage/preauthrequests Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ variable "bucket_name" {}
20
20
variable "object_name" {}
21
21
22
22
provider "baremetal" {
23
- region = " us-phoenix-1"
24
- alias = " phx"
25
23
tenancy_ocid = " ${ var . tenancy_ocid } "
26
24
user_ocid = " ${ var . user_ocid } "
27
25
fingerprint = " ${ var . fingerprint } "
@@ -45,3 +43,11 @@ resource "baremetal_objectstorage_preauthrequest" "parOnObject" {
45
43
access_type = " ObjectRead" // Other configurations accepted are ObjectWrite, ObjectReadWrite
46
44
time_expires = " 2019-11-10T23:00:00Z"
47
45
}
46
+
47
+ output "par_request_url" {
48
+ value = " ${ baremetal_objectstorage_preauthrequest . parOnObject . access_uri } "
49
+ }
50
+
51
+ output "par_request_name" {
52
+ value = " ${ baremetal_objectstorage_preauthrequest . parOnObject . name } "
53
+ }
Original file line number Diff line number Diff line change @@ -102,14 +102,18 @@ var preauthenticatedRequestSchema = map[string]*schema.Schema{
102
102
"access_type" : {
103
103
Type : schema .TypeString ,
104
104
Computed : false ,
105
- Default : baremetal .ObjectRead ,
106
- Optional : true ,
105
+ Required : true ,
107
106
ValidateFunc : validation .StringInSlice ([]string {
108
107
string (baremetal .PARAnyObjectWrite ),
109
108
string (baremetal .PARObjectRead ),
110
109
string (baremetal .PARObjectReadWrite ),
111
110
string (baremetal .ObjectRead )}, true ),
112
111
},
112
+ "access_uri" : {
113
+ Type : schema .TypeString ,
114
+ Computed : true ,
115
+ Optional : true ,
116
+ },
113
117
"time_expires" : {
114
118
Type : schema .TypeString ,
115
119
Computed : false ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
15
15
type PreauthenticatedRequestResourceCrud struct {
16
16
crud.BaseCrud
17
17
Id string
18
+ Name string
18
19
Namespace string
19
20
BucketName string
20
21
ObjectName string
@@ -76,7 +77,9 @@ func (s *PreauthenticatedRequestResourceCrud) SetData() {
76
77
s .D .Set ("object" , s .ObjectName )
77
78
s .D .Set ("time_expires" , s .TimeExpires .Format (time .RFC3339 ))
78
79
s .D .Set ("access_type" , s .AccessType )
80
+ s .D .Set ("access_uri" , s .AccessURI )
79
81
s .D .Set ("id" , s .ID )
82
+ s .D .Set ("name" , s .Name )
80
83
}
81
84
82
85
func (s * PreauthenticatedRequestResourceCrud ) Create () (e error ) {
@@ -111,6 +114,7 @@ func (s *PreauthenticatedRequestResourceCrud) Create() (e error) {
111
114
s .Namespace = namespace
112
115
s .BucketName = bucket
113
116
s .ObjectName = object
117
+ s .Name = res .Name
114
118
return
115
119
}
116
120
@@ -128,13 +132,15 @@ func (s *PreauthenticatedRequestResourceCrud) Get() (e error) {
128
132
}
129
133
130
134
s .Id = res .ID
135
+ //Access URI is only accessible on create
131
136
s .AccessURI = ""
132
137
s .TimeCreated = res .TimeCreated
133
138
s .TimeExpires = res .TimeExpires
134
139
s .AccessType = res .AccessType
135
140
s .Namespace = namespace
136
141
s .BucketName = bucket
137
142
s .ObjectName = res .ObjectName
143
+ s .Name = res .Name
138
144
139
145
return
140
146
}
You can’t perform that action at this time.
0 commit comments