-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate convert and generate packages for datasource, provider, a…
…nd resource (#98) * Replace datasource_convert pkg with constructors * Renaming datasource_generate pkg to datasource * Reusing predefined functions * Switching to using constructor functions for provider generator types * Moving provider_generate package to provider * Switching to using constructor functions for resource generator types * Linting and copyright headers
- Loading branch information
1 parent
f4ec669
commit 5e7142e
Showing
288 changed files
with
19,583 additions
and
21,468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package convert | ||
|
||
import specschema "github.com/hashicorp/terraform-plugin-codegen-spec/schema" | ||
|
||
type DeprecationMessage struct { | ||
deprecationMessage *string | ||
} | ||
|
||
func NewDeprecationMessage(d *string) DeprecationMessage { | ||
return DeprecationMessage{ | ||
deprecationMessage: d, | ||
} | ||
} | ||
|
||
func (s DeprecationMessage) DeprecationMessage() string { | ||
if s.deprecationMessage == nil { | ||
return "" | ||
} | ||
|
||
return *s.deprecationMessage | ||
} | ||
|
||
type Description struct { | ||
description *string | ||
} | ||
|
||
func NewDescription(d *string) Description { | ||
return Description{ | ||
description: d, | ||
} | ||
} | ||
|
||
func (d Description) Description() string { | ||
if d.description == nil { | ||
return "" | ||
} | ||
|
||
return *d.description | ||
} | ||
|
||
type ComputedOptionalRequired struct { | ||
computedOptionalRequired specschema.ComputedOptionalRequired | ||
} | ||
|
||
func NewComputedOptionalRequired(c specschema.ComputedOptionalRequired) ComputedOptionalRequired { | ||
return ComputedOptionalRequired{ | ||
computedOptionalRequired: c, | ||
} | ||
} | ||
|
||
func (c ComputedOptionalRequired) IsRequired() bool { | ||
return c.computedOptionalRequired == specschema.Required | ||
} | ||
|
||
func (c ComputedOptionalRequired) IsOptional() bool { | ||
if c.computedOptionalRequired == specschema.Optional || c.computedOptionalRequired == specschema.ComputedOptional { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
func (c ComputedOptionalRequired) IsComputed() bool { | ||
if c.computedOptionalRequired == specschema.Computed || c.computedOptionalRequired == specschema.ComputedOptional { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
type OptionalRequired struct { | ||
optionalRequired specschema.OptionalRequired | ||
} | ||
|
||
func NewOptionalRequired(c specschema.OptionalRequired) OptionalRequired { | ||
return OptionalRequired{ | ||
optionalRequired: c, | ||
} | ||
} | ||
|
||
func (c OptionalRequired) IsRequired() bool { | ||
return c.optionalRequired == specschema.Required | ||
} | ||
|
||
func (c OptionalRequired) IsOptional() bool { | ||
return c.optionalRequired == specschema.Optional | ||
} | ||
|
||
type Sensitive struct { | ||
sensitive *bool | ||
} | ||
|
||
func NewSensitive(s *bool) Sensitive { | ||
return Sensitive{ | ||
sensitive: s, | ||
} | ||
} | ||
|
||
func (s Sensitive) IsSensitive() bool { | ||
if s.sensitive == nil { | ||
return false | ||
} | ||
|
||
return *s.sensitive | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.