Skip to content

Commit

Permalink
feat: update vmware service (IBM-Cloud#5926)
Browse files Browse the repository at this point in the history
* feat: update vmware service with latest api specs

* fix: update go.mod file with latest vmware-go-sdk

* fix: add config and refactor

* refactor: fix go.mod file

* docs: shorten service name

* refactor: update variable name with prefix IBMCLOUD

* refactor: remove optional for computed property

* feat: add to subcategory list
  • Loading branch information
sanket-ibm authored Jan 27, 2025
1 parent a12cf21 commit 0960168
Show file tree
Hide file tree
Showing 12 changed files with 1,011 additions and 223 deletions.
10 changes: 6 additions & 4 deletions examples/ibm-vmware/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Examples for VMware as a Service API
# Examples for VMware Cloud Foundation as a Service API

These examples illustrate how to use the resources and data sources associated with VMware as a Service API.
These examples illustrate how to use the resources and data sources associated with VMware Cloud Foundation as a Service API.

The following resources are supported:
* ibm_vmaas_vdc
Expand All @@ -20,7 +20,7 @@ $ terraform apply

Run `terraform destroy` when you don't need these resources.

## VMware as a Service API resources
## VMware Cloud Foundation as a Service API resources

### Resource: ibm_vmaas_vdc

Expand Down Expand Up @@ -62,11 +62,12 @@ resource "ibm_vmaas_vdc" "vmaas_vdc_instance" {
| edges | The VMware NSX-T networking edges deployed on the virtual data center (VDC). NSX-T edges are used for bridging virtualization networking to the physical public-internet and IBM private networking. |
| status_reasons | Information about why the request to create the virtual data center (VDC) cannot be completed. |
| ordered_at | The time that the virtual data center (VDC) is ordered. |
| org_href | The URL of the organization that owns the VDC. |
| org_name | The name of the VMware Cloud Director organization that contains this virtual data center (VDC). VMware Cloud Director organizations are used to create strong boundaries between VDCs. There is a complete isolation of user administration, networking, workloads, and VMware Cloud Director catalogs between different Director organizations. |
| status | Determines the state of the virtual data center. |
| type | Determines whether this virtual data center is in a single-tenant or multitenant Cloud Director site. |

## VMware as a Service API data sources
## VMware Cloud Foundation as a Service API data sources

### Data source: ibm_vmaas_vdc

Expand Down Expand Up @@ -98,6 +99,7 @@ data "ibm_vmaas_vdc" "vmaas_vdc_instance" {
| status_reasons | Information about why the request to create the virtual data center (VDC) cannot be completed. |
| name | A human readable ID for the virtual data center (VDC). |
| ordered_at | The time that the virtual data center (VDC) is ordered. |
| org_href | The URL of the organization that owns the VDC. |
| org_name | The name of the VMware Cloud Director organization that contains this virtual data center (VDC). VMware Cloud Director organizations are used to create strong boundaries between VDCs. There is a complete isolation of user administration, networking, workloads, and VMware Cloud Director catalogs between different Director organizations. |
| ram | The RAM usage limit on the virtual data center (VDC) in GB (1024^3 bytes). Supported for VDCs deployed on a multitenant Cloud Director site. This property is applicable when the resource pool type is reserved. |
| status | Determines the state of the virtual data center. |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/IBM/schematics-go-sdk v0.3.0
github.com/IBM/sds-go-sdk v0.0.4
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.7
github.com/IBM/vmware-go-sdk v0.1.2
github.com/IBM/vmware-go-sdk v0.1.3
github.com/IBM/vpc-beta-go-sdk v0.8.0
github.com/IBM/vpc-go-sdk v0.64.0
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ github.com/IBM/sds-go-sdk v0.0.4 h1:zkkqDzc+TgFYU/BK4Oknv8cMBXJ08WKUu7yKCyzslvE=
github.com/IBM/sds-go-sdk v0.0.4/go.mod h1:HcqZfsgKMqfFxbU1RcRfF934ls+vQY97oXPGPSoIWPg=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.7 h1:5lKt1rHuKaAaiZtbPfsF8dgiko/gGbVgreiut3zU128=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.7/go.mod h1:RglK3v6CPe3T1myRtQCD6z+nBygXvNJwufAon0qcZok=
github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w9M=
github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA=
github.com/IBM/vmware-go-sdk v0.1.3 h1:uJL3kwzM0jAKsT6Gj9tE5xT9SZBVXVaJvZdxrSMx8b8=
github.com/IBM/vmware-go-sdk v0.1.3/go.mod h1:OyQKRInGGsBaOyE5LIZCqH7b1DZ01BvIYa8BgGy+wWo=
github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE=
github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE=
github.com/IBM/vpc-go-sdk v0.64.0 h1:0x2jakapXxXYTTr0EdrwuXa6h0couSK+FTDGxd8jChA=
Expand Down
41 changes: 22 additions & 19 deletions ibm/conns/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ type clientSession struct {
mqcloudClient *mqcloudv1.MqcloudV1
mqcloudClientErr error

// VMware as a Service
// VMware Cloud Foundation as a Service
vmwareClient *vmwarev1.VmwareV1
vmwareClientErr error

Expand Down Expand Up @@ -3560,25 +3560,28 @@ func (c *Config) ClientSession() (interface{}, error) {
session.mqcloudClientErr = fmt.Errorf("Error occurred while configuringMQaaS service: %q", err)
}

// VMware as a Service
// Construct the service options.
vmwareURL := ContructEndpoint(fmt.Sprintf("api.%s.vmware", c.Region), cloudEndpoint+"/v1")
vmwareClientOptions := &vmwarev1.VmwareV1Options{
Authenticator: authenticator,
URL: EnvFallBack([]string{"VMWARE_URL"}, vmwareURL),
}
// VMware Cloud Foundation as a Service
// Construct an instance of the 'VMware Cloud Foundation as a Service API' service.
if session.vmwareClientErr == nil {
// Construct the service options.
vmwareURL := ContructEndpoint(fmt.Sprintf("api.%s.vmware", c.Region), cloudEndpoint+"/v1")
vmwareClientOptions := &vmwarev1.VmwareV1Options{
Authenticator: authenticator,
URL: EnvFallBack([]string{"IBMCLOUD_VMWARE_URL"}, vmwareURL),
}

// Construct the service client.
session.vmwareClient, err = vmwarev1.NewVmwareV1(vmwareClientOptions)
if err == nil {
// Enable retries for API calls
session.vmwareClient.Service.EnableRetries(c.RetryCount, c.RetryDelay)
// Add custom header for analytics
session.vmwareClient.SetDefaultHeaders(gohttp.Header{
"X-Original-User-Agent": {fmt.Sprintf("terraform-provider-ibm/%s", version.Version)},
})
} else {
session.vmwareClientErr = fmt.Errorf("Error occurred while configuring VMware as a Service API service: %q", err)
// Construct the service client.
session.vmwareClient, err = vmwarev1.NewVmwareV1(vmwareClientOptions)
if err == nil {
// Enable retries for API calls
session.vmwareClient.Service.EnableRetries(c.RetryCount, c.RetryDelay)
// Add custom header for analytics
session.vmwareClient.SetDefaultHeaders(gohttp.Header{
"X-Original-User-Agent": {fmt.Sprintf("terraform-provider-ibm/%s", version.Version)},
})
} else {
session.vmwareClientErr = fmt.Errorf("Error occurred while constructing 'VMware Cloud Foundation as a Service API' service client: %q", err)
}
}

// Construct the service options.
Expand Down
4 changes: 2 additions & 2 deletions ibm/service/vmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ This area is primarily for IBM provider contributors and maintainers. For inform
* [Find out about contributing](../../../CONTRIBUTING.md) to the IBM provider!
* IBM Provider Docs: [Home](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs)
* IBM Provider Docs: [One of the resources](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/vmaas_vdc)
* IBM API Docs: [IBM API Docs for VMware as a Service](https://cloud.ibm.com/apidocs/vmware-service)
* IBM SDK: [IBM SDK for VMware as a Service ](https://github.com/IBM/appconfiguration-go-admin-sdk/tree/master/vmwarev1)
* IBM API Docs: [IBM API Docs for VMware Cloud Foundation as a Service](https://cloud.ibm.com/apidocs/vmware-service)
* IBM SDK: [IBM SDK for VMware Cloud Foundation as a Service ](https://github.com/IBM/appconfiguration-go-admin-sdk/tree/master/vmwarev1)
Loading

0 comments on commit 0960168

Please sign in to comment.