Skip to content

Commit 78e051d

Browse files
tongyimingmikatong
andauthored
fix cls support query ip info (#1186)
* fix cls support query ip info * callback go.mod Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 7a21793 commit 78e051d

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
698698
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
699699
golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o=
700700
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
701+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
702+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
701703
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
702704
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
703705
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=

tencentcloud/data_source_tc_cfs_file_systems.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ func dataSourceTencentCloudCfsFileSystems() *schema.Resource {
115115
Computed: true,
116116
Description: "Size used of the file system.",
117117
},
118+
"mount_ip": {
119+
Type: schema.TypeString,
120+
Computed: true,
121+
Description: "IP of the file system.",
122+
},
118123
},
119124
},
120125
},
@@ -185,6 +190,17 @@ func dataSourceTencentCloudCfsFileSystemsRead(d *schema.ResourceData, meta inter
185190
"size_limit": fileSystem.SizeLimit,
186191
"size_used": fileSystem.SizeByte,
187192
}
193+
targets, err := cfsService.DescribeMountTargets(ctx, *fileSystem.FileSystemId)
194+
if err != nil {
195+
return err
196+
}
197+
var mountTarget *cfs.MountInfo
198+
if len(targets) > 0 {
199+
mountTarget = targets[0]
200+
}
201+
if mountTarget != nil {
202+
mapping["mount_ip"] = mountTarget.IpAddress
203+
}
188204
fileSystemList = append(fileSystemList, mapping)
189205
ids = append(ids, *fileSystem.FileSystemId)
190206
}

tencentcloud/data_source_tc_cfs_file_systems_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func TestAccTencentCloudCfsFileSystemsDataSource(t *testing.T) {
2525
resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.access_group_id"),
2626
resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.status"),
2727
resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.create_time"),
28+
resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.mount_ip"),
2829
),
2930
},
3031
},

website/docs/d/cfs_file_systems.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ In addition to all arguments above, the following attributes are exported:
4141
* `availability_zone` - The available zone that the file system locates at.
4242
* `create_time` - Creation time of the file system.
4343
* `file_system_id` - ID of the file system.
44+
* `mount_ip` - IP of the file system.
4445
* `name` - Name of the file system.
4546
* `protocol` - Protocol of the file system.
4647
* `size_limit` - Size limit of the file system.

0 commit comments

Comments
 (0)