Skip to content

Commit

Permalink
Remove unused common schema functions
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Jan 18, 2021
1 parent c6982ea commit db47136
Showing 1 changed file with 0 additions and 124 deletions.
124 changes: 0 additions & 124 deletions internal/helpers/aadgraph/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,134 +12,10 @@ import (
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"github.com/terraform-providers/terraform-provider-azuread/internal/utils"
"github.com/terraform-providers/terraform-provider-azuread/internal/validate"
)

// valid types are `application` and `service_principal`
func CertificateResourceSchema(idAttribute string) map[string]*schema.Schema {
return map[string]*schema.Schema{
idAttribute: {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateDiagFunc: validate.UUID,
},

"key_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateDiagFunc: validate.UUID,
},

"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"AsymmetricX509Cert",
"Symmetric",
}, false),
},

"value": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Sensitive: true,
},

"start_date": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.IsRFC3339Time,
},

"end_date": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"end_date_relative"},
ValidateFunc: validation.IsRFC3339Time,
},

"end_date_relative": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"end_date"},
ValidateDiagFunc: validate.NoEmptyStrings,
},
}
}

// valid types are `application` and `service_principal`
func PasswordResourceSchema(idAttribute string) map[string]*schema.Schema {
return map[string]*schema.Schema{
idAttribute: {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateDiagFunc: validate.UUID,
},

"key_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateDiagFunc: validate.UUID,
},

"description": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"value": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Sensitive: true,
ValidateFunc: validation.StringLenBetween(1, 863), // Encrypted secret cannot be empty and can be at most 1024 bytes.
},

"start_date": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.IsRFC3339Time,
},

"end_date": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ExactlyOneOf: []string{"end_date_relative"},
ValidateFunc: validation.IsRFC3339Time,
},

"end_date_relative": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ExactlyOneOf: []string{"end_date"},
ValidateDiagFunc: validate.NoEmptyStrings,
},
}
}

func PasswordCredentialForResource(d *schema.ResourceData) (*graphrbac.PasswordCredential, error) {
value := d.Get("value").(string)

Expand Down

0 comments on commit db47136

Please sign in to comment.