Skip to content

Commit

Permalink
resolve conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjun666 committed Aug 20, 2024
2 parents a189c09 + e31aeb9 commit 1336f97
Show file tree
Hide file tree
Showing 29 changed files with 1,316 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ FEATURES:
* **New Data Source:** `netapp-ontap_quota_rule` ([#135](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/135))
* **New Data Source:** `netapp-ontap_security_role` ([#139](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/139))
* **New Data Source:** `netapp-ontap_security_roles` ([#139](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/139))
* **New Data Source:** `netapp-ontap_security_login_message` ([#17](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/17))
* **New Data Source:** `netapp-ontap_security_login_messages` ([#17](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/17))
* **New Resource:** `netapp-ontap_volume_efficiency_policies` ([#80](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/80))
* **New Resource:** `netapp-ontap_quota_rules` ([#136](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/136))
* **New Resource:** `netapp-ontap_volumes_files` ([#5](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/5))

ENHANCEMENTS:
* **netapp-ontap_lun**: added `size_unit` option. ([#227](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/227))
Expand Down
40 changes: 40 additions & 0 deletions docs/data-sources/security_login_message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_security_login_message Data Source - terraform-provider-netapp-ontap"
subcategory: "Security"
description: |-
Retrieve Security Login Message data source
---

# netapp-ontap_security_login_message (Data Source)

Retrieve Security Login Message data source

## Example Usage

```terraform
data "netapp-ontap_security_login_message" "security_login_message" {
# required to know which system to interface with
cx_profile_name = "cluster4"
svm_name = "ansibleSVM"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cx_profile_name` (String) Connection profile name

### Optional

- `banner` (String) SecurityLoginMessage banner
- `message` (String) SecurityLoginMessage name
- `scope` (String) SecurityLoginMessage scope
- `show_cluster_message` (Boolean) Show cluster message
- `svm_name` (String) SecurityLoginMessage svm name

### Read-Only

- `id` (String) SecurityAccount id
68 changes: 68 additions & 0 deletions docs/data-sources/security_login_messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_security_login_messages Data Source - terraform-provider-netapp-ontap"
subcategory: "Security"
description: |-
Retrieve Security Login Messages data source
---

# netapp-ontap_security_login_messages (Data Source)

Retrieve Security Login Messages data source

## Example Usage

```terraform
data "netapp-ontap_security_login_messages" "security_login_messages" {
# required to know which system to interface with
cx_profile_name = "cluster4"
filter = {
scope = "svm"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cx_profile_name` (String) Connection profile name

### Optional

- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `security_login_messages` (Attributes List) (see [below for nested schema](#nestedatt--security_login_messages))

<a id="nestedatt--filter"></a>
### Nested Schema for `filter`

Optional:

- `banner` (String) SecurityLoginMessage banner
- `message` (String) SecurityLoginMessage message
- `scope` (String) SecurityLoginMessage scope
- `svm_name` (String) SecurityLoginMessage svm name


<a id="nestedatt--security_login_messages"></a>
### Nested Schema for `security_login_messages`

Required:

- `cx_profile_name` (String) Connection profile name

Optional:

- `svm_name` (String) SecurityLoginMessage svm name

Read-Only:

- `banner` (String) SecurityLoginMessage banner
- `id` (String) SecurityLoginMessage id
- `message` (String) SecurityLoginMessage message
- `scope` (String) SecurityLoginMessage scope
- `show_cluster_message` (Boolean) Show cluster message
97 changes: 97 additions & 0 deletions docs/resources/storage_volumes_files_resource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_volumes_files Resource - terraform-provider-netapp-ontap"
subcategory: "Storage"
description: |-
VolumesFiles resource
---

# netapp-ontap_volumes_files (Resource)

Create/Modify/Delete a VolumesFiles resource

## Supported Platforms
* On-perm ONTAP system 9.6 or higher

## Example Usage

```terraform
resource "netapp-ontap_volumes_files" "volumes_files" {
# required to know which system to interface with
cx_profile_name = "cluster1"
path = "vol4"
volume_name = "terraform"
svm_name = "terraform"
type = "directory"
unix_permissions = "755"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cx_profile_name` (String) Connection profile name
- `path` (String) Relative path of a file or directory in the volume
- `svm_name` (String) Name of the svm to use
- `volume_name` (String) Volume name

### Optional

- `byte_offset` (Number) The number of bytes used
- `name` (String) The name of the file or directory
- `overwrite` (Boolean) Whether the file can be overwritten
- `type` (String) The type of the file or directory
- `unix_permissions` (Number) UNIX permissions to be viewed as an octal number

### Read-Only

- `id` (String) VolumesFiles path is used as ID here
- `size` (Number) The size of the file or directory

## Import
This Resource supports import, which allows you to import existing volume files into the state of this resoruce.
Import require a unique ID composed of the volume_name, svm_name, path and cx_profile_name, separated by a comma.

id = `volume_name`,`svm_name`, `path`, `cx_profile_name`

### Terraform Import

For example
```shell
terraform import netapp-ontap_volumes_files.example vol2,svm1,path,cluster4
```

!> The terraform import CLI command can only import resources into the state. Importing via the CLI does not generate configuration. If you want to generate the accompanying configuration for imported resources, use the import block instead.

### Terraform Import Block
This requires Terraform 1.5 or higher, and will auto create the configuration for you

First create the block
```terraform
import {
to = netapp-ontap_volumes_files.files_import
id = "vol1,svm1,path,cluster4"
}
```
Next run, this will auto create the configuration for you
```shell
terraform plan -generate-config-out=generated.tf
```
This will generate a file called generated.tf, which will contain the configuration for the imported resource
```terraform
# __generated__ by Terraform
# Please review these resources and move them into your main configuration files.
# __generated__ by Terraform from "vol1,svm1,vol3,cluster4"
resource "netapp-ontap_volumes_files" "files_import" {
cx_profile_name = "cluster4"
volume_name = "vol1"
svm_name = "svm1"
id = "vol3"
path = "vol3"
size = 4096
type = "directory"
unix_permissions = 755
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data "netapp-ontap_security_login_message" "security_login_message" {
# required to know which system to interface with
cx_profile_name = "cluster4"
svm_name = "ansibleSVM"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "netapp-ontap_security_login_messages" "security_login_messages" {
# required to know which system to interface with
cx_profile_name = "cluster4"
filter = {
scope = "svm"
}
}
1 change: 1 addition & 0 deletions examples/resources/netapp-ontap_volumes_files/provider.tf
9 changes: 9 additions & 0 deletions examples/resources/netapp-ontap_volumes_files/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "netapp-ontap_volumes_files" "volumes_files" {
# required to know which system to interface with
cx_profile_name = "cluster1"
path = "vol3"
volume_name = "terraform"
svm_name = "terraform"
type = "directory"
unix_permissions = "755"
}
1 change: 1 addition & 0 deletions examples/resources/netapp-ontap_volumes_files/variables.tf
8 changes: 4 additions & 4 deletions internal/interfaces/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ type versionModelONTAP struct {

// ipAddress describes the IP data model used in mgmtInterface.
type ipAddress struct {
Address string
Address string `mapstructure:"address"`
}

// noddMgmtInterface describes the Management Interface data model used in ClusterNodeGetDataModelONTAP.
type noddMgmtInterface struct {
IP ipAddress
IP ipAddress `mapstructure:"ip"`
}

// ClusterNodeGetDataModelONTAP describes the GET record data model using go types for mapping.
Expand Down Expand Up @@ -162,9 +162,9 @@ func GetClusterNodes(errorHandler *utils.ErrorHandler, r restclient.RestClient)
}
tflog.Debug(errorHandler.Ctx, fmt.Sprintf("Read cluster data source NODES - records: %#v", records))

var dataONTAP ClusterNodeGetDataModelONTAP
nodes := []ClusterNodeGetDataModelONTAP{}
var nodes []ClusterNodeGetDataModelONTAP
for _, record := range records {
var dataONTAP ClusterNodeGetDataModelONTAP
if err := mapstructure.Decode(record, &dataONTAP); err != nil {
return nil, errorHandler.MakeAndReportError("error decoding cluster nodes info", fmt.Sprintf("error: %s, statusCode %d, record %#v", err, statusCode, record))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/interfaces/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestGetClusterNodes(t *testing.T) {
want []ClusterNodeGetDataModelONTAP
wantErr bool
}{
{name: "test_no_records_1", responses: responses["test_no_records_1"], want: []ClusterNodeGetDataModelONTAP{}, wantErr: false},
{name: "test_no_records_1", responses: responses["test_no_records_1"], want: nil, wantErr: false},
{name: "test_one_record_1", responses: responses["test_one_record_1"], want: expectedOneRecord, wantErr: false},
{name: "test_two_records_1", responses: responses["test_two_records_1"], want: expectedTwoRecords, wantErr: false},
{name: "test_error_1", responses: responses["test_error_1"], want: nil, wantErr: true},
Expand Down
Loading

0 comments on commit 1336f97

Please sign in to comment.