Skip to content

Commit 1643fe1

Browse files
author
Nishu Goel
committed
chore: regenerate
1 parent aa903ee commit 1643fe1

File tree

11 files changed

+39
-76
lines changed

11 files changed

+39
-76
lines changed

.speakeasy/gen.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
lockVersion: 2.0.0
22
id: 11c8545a-deb6-44f9-ba56-e71722af6a51
33
management:
4-
docChecksum: 52280de5e93518a397dee501c112aa85
4+
docChecksum: 3780fdcf1eaa7ff90e168c8860933918
55
docVersion: 0.1.0
66
speakeasyVersion: internal
77
generationVersion: 2.230.1
8-
releaseVersion: 0.1.0
9-
configChecksum: 6914b581da3883c7a6701e489c87b0b6
8+
releaseVersion: 0.1.1
9+
configChecksum: 93783df6f159019bb6bc9e23462019c4
1010
repoURL: https://github.com/epilot-dev/terraform-provider-epilot-file.git
1111
repoSubDirectory: .
1212
published: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ terraform {
5959
required_providers {
6060
epilot-file = {
6161
source = "epilot-dev/epilot-file"
62-
version = "0.1.0"
62+
version = "0.1.1"
6363
}
6464
}
6565
}

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ terraform {
1717
required_providers {
1818
epilot-file = {
1919
source = "epilot-dev/epilot-file"
20-
version = "0.1.0"
20+
version = "0.1.1"
2121
}
2222
}
2323
}

docs/resources/file.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ resource "epilot-file_file" "my_file" {
1919
bucket = "epilot-files-prod"
2020
custom_download_url = "https://both-legging.net"
2121
document_type = "archive"
22-
entity_id = "ef7d985c-2385-44f4-9c71-ae06a52264f8"
2322
file_entity_id = "...my_file_entity_id..."
2423
filename = "document.pdf"
2524
key = "123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
26-
schema = "contact"
2725
tags = [
2826
"...",
2927
]
@@ -36,7 +34,6 @@ resource "epilot-file_file" "my_file" {
3634
### Required
3735

3836
- `bucket` (String) Requires replacement if changed.
39-
- `entity_id` (String) Requires replacement if changed.
4037
- `filename` (String) Requires replacement if changed.
4138
- `key` (String) Requires replacement if changed.
4239

@@ -47,7 +44,6 @@ resource "epilot-file_file" "my_file" {
4744
- `custom_download_url` (String) Custom external download url used for the file. Requires replacement if changed.
4845
- `document_type` (String) Requires replacement if changed. ; must be one of ["document", "document_template", "text", "image", "video", "audio", "spreadsheet", "presentation", "font", "archive", "application", "unknown"]
4946
- `file_entity_id` (String) if passed, adds a new version to existing file entity. Requires replacement if changed.
50-
- `schema` (String) URL-friendly identifier for the entity schema. Requires replacement if changed.
5147
- `tags` (List of String) Requires replacement if changed.
5248

5349
### Read-Only

examples/provider/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
epilot-file = {
44
source = "epilot-dev/epilot-file"
5-
version = "0.1.0"
5+
version = "0.1.1"
66
}
77
}
88
}

examples/resources/epilot-file_file/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
epilot-file = {
44
source = "epilot-dev/epilot-file"
5-
version = "2.0.2"
5+
version = "2.1.1"
66
}
77
}
88
}
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
resource "epilot-file_file" "my_file" {
2-
access_control = "public-read"
3-
additional_properties = "{ \"see\": \"documentation\" }"
4-
bucket = "epilot-files-prod"
5-
custom_download_url = "https://both-legging.net"
6-
document_type = "archive"
7-
entity_id = "ef7d985c-2385-44f4-9c71-ae06a52264f8"
8-
file_entity_id = "...my_file_entity_id..."
9-
filename = "document.pdf"
10-
key = "123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
11-
schema = "contact"
12-
tags = [
13-
"...",
14-
]
2+
access_control = "private"
3+
filename = "blaaa.png"
4+
bucket = "epilot-prod-user-content"
5+
key = "66/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/nishu.png"
156
}

gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ go:
2323
outputModelSuffix: output
2424
packageName: openapi
2525
terraform:
26-
version: 0.1.0
26+
version: 0.1.1
2727
author: epilot-dev
2828
imports:
2929
option: openapi

internal/provider/file_resource.go

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ type FileResourceModel struct {
4242
Bucket types.String `tfsdk:"bucket"`
4343
CustomDownloadURL types.String `tfsdk:"custom_download_url"`
4444
DocumentType types.String `tfsdk:"document_type"`
45-
EntityID types.String `tfsdk:"entity_id"`
4645
FileEntityID types.String `tfsdk:"file_entity_id"`
4746
Filename types.String `tfsdk:"filename"`
4847
Key types.String `tfsdk:"key"`
4948
MimeType types.String `tfsdk:"mime_type"`
5049
PublicURL types.String `tfsdk:"public_url"`
51-
Schema types.String `tfsdk:"schema"`
5250
SizeBytes types.Int64 `tfsdk:"size_bytes"`
5351
Tags []types.String `tfsdk:"tags"`
5452
Type types.String `tfsdk:"type"`
@@ -129,13 +127,6 @@ func (r *FileResource) Schema(ctx context.Context, req resource.SchemaRequest, r
129127
),
130128
},
131129
},
132-
"entity_id": schema.StringAttribute{
133-
PlanModifiers: []planmodifier.String{
134-
stringplanmodifier.RequiresReplaceIfConfigured(),
135-
},
136-
Required: true,
137-
Description: `Requires replacement if changed. `,
138-
},
139130
"file_entity_id": schema.StringAttribute{
140131
PlanModifiers: []planmodifier.String{
141132
stringplanmodifier.RequiresReplaceIfConfigured(),
@@ -166,13 +157,6 @@ func (r *FileResource) Schema(ctx context.Context, req resource.SchemaRequest, r
166157
Computed: true,
167158
Description: `Direct URL for file (public only if file access control is public-read)`,
168159
},
169-
"schema": schema.StringAttribute{
170-
PlanModifiers: []planmodifier.String{
171-
stringplanmodifier.RequiresReplaceIfConfigured(),
172-
},
173-
Optional: true,
174-
Description: `URL-friendly identifier for the entity schema. Requires replacement if changed. `,
175-
},
176160
"size_bytes": schema.Int64Attribute{
177161
Computed: true,
178162
Description: `File size in bytes`,
@@ -299,26 +283,9 @@ func (r *FileResource) Create(ctx context.Context, req resource.CreateRequest, r
299283
fileEntityID = nil
300284
}
301285
filename := data.Filename.ValueString()
302-
schema := new(string)
303-
if !data.Schema.IsUnknown() && !data.Schema.IsNull() {
304-
*schema = data.Schema.ValueString()
305-
} else {
306-
schema = nil
307-
}
308-
var tags1 []string = nil
309-
for _, tagsItem1 := range data.Tags {
310-
tags1 = append(tags1, tagsItem1.ValueString())
311-
}
312-
entityID := data.EntityID.ValueString()
313-
singleton := shared.FileRelationItem{
314-
Schema: schema,
315-
Tags: tags1,
316-
EntityID: entityID,
317-
}
318-
relations := []shared.FileRelationItem{singleton}
319286
bucket := data.Bucket.ValueString()
320287
key := data.Key.ValueString()
321-
s3ref := shared.S3Reference{
288+
s3ref := shared.SaveFilePayloadV2S3ref{
322289
Bucket: bucket,
323290
Key: key,
324291
}
@@ -330,7 +297,6 @@ func (r *FileResource) Create(ctx context.Context, req resource.CreateRequest, r
330297
DocumentType: documentType,
331298
FileEntityID: fileEntityID,
332299
Filename: filename,
333-
Relations: relations,
334300
S3ref: s3ref,
335301
}
336302
res, err := r.client.Files.SaveFileV2(ctx, request)

internal/sdk/pkg/models/shared/savefilepayloadv2.go

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@ func (e *SaveFilePayloadV2DocumentType) UnmarshalJSON(data []byte) error {
9292
}
9393
}
9494

95+
type SaveFilePayloadV2S3ref struct {
96+
Bucket string `json:"bucket"`
97+
Key string `json:"key"`
98+
}
99+
100+
func (o *SaveFilePayloadV2S3ref) GetBucket() string {
101+
if o == nil {
102+
return ""
103+
}
104+
return o.Bucket
105+
}
106+
107+
func (o *SaveFilePayloadV2S3ref) GetKey() string {
108+
if o == nil {
109+
return ""
110+
}
111+
return o.Key
112+
}
113+
95114
type SaveFilePayloadV2 struct {
96115
AdditionalProperties interface{} `additionalProperties:"true" json:"-"`
97116
Tags []string `json:"_tags,omitempty"`
@@ -100,11 +119,9 @@ type SaveFilePayloadV2 struct {
100119
CustomDownloadURL *string `json:"custom_download_url,omitempty"`
101120
DocumentType *SaveFilePayloadV2DocumentType `json:"document_type,omitempty"`
102121
// if passed, adds a new version to existing file entity
103-
FileEntityID *string `json:"file_entity_id,omitempty"`
104-
Filename string `json:"filename"`
105-
// List of entities to relate the file to
106-
Relations []FileRelationItem `json:"relations,omitempty"`
107-
S3ref S3Reference `json:"s3ref"`
122+
FileEntityID *string `json:"file_entity_id,omitempty"`
123+
Filename string `json:"filename"`
124+
S3ref SaveFilePayloadV2S3ref `json:"s3ref"`
108125
}
109126

110127
func (s SaveFilePayloadV2) MarshalJSON() ([]byte, error) {
@@ -167,16 +184,9 @@ func (o *SaveFilePayloadV2) GetFilename() string {
167184
return o.Filename
168185
}
169186

170-
func (o *SaveFilePayloadV2) GetRelations() []FileRelationItem {
171-
if o == nil {
172-
return nil
173-
}
174-
return o.Relations
175-
}
176-
177-
func (o *SaveFilePayloadV2) GetS3ref() S3Reference {
187+
func (o *SaveFilePayloadV2) GetS3ref() SaveFilePayloadV2S3ref {
178188
if o == nil {
179-
return S3Reference{}
189+
return SaveFilePayloadV2S3ref{}
180190
}
181191
return o.S3ref
182192
}

0 commit comments

Comments
 (0)