mirror of
https://github.com/LukeHagar/plexterraform.git
synced 2025-12-06 20:47:43 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.133.1
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
lockVersion: 2.0.0
|
lockVersion: 2.0.0
|
||||||
id: e742591b-391d-4f4e-8484-d01a093b32ec
|
id: e742591b-391d-4f4e-8484-d01a093b32ec
|
||||||
management:
|
management:
|
||||||
docChecksum: 550154cf1b4d0c237436fb18c418b5db
|
docChecksum: 34d22936f2456c2c461abdfc773e3fc4
|
||||||
docVersion: 0.0.3
|
docVersion: 0.0.3
|
||||||
speakeasyVersion: internal
|
speakeasyVersion: internal
|
||||||
generationVersion: 2.225.2
|
generationVersion: 2.228.1
|
||||||
releaseVersion: 0.1.0
|
releaseVersion: 0.2.0
|
||||||
configChecksum: d92408a91beb4360d3ade54235c386a6
|
configChecksum: aa46c3314b27098c848b44960a4abd53
|
||||||
repoURL: https://github.com/LukeHagar/plexterraform.git
|
repoURL: https://github.com/LukeHagar/plexterraform.git
|
||||||
repoSubDirectory: .
|
repoSubDirectory: .
|
||||||
published: true
|
published: true
|
||||||
features:
|
features:
|
||||||
terraform:
|
terraform:
|
||||||
constsAndDefaults: 0.1.2
|
constsAndDefaults: 0.1.2
|
||||||
core: 3.7.0
|
core: 3.8.0
|
||||||
globalSecurity: 2.81.2
|
globalSecurity: 2.81.2
|
||||||
globalServerURLs: 2.82.1
|
globalServerURLs: 2.82.1
|
||||||
nameOverrides: 2.81.1
|
nameOverrides: 2.81.1
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
PlexAPI = {
|
PlexAPI = {
|
||||||
source = "LukeHagar/PlexAPI"
|
source = "LukeHagar/PlexAPI"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,3 +15,11 @@ Based on:
|
|||||||
- Speakeasy CLI 1.130.1 (2.225.2) https://github.com/speakeasy-api/speakeasy
|
- Speakeasy CLI 1.130.1 (2.225.2) https://github.com/speakeasy-api/speakeasy
|
||||||
### Generated
|
### Generated
|
||||||
- [terraform v0.1.0] .
|
- [terraform v0.1.0] .
|
||||||
|
|
||||||
|
## 2024-01-05 19:50:57
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc 0.0.3
|
||||||
|
- Speakeasy CLI 1.133.1 (2.228.1) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [terraform v0.2.0] .
|
||||||
@@ -17,7 +17,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
PlexAPI = {
|
PlexAPI = {
|
||||||
source = "LukeHagar/PlexAPI"
|
source = "LukeHagar/PlexAPI"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,4 +33,4 @@ provider "PlexAPI" {
|
|||||||
### Optional
|
### Optional
|
||||||
|
|
||||||
- `access_token` (String, Sensitive)
|
- `access_token` (String, Sensitive)
|
||||||
- `server_url` (String) Server URL (defaults to http://10.10.10.47:32400)
|
- `server_url` (String) Server URL (defaults to {protocol}://{ip}:{port})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
PlexAPI = {
|
PlexAPI = {
|
||||||
source = "LukeHagar/PlexAPI"
|
source = "LukeHagar/PlexAPI"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
gen.yaml
2
gen.yaml
@@ -8,7 +8,7 @@ generation:
|
|||||||
fixes:
|
fixes:
|
||||||
nameResolutionDec2023: false
|
nameResolutionDec2023: false
|
||||||
terraform:
|
terraform:
|
||||||
version: 0.1.0
|
version: 0.2.0
|
||||||
author: LukeHagar
|
author: LukeHagar
|
||||||
imports:
|
imports:
|
||||||
option: openapi
|
option: openapi
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Bool {
|
func SuppressDiff(strategy int) planmodifier.Bool {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyBool(ctx context.Context, req planmodifier.BoolR
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Float64 {
|
func SuppressDiff(strategy int) planmodifier.Float64 {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyFloat64(ctx context.Context, req planmodifier.Fl
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Int64 {
|
func SuppressDiff(strategy int) planmodifier.Int64 {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyInt64(ctx context.Context, req planmodifier.Int6
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.List {
|
func SuppressDiff(strategy int) planmodifier.List {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyList(ctx context.Context, req planmodifier.ListR
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Map {
|
func SuppressDiff(strategy int) planmodifier.Map {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyMap(ctx context.Context, req planmodifier.MapReq
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Number {
|
func SuppressDiff(strategy int) planmodifier.Number {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyNumber(ctx context.Context, req planmodifier.Num
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Object {
|
func SuppressDiff(strategy int) planmodifier.Object {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyObject(ctx context.Context, req planmodifier.Obj
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.Set {
|
func SuppressDiff(strategy int) planmodifier.Set {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifySet(ctx context.Context, req planmodifier.SetReq
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,24 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Standard suppresses "(known after changes)" messages unless there's an explicit change in state [excluding null <=> unknown transitions]
|
||||||
|
Standard = iota
|
||||||
|
// ExplicitSuppress strategy suppresses "(known after changes)" messages unless we're in the initial creation
|
||||||
|
ExplicitSuppress = iota
|
||||||
|
)
|
||||||
|
|
||||||
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
// SuppressDiff returns a plan modifier that propagates a state value into the planned value, when it is Known, and the Plan Value is Unknown
|
||||||
func SuppressDiff() planmodifier.String {
|
func SuppressDiff(strategy int) planmodifier.String {
|
||||||
return suppressDiff{}
|
return suppressDiff{
|
||||||
|
strategy: strategy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressDiff implements the plan modifier.
|
// suppressDiff implements the plan modifier.
|
||||||
type suppressDiff struct{}
|
type suppressDiff struct {
|
||||||
|
strategy int
|
||||||
|
}
|
||||||
|
|
||||||
// Description returns a human-readable description of the plan modifier.
|
// Description returns a human-readable description of the plan modifier.
|
||||||
func (m suppressDiff) Description(_ context.Context) string {
|
func (m suppressDiff) Description(_ context.Context) string {
|
||||||
@@ -42,6 +53,9 @@ func (m suppressDiff) PlanModifyString(ctx context.Context, req planmodifier.Str
|
|||||||
if utils.IsAllStateUnknown(ctx, req.State) {
|
if utils.IsAllStateUnknown(ctx, req.State) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if m.strategy == Standard && utils.IsAnyKnownChange(ctx, req.Plan, req.State) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
resp.PlanValue = req.StateValue
|
resp.PlanValue = req.StateValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,3 +23,91 @@ func IsAllStateUnknown(ctx context.Context, state tfsdk.State) bool {
|
|||||||
|
|
||||||
return !anyFound
|
return !anyFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsAnyKnownChange(ctx context.Context, plan tfsdk.Plan, state tfsdk.State) bool {
|
||||||
|
attrs := state.Schema.GetAttributes()
|
||||||
|
anyFound := false
|
||||||
|
for k, _ := range attrs {
|
||||||
|
stateValue := new(attr.Value)
|
||||||
|
planValue := new(attr.Value)
|
||||||
|
state.GetAttribute(ctx, path.Root(k), stateValue)
|
||||||
|
plan.GetAttribute(ctx, path.Root(k), planValue)
|
||||||
|
anyFound = !isKnownEqual(ctx, stateValue, planValue)
|
||||||
|
if anyFound {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return anyFound
|
||||||
|
}
|
||||||
|
|
||||||
|
type HasElements interface {
|
||||||
|
Elements() []attr.Value
|
||||||
|
IsUnknown() bool
|
||||||
|
IsNull() bool
|
||||||
|
}
|
||||||
|
type HasAttributes interface {
|
||||||
|
Attributes() map[string]attr.Value
|
||||||
|
IsUnknown() bool
|
||||||
|
IsNull() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func isKnownEqual(ctx context.Context, a *attr.Value, b *attr.Value) bool {
|
||||||
|
if (*a).IsUnknown() || (*b).IsUnknown() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
aType := (*a).Type(ctx)
|
||||||
|
bType := (*b).Type(ctx)
|
||||||
|
if !aType.Equal(bType) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
attributeTypes, ok := aType.(attr.TypeWithAttributeTypes)
|
||||||
|
if ok {
|
||||||
|
check := true
|
||||||
|
for k, _ := range attributeTypes.AttributeTypes() {
|
||||||
|
objValA, isObjA := (*a).(HasAttributes)
|
||||||
|
objValB, isObjB := (*b).(HasAttributes)
|
||||||
|
if isObjA && isObjB {
|
||||||
|
if objValA.IsUnknown() || objValB.IsUnknown() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
attrA, foundA := objValA.Attributes()[k]
|
||||||
|
attrB, foundB := objValB.Attributes()[k]
|
||||||
|
if foundA != foundB {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if foundA {
|
||||||
|
check = isKnownEqual(ctx, &attrA, &attrB)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !check {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return check
|
||||||
|
}
|
||||||
|
_, ok = aType.(attr.TypeWithElementType)
|
||||||
|
if ok {
|
||||||
|
aVal, aValList := (*a).(HasElements)
|
||||||
|
bVal, bValList := (*b).(HasElements)
|
||||||
|
if aValList && bValList {
|
||||||
|
if ((aVal).IsUnknown() || (aVal).IsNull()) && ((bVal).IsUnknown() || (bVal).IsNull()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if len(aVal.Elements()) != len(bVal.Elements()) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
for i, _ := range aVal.Elements() {
|
||||||
|
if !isKnownEqual(ctx, &aVal.Elements()[i], &bVal.Elements()[i]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
isEqual := (*a).Equal(*b)
|
||||||
|
return isEqual
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk"
|
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk"
|
||||||
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/pkg/models/shared"
|
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/pkg/models/shared"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/provider"
|
"github.com/hashicorp/terraform-plugin-framework/provider"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
|
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
|
||||||
@@ -39,7 +38,7 @@ func (p *PlexAPIProvider) Schema(ctx context.Context, req provider.SchemaRequest
|
|||||||
Description: `An Open API Spec for interacting with Plex.tv and Plex Servers`,
|
Description: `An Open API Spec for interacting with Plex.tv and Plex Servers`,
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"server_url": schema.StringAttribute{
|
"server_url": schema.StringAttribute{
|
||||||
MarkdownDescription: "Server URL (defaults to http://10.10.10.47:32400)",
|
MarkdownDescription: "Server URL (defaults to {protocol}://{ip}:{port})",
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Required: false,
|
Required: false,
|
||||||
},
|
},
|
||||||
@@ -63,7 +62,7 @@ func (p *PlexAPIProvider) Configure(ctx context.Context, req provider.ConfigureR
|
|||||||
ServerURL := data.ServerURL.ValueString()
|
ServerURL := data.ServerURL.ValueString()
|
||||||
|
|
||||||
if ServerURL == "" {
|
if ServerURL == "" {
|
||||||
ServerURL = "http://10.10.10.47:32400"
|
ServerURL = "{protocol}://{ip}:{port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
accessToken := data.AccessToken.ValueString()
|
accessToken := data.AccessToken.ValueString()
|
||||||
|
|||||||
@@ -69,15 +69,17 @@ func merge(ctx context.Context, req resource.UpdateRequest, resp *resource.Updat
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need a tftypes.Value for this Object to be able to use it with
|
refreshPlan(ctx, plan, target, resp.Diagnostics)
|
||||||
// our reflection code
|
}
|
||||||
|
|
||||||
|
func refreshPlan(ctx context.Context, plan types.Object, target interface{}, diagnostics diag.Diagnostics) {
|
||||||
obj := types.ObjectType{AttrTypes: plan.AttributeTypes(ctx)}
|
obj := types.ObjectType{AttrTypes: plan.AttributeTypes(ctx)}
|
||||||
val, err := plan.ToTerraformValue(ctx)
|
val, err := plan.ToTerraformValue(ctx)
|
||||||
if err != nil {
|
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()))
|
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
|
return
|
||||||
}
|
}
|
||||||
resp.Diagnostics.Append(tfReflect.Into(ctx, obj, val, target, tfReflect.Options{
|
diagnostics.Append(tfReflect.Into(ctx, obj, val, target, tfReflect.Options{
|
||||||
UnhandledNullAsEmpty: true,
|
UnhandledNullAsEmpty: true,
|
||||||
UnhandledUnknownAsEmpty: true,
|
UnhandledUnknownAsEmpty: true,
|
||||||
}, path.Empty())...)
|
}, path.Empty())...)
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import (
|
|||||||
|
|
||||||
// ServerList contains the list of servers available to the SDK
|
// ServerList contains the list of servers available to the SDK
|
||||||
var ServerList = []string{
|
var ServerList = []string{
|
||||||
// The full address of your Plex Server
|
|
||||||
"http://10.10.10.47:32400",
|
|
||||||
// The full address of your Plex Server
|
// The full address of your Plex Server
|
||||||
"{protocol}://{ip}:{port}",
|
"{protocol}://{ip}:{port}",
|
||||||
}
|
}
|
||||||
@@ -261,11 +259,10 @@ func New(opts ...SDKOption) *PlexAPI {
|
|||||||
sdkConfiguration: sdkConfiguration{
|
sdkConfiguration: sdkConfiguration{
|
||||||
Language: "go",
|
Language: "go",
|
||||||
OpenAPIDocVersion: "0.0.3",
|
OpenAPIDocVersion: "0.0.3",
|
||||||
SDKVersion: "0.1.0",
|
SDKVersion: "0.2.0",
|
||||||
GenVersion: "2.225.2",
|
GenVersion: "2.228.1",
|
||||||
UserAgent: "speakeasy-sdk/go 0.1.0 2.225.2 0.0.3 PlexAPI",
|
UserAgent: "speakeasy-sdk/go 0.2.0 2.228.1 0.0.3 PlexAPI",
|
||||||
ServerDefaults: []map[string]string{
|
ServerDefaults: []map[string]string{
|
||||||
{},
|
|
||||||
{
|
{
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"ip": "10.10.10.47",
|
"ip": "10.10.10.47",
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
// Run the docs generation tool, check its repository for more information on how it works and how docs
|
// Run the docs generation tool, check its repository for more information on how it works and how docs
|
||||||
// can be customized.
|
// can be customized.
|
||||||
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
|
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --rendered-provider-name terraform-provider-plex-api
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// these will be set by the goreleaser configuration
|
// these will be set by the goreleaser configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user