-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vcd_tm_region_storage_policy + vcd_tm_content_library resource an…
…d data source (#1339) Signed-off-by: abarreiro <abarreiro@vmware.com>
- Loading branch information
1 parent
861513e
commit 9334ae8
Showing
19 changed files
with
782 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* **New Data Source:** `vcd_tm_region_storage_policy` to read Region Storage Policies [GH-1339] | ||
* **New Resource:** `vcd_tm_content_library` to manage Content Libraries [GH-1339] | ||
* **New Data Source:** `vcd_tm_content_library` to read Content Libraries [GH-1339] |
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
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,98 @@ | ||
package vcd | ||
|
||
import ( | ||
"context" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func datasourceVcdTmContentLibrary() *schema.Resource { | ||
return &schema.Resource{ | ||
ReadContext: datasourceVcdTmContentLibraryRead, | ||
Schema: map[string]*schema.Schema{ | ||
"name": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: "The name of the Content Library", | ||
}, | ||
"storage_policy_ids": { | ||
Type: schema.TypeSet, | ||
Computed: true, | ||
Description: "A set of Region Storage Policy or VDC Storage Policy IDs used by this Content Library", | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
}, | ||
"auto_attach": { | ||
Type: schema.TypeBool, | ||
Computed: true, | ||
Description: "For Tenant Content Libraries this field represents whether this Content Library should be " + | ||
"automatically attached to all current and future namespaces in the tenant organization", | ||
}, | ||
"creation_date": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The ISO-8601 timestamp representing when this Content Library was created", | ||
}, | ||
"description": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The description of the Content Library", | ||
}, | ||
"is_shared": { | ||
Type: schema.TypeBool, | ||
Computed: true, | ||
Description: "Whether this Content Library is shared with other Organziations", | ||
}, | ||
"is_subscribed": { | ||
Type: schema.TypeBool, | ||
Computed: true, | ||
Description: "Whether this Content Library is subscribed from an external published library", | ||
}, | ||
"library_type": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The type of content library, can be either PROVIDER (Content Library that is scoped to a " + | ||
"provider) or TENANT (Content Library that is scoped to a tenant organization)", | ||
}, | ||
"owner_org_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The reference to the Organization that the Content Library belongs to", | ||
}, | ||
"subscription_config": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "A block representing subscription settings of a Content Library", | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"subscription_url": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "Subscription url of this Content Library", | ||
}, | ||
"password": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "Password to use to authenticate with the publisher", | ||
}, | ||
"need_local_copy": { | ||
Type: schema.TypeBool, | ||
Computed: true, | ||
Description: "Whether to eagerly download content from publisher and store it locally", | ||
}, | ||
}, | ||
}, | ||
}, | ||
"version_number": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "Version number of this Content library", | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func datasourceVcdTmContentLibraryRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
return genericVcdTmContentLibraryRead(ctx, d, meta, "datasource") | ||
} |
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,50 @@ | ||
package vcd | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func datasourceVcdTmRegionStoragePolicy() *schema.Resource { | ||
return &schema.Resource{ | ||
ReadContext: datasourceVcdTmRegionStoragePolicyRead, | ||
Schema: map[string]*schema.Schema{ | ||
"name": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: "Region Storage Policy name", | ||
}, | ||
"description": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "Description of the Region Storage Policy", | ||
}, | ||
"region_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The Region that this Region Storage Policy belongs to", | ||
}, | ||
"status": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The creation status of the Region Storage Policy. Can be [NOT_READY, READY]", | ||
}, | ||
"storage_capacity_mb": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "Storage capacity in megabytes for this Region Storage Policy", | ||
}, | ||
"storage_consumed_mb": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "Consumed storage in megabytes for this Region Storage Policy", | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func datasourceVcdTmRegionStoragePolicyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
return genericVcdTmRegionStoragePolicyRead(ctx, d, meta, "datasource") | ||
} |
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
Oops, something went wrong.