ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.241.0

This commit is contained in:
speakeasybot
2024-04-06 01:04:46 +00:00
parent 6b55465994
commit a426f8a7db
11 changed files with 53 additions and 21 deletions

View File

@@ -3,22 +3,22 @@ id: e742591b-391d-4f4e-8484-d01a093b32ec
management:
docChecksum: a91eaf9ec1e6a3a6f4bf0571f5b18bae
docVersion: 0.0.3
speakeasyVersion: 1.228.1
generationVersion: 2.292.0
releaseVersion: 0.9.0
configChecksum: 099f930233140a9803ac3954f0314d49
speakeasyVersion: 1.241.0
generationVersion: 2.300.0
releaseVersion: 0.10.0
configChecksum: 209a06e636e3932f0cf252f8833149be
repoURL: https://github.com/LukeHagar/plexterraform.git
repoSubDirectory: .
published: true
features:
terraform:
constsAndDefaults: 0.1.4
core: 3.12.1
core: 3.17.0
globalSecurity: 2.81.6
globalServerURLs: 2.82.1
globals: 2.82.1
methodServerURLs: 2.82.1
nameOverrides: 2.81.1
nameOverrides: 2.81.2
generatedFiles:
- internal/sdk/server.go
- internal/sdk/media.go

View File

@@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
terraform:
version: 0.9.0
version: 0.10.0
author: LukeHagar
imports:
option: openapi

View File

@@ -61,7 +61,7 @@ terraform {
required_providers {
PlexAPI = {
source = "LukeHagar/PlexAPI"
version = "0.9.0"
version = "0.10.0"
}
}
}

View File

@@ -159,3 +159,11 @@ Based on:
- Speakeasy CLI 1.228.1 (2.292.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [terraform v0.9.0] .
## 2024-04-06 01:03:34
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.241.0 (2.300.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [terraform v0.10.0] .

View File

@@ -17,7 +17,7 @@ terraform {
required_providers {
PlexAPI = {
source = "LukeHagar/PlexAPI"
version = "0.9.0"
version = "0.10.0"
}
}
}

View File

@@ -2,7 +2,7 @@ terraform {
required_providers {
PlexAPI = {
source = "LukeHagar/PlexAPI"
version = "0.9.0"
version = "0.10.0"
}
}
}

View File

@@ -46,7 +46,7 @@ func commaSeparatedString(in []string) string {
// getStructTags returns a map of Terraform field names to their position in
// the tags of the struct `in`. `in` must be a struct.
func getStructTags(_ context.Context, in reflect.Value, path path.Path) (map[string]int, error) {
func getStructTags(_ context.Context, in reflect.Value, path path.Path, opts Options) (map[string]int, error) {
tags := map[string]int{}
typ := trueReflectValue(in).Type()
if typ.Kind() != reflect.Struct {

View File

@@ -2,6 +2,11 @@
package reflect
const (
SourceTypeState = iota
SourceTypePlan
)
// Options provides configuration settings for how the reflection behavior
// works, letting callers tweak different behaviors based on their needs.
type Options struct {
@@ -19,4 +24,8 @@ type Options struct {
// perfectly in the types they're being stored in, rather than
// returning errors. Numbers will always be rounded towards 0.
AllowRoundingNumbers bool
// SourceType informs the reflection system what the source is
// such that it can make decisions based on the tfPlanOnly annotation
// The default is SourceTypeState
SourceType int
}

View File

@@ -73,7 +73,7 @@ func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target ref
// collect a map of fields that are defined in the tags of the struct
// passed in
targetFields, err := getStructTags(ctx, target, path)
targetFields, err := getStructTags(ctx, target, path, opts)
if err != nil {
diags.Append(diag.WithPath(path, DiagIntoIncompatibleType{
Val: object,
@@ -125,7 +125,8 @@ func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target ref
} else {
result = reflect.New(target.Type()).Elem()
}
// Fork End
structType := trueReflectValue(target).Type()
for field, structFieldPos := range targetFields {
attrType, ok := attrTypes[field]
if !ok {
@@ -136,6 +137,13 @@ func Struct(ctx context.Context, typ attr.Type, object tftypes.Value, target ref
}))
return target, diags
}
fieldReflected := structType.Field(structFieldPos)
if opts.SourceType == SourceTypeState && fieldReflected.Tag.Get(`tfPlanOnly`) == "true" {
// skip explicitly excluded fields
continue
}
// Fork End
structField := result.Field(structFieldPos)
fieldVal, fieldValDiags := BuildValue(ctx, attrType, objectFields[field], structField, opts, path.AtName(field))
diags.Append(fieldValDiags...)
@@ -162,7 +170,7 @@ func FromStruct(ctx context.Context, typ attr.TypeWithAttributeTypes, val reflec
// collect a map of fields that are defined in the tags of the struct
// passed in
targetFields, err := getStructTags(ctx, val, path)
targetFields, err := getStructTags(ctx, val, path, Options{})
if err != nil {
err = fmt.Errorf("error retrieving field names from struct tags: %w", err)
diags.AddAttributeError(

View File

@@ -11,13 +11,15 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"net/http"
"net/http/httputil"
"reflect"
)
func debugResponse(response *http.Response) string {
if v := response.Request.Header.Get("X-Plex-Token"); v != "" {
response.Request.Header.Set("X-Plex-Token", "(sensitive)")
}
dumpReq, err := httputil.DumpRequest(response.Request, true)
if err != nil {
dumpReq, err = httputil.DumpRequest(response.Request, false)
@@ -60,11 +62,15 @@ func merge(ctx context.Context, req resource.UpdateRequest, resp *resource.Updat
if resp.Diagnostics.HasError() {
return
}
resp.Diagnostics.Append(state.As(ctx, target, basetypes.ObjectAsOptions{
val, err := state.ToTerraformValue(ctx)
if err != nil {
resp.Diagnostics.Append(diag.NewErrorDiagnostic("Object Conversion Error", "An unexpected error was encountered trying to convert object. This is always an error in the provider. Please report the following to the provider developer:\n\n"+err.Error()))
return
}
resp.Diagnostics.Append(tfReflect.Into(ctx, types.ObjectType{AttrTypes: state.AttributeTypes(ctx)}, val, target, tfReflect.Options{
UnhandledNullAsEmpty: true,
UnhandledUnknownAsEmpty: true,
})...)
}, path.Empty())...)
if resp.Diagnostics.HasError() {
return
}
@@ -82,5 +88,6 @@ func refreshPlan(ctx context.Context, plan types.Object, target interface{}, dia
diagnostics.Append(tfReflect.Into(ctx, obj, val, target, tfReflect.Options{
UnhandledNullAsEmpty: true,
UnhandledUnknownAsEmpty: true,
SourceType: tfReflect.SourceTypePlan,
}, path.Empty())...)
}

View File

@@ -279,8 +279,8 @@ func New(opts ...SDKOption) *PlexAPI {
Language: "go",
OpenAPIDocVersion: "0.0.3",
SDKVersion: "0.0.1",
GenVersion: "2.292.0",
UserAgent: "speakeasy-sdk/go 0.0.1 2.292.0 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk",
GenVersion: "2.300.0",
UserAgent: "speakeasy-sdk/go 0.0.1 2.300.0 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk",
Globals: map[string]map[string]map[string]interface{}{
"parameters": {},
},