Skip to content

Commit

Permalink
Merge pull request #20 from NetApp/integration/main
Browse files Browse the repository at this point in the history
Integration/main
  • Loading branch information
wenjun666 authored Dec 9, 2020
2 parents e8f6b27 + cc69915 commit 6965ad8
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 8 deletions.
8 changes: 6 additions & 2 deletions cloudmanager/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ func (c *Client) CallAWSInstanceCreate(occmDetails createOCCMDetails) (string, e
svc := ec2.New(sess)

var securityGroupIds []*string
securityGroupIds = append(securityGroupIds, aws.String(occmDetails.SecurityGroupID))

split := strings.Split(occmDetails.SecurityGroupID, ",")
for _, sgid := range split {
securityGroupIds = append(securityGroupIds, aws.String(sgid))
}

// Specify the details of the instance that you want to create.
runInstancesInput := &ec2.RunInstancesInput{
BlockDeviceMappings: []*ec2.BlockDeviceMapping{
Expand All @@ -89,6 +92,7 @@ func (c *Client) CallAWSInstanceCreate(occmDetails createOCCMDetails) (string, e
MinCount: aws.Int64(1),
MaxCount: aws.Int64(1),
KeyName: aws.String(occmDetails.KeyName),
DisableApiTermination: aws.Bool(*occmDetails.EnableTerminationProtection),
TagSpecifications: []*ec2.TagSpecification{
{
ResourceType: aws.String("instance"),
Expand Down
2 changes: 2 additions & 0 deletions cloudmanager/data_source_netapp_cloudmanager_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func dataSourceCVOVolumeRead(d *schema.ResourceData, meta interface{}) error {
volume.WorkingEnvironmentID = weInfo.PublicID
volume.WorkingEnvironmentType = weInfo.WorkingEnvironmentType
volume.SvmName = weInfo.SvmName
d.Set("working_environment_id", volume.WorkingEnvironmentID)
d.Set("svm_name", volume.SvmName)
res, err := client.getVolume(volume)
if err != nil {
log.Print("Error reading volume")
Expand Down
1 change: 1 addition & 0 deletions cloudmanager/occm_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type createOCCMDetails struct {
AssociatePublicIPAddress *bool
AssociatePublicIP bool
FirewallTags bool
EnableTerminationProtection *bool
}

// deleteOCCMDetails the users input for deleting a occm
Expand Down
11 changes: 11 additions & 0 deletions cloudmanager/resource_netapp_cloudmanager_connector_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func resourceOCCMAWS() *schema.Resource {
Computed: true,
ForceNew: true,
},
"enable_termination_protection": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
},
"associate_public_ip_address": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -139,6 +145,11 @@ func resourceOCCMAWSCreate(d *schema.ResourceData, meta interface{}) error {
associatePublicIPAddress := o.(bool)
occmDetails.AssociatePublicIPAddress = &associatePublicIPAddress
}

if o, ok := d.GetOkExists("enable_termination_protection"); ok {
enableTerminationProtection := o.(bool)
occmDetails.EnableTerminationProtection = &enableTerminationProtection
}

res, err := client.createOCCM(occmDetails)
if err != nil {
Expand Down
5 changes: 4 additions & 1 deletion cloudmanager/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,14 @@ func (c *Client) deleteVolume(vol volumeRequest) error {
baseURL = fmt.Sprintf("%s/volumes/%s/%s/%s", baseURL, vol.WorkingEnvironmentID, vol.SvmName, vol.Name)
hostType := "CloudManagerHost"

statusCode, response, _, err := c.CallAPIMethod("DELETE", baseURL, nil, c.Token, hostType)
statusCode, response, onCloudRequestID, err := c.CallAPIMethod("DELETE", baseURL, nil, c.Token, hostType)
responseError := apiResponseChecker(statusCode, response, "deleteVolume")
if responseError != nil {
return responseError
}

log.Print("Wait for volume deletion.")
err = c.waitOnCompletion(onCloudRequestID, "volume", "delete", 10, 60)
if err != nil {
log.Print("deleteVolume request failed ", statusCode)
return err
Expand Down
43 changes: 43 additions & 0 deletions website/docs/d/cifs_server.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: "netapp_cloudmanager"
page_title: "NetApp_CloudManager: netapp_cloudmanager_cifs_server"
sidebar_current: "docs-netapp-cloudmanager-datasource-cifs-server"
description: |-
Provides a netapp-cloudmanager_cifs_server resource. This can be used to read a CIFS server on the Cloud Volume ONTAP system that requires a CIFS volume, based on an Active Directory or Workgroup.
---

# netapp_cloudmanager_cifs_server

Provides a netapp-cloudmanager_cifs_server resource. This can be used to read a CIFS server on the Cloud Volume ONTAP system that requires a CIFS volume, based on an Active Directory or Workgroup.
Requires existence of a Cloud Manager Connector and a Cloud Volumes ONTAP system.

## Example Usages

**Read netapp-cloudmanager_cifs_server:**

```
data "netapp-cloudmanager_cifs_server" "cvo-cifs" {
provider = netapp-cloudmanager
client_id = "AbCd6kdnLtvhwcgGvlFntdEHUfPJGc"
working_environment_name = "CvoName"
}
```

## Argument Reference

The following arguments are supported:

* `client_id` - (Required) The client ID of the Cloud Manager Connector. You can find the ID from a previous create Connector action as shown in the example, or from the Connector tab on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com).
* `working_environment_id` - (Optional) The public ID of the working environment where the CIFS server will be created. This argument is optional if working_environment_name is provided. You can find the ID from a previous create Cloud Volumes ONTAP action as shown in the example, or from the information page of the Cloud Volumes ONTAP working environment on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com).
* `working_environment_name` - (Optional) The working environment name where the CIFS server will be created. The argument will be ignored if working_environment_id is provided.

## Attributes Reference

The following attributes are exported in addition to the arguments listed above:

* `id` - The unique identifier of the working environment.
* `domain` - Active Directory domain name. For CIFS AD only.
* `dns_domain` - DNS domain name. For CIFS AD only.
* `ip_addresses` - DNS server IP addresses. For CIFS AD only.
* `netbios` - CIFS server NetBIOS name. For CIFS AD only.
* `organizational_unit` - Organizational Unit in which to register the CIFS server. For CIFS AD only.
37 changes: 37 additions & 0 deletions website/docs/d/nss_account.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: "netapp_cloudmanager"
page_title: "NetApp_CloudManager: netapp_cloudmanager_nss_account"
sidebar_current: "docs-netapp-cloudmanager-resource-nss-account"
description: |-
Provides a netapp-cloudmanager_nss_account resource. This can be used to read a NetApp Support Site account on the Cloud Manager system.
---

# netapp_cloudmanager_nss_account

Provides a netapp-cloudmanager_nss_account resource. This can be used to read a NetApp Support Site account on the Cloud Manager system.

## Example Usages

**Read netapp-cloudmanager_nss_account:**

```
data "netapp-cloudmanager_nss_account" "nss-account-1" {
provider = netapp-cloudmanager
client_id = "Nw4Q2O1kdnLtvhwegGalFnodEHUfPJWh"
name = "accountName"
}
```

## Argument Reference

The following arguments are supported:

* `client_id` - (Required) The client ID of the Cloud Manager Connector. You can find the ID from a previous create Connector action as shown in the example, or from the Connector tab on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com).
* `name` - (Required) Account name.

## Attributes Reference

The following attributes are exported in addition to the arguments listed above:

* `id` - The unique identifier of the account.
* `username` - NSS username. Not required in data source.
27 changes: 26 additions & 1 deletion website/docs/d/volume.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ data "netapp-cloudmanager_volume" "volume-nfs" {

The following arguments are supported:

* `client_id` - (Required) The client ID of the Cloud Manager Connector. You can find the ID from a previous create Connector action as shown in the example, or from the Connector tab on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com).
* `name` - (Required) The name of the volume.
* `working_environment_id` - (Optional) The public ID of the working environment where the volume exists. The ID can be optional if working_environment_name is provided. You can find the ID from the previous create Cloud Volumes ONTAP action as shown in the example, or from the Information page of the Cloud Volumes ONTAP working environment on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com).
* `working_environment_name` - (Optional) The working environment name where the volume exists. It will be ignored if working_environment_id is provided.
* `working_environment_name` - (Optional) The working environment name where the volume exists. It will be ignored if working_environment_id is provided.

## Attributes Reference

The following attributes are exported in addition to the arguments listed above:

* `svm_name` - The name of the SVM.
* `size` - The volume size, supported with decimal numbers.
* `size_unit` - ['Byte' or 'KB' or 'MB' or 'GB' or 'TB'].
* `provider_volume_type` - The underlying cloud provider volume type. For AWS: ["gp2", "io1", "st1", "sc1"]. For Azure: ['Premium_LRS','Standard_LRS','StandardSSD_LRS']. For GCP: ['pd-ssd','pd-standard']
* `enable_thin_provisioning` - Enable thin provisioning. The default is 'true'.
* `enable_compression` - Enable compression. The default is 'true'.
* `enable_deduplication` - Enable deduplication. The default is 'true'.
* `aggregate_name ` - The aggregate in which the volume will be created.
* `volume_protocol` - The protocol for the volume: ["nfs", "cifs", "iscsi"]. The default is 'nfs'
* `capacity_tier` - The volume's capacity tier for tiering cold data to object storage: ['S3', 'Blob', 'cloudStorage']. The default values for each cloud provider are as follows: Amazon => 'S3', Azure => 'Blob', GCP => 'cloudStorage'.
* `mount_point` The mount point.
* `export_policy_name` - The export policy name. (NFS protocol parameters)
* `export_policy_type` - The export policy type. (NFS protocol parameters)
* `export_policy_ip` - Custom export policy list of IPs. (NFS protocol parameters)
* `export_policy_nfs_version` - Export policy protocol. (NFS protocol parameters)
* `snapshot_policy_name` - Snapshot policy name. The default is 'default'. (NFS protocol parameters)
* `share_name` Share name. (CIFS protocol parameters)
* `permission` CIFS share permission type. (CIFS protocol parameters)
* `users` List of users with the permission. (CIFS protocol parameters)
6 changes: 3 additions & 3 deletions website/docs/r/aggregate.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ The following arguments are supported:
* `number_of_disks` - (Required) The required number of disks in the new aggregate.
* `disk_size_size` - (Optional) The required size of the disks. For GB, the unit can be: [100 or 500]. For TB, the unit can be: [1,2,4,8,16]. The default is '1'
* `disk_size_unit` - (Optional) The disk size unit ['GB' or 'TB']. The default is 'TB'
* `homeNode` - (Optional) The home node that the new aggregate should belong to. The default is the first node.
* `providerVolumeType` - (Optional) The cloud provider volume type. For AWS: ["gp2", "io1", "st1", "sc1"]. For Azure: ['Premium_LRS','Standard_LRS','StandardSSD_LRS']. For GCP: ['pd-ssd','pd-standard']
* `capacityTier` - (Optional) The aggregate's capacity tier for tiering cold data to object storage: ['S3', 'Blob', 'cloudStorage']. The default values for each cloud provider are as follows: Amazon => 'S3', Azure => 'Blob', GCP => 'cloudStorage'. If NONE, the capacity tier won't be set on aggregate creation.
* `home_node` - (Optional) The home node that the new aggregate should belong to. The default is the first node.
* `provider_volume_type` - (Optional) The cloud provider volume type. For AWS: ["gp2", "io1", "st1", "sc1"]. For Azure: ['Premium_LRS','Standard_LRS','StandardSSD_LRS']. For GCP: ['pd-ssd','pd-standard']
* `capacity_tier` - (Optional) The aggregate's capacity tier for tiering cold data to object storage: ['S3', 'Blob', 'cloudStorage']. The default values for each cloud provider are as follows: Amazon => 'S3', Azure => 'Blob', GCP => 'cloudStorage'. If NONE, the capacity tier won't be set on aggregate creation.
* `iops` - (Optional) Provisioned IOPS. Needed only when providerVolumeType is "io1"

## Attributes Reference
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/connector_aws.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ The following arguments are supported:
* `key_name` - (Required) The name of the key pair to use for the Connector instance.
* `instance_type` - (Required) The type of instance (for example, t3.xlarge). At least 4 CPU and 16 GB of memory are required.
* `subnet_id` - (Required) The ID of the subnet for the instance.
* `security_group_id` - (Required) The ID of the security group for the instance.
* `security_group_id` - (Required) The ID of the security group for the instance, multiple security groups can be provided seperated by ','.
* `iam_instance_profile_name` - (Required) The name of the instance profile for the Connector.
* `proxy_url` - (Optional) The proxy URL, if using a proxy to connect to the internet.
* `proxy_user_name` - (Optional) The proxy user name, if using a proxy to connect to the internet.
* `proxy_password` - (Optional) The proxy password, if using a proxy to connect to the internet.
* `associate_public_ip_address` - (Optional) Indicates whether to associate a public IP address to the instance. If not provided, the association will be done based on the subnet's configuration.
* `enable_termination_protection` - (Optional) Indicates whether to enable termination protection on the instance, default is false.
* `account_id` - (Optional) The NetApp account ID that the Connector will be associated with. If not provided, Cloud Manager uses the first account. If no account exists, Cloud Manager creates a new account. You can find the account ID in the account tab of Cloud Manager at [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com).

## Attributes Reference
Expand Down

0 comments on commit 6965ad8

Please sign in to comment.