-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update wireless profile api endpoint (#110)
- Loading branch information
1 parent
ec8fd51
commit bcb13be
Showing
15 changed files
with
366 additions
and
82 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
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,44 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "catalystcenter_wireless_profile Data Source - terraform-provider-catalystcenter" | ||
subcategory: "Wireless" | ||
description: |- | ||
This data source can read the Wireless Profile. | ||
--- | ||
|
||
# catalystcenter_wireless_profile (Data Source) | ||
|
||
This data source can read the Wireless Profile. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "catalystcenter_wireless_profile" "example" { | ||
id = "76d24097-41c4-4558-a4d0-a8c07ac08470" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `id` (String) The id of the object | ||
|
||
### Read-Only | ||
|
||
- `ssid_details` (Attributes List) SSID Details (see [below for nested schema](#nestedatt--ssid_details)) | ||
- `wireless_profile_name` (String) Wireless Network Profile Name | ||
|
||
<a id="nestedatt--ssid_details"></a> | ||
### Nested Schema for `ssid_details` | ||
|
||
Read-Only: | ||
|
||
- `dot11be_profile_id` (String) 802.11be Profile Id. Applicable to IOS controllers with version 17.15 and higher. 802.11be Profiles if passed, should be same across all SSIDs in network profile being configured | ||
- `enable_fabric` (Boolean) True if fabric is enabled, else False. Flex and fabric cannot be enabled simultaneously and a profile can only contain either flex SSIDs or fabric SSIDs and not both at the same time | ||
- `enable_flex_connect` (Boolean) True if flex connect is enabled, else False. Flex and fabric cannot be enabled simultaneously and a profile can only contain either flex SSIDs or fabric SSIDs and not both at the same time | ||
- `interface_name` (String) Interface Name | ||
- `local_to_vlan` (Number) Local To Vlan Id | ||
- `ssid_name` (String) SSID Name | ||
- `wlan_profile_name` (String) WLAN Profile Name |
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
3 changes: 3 additions & 0 deletions
3
examples/data-sources/catalystcenter_wireless_profile/data-source.tf
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 @@ | ||
data "catalystcenter_wireless_profile" "example" { | ||
id = "76d24097-41c4-4558-a4d0-a8c07ac08470" | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
terraform import catalystcenter_wireless_profile.example "<id>" | ||
terraform import catalystcenter_wireless_profile.example "4b0b7a80-44c0-4bf2-bab5-fc24b4e0a17e" |
4 changes: 2 additions & 2 deletions
4
examples/resources/catalystcenter_wireless_profile/resource.tf
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
146 changes: 146 additions & 0 deletions
146
internal/provider/data_source_catalystcenter_wireless_profile.go
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,146 @@ | ||
// Copyright © 2023 Cisco Systems, Inc. and its affiliates. | ||
// All rights reserved. | ||
// | ||
// Licensed under the Mozilla Public License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://mozilla.org/MPL/2.0/ | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package provider | ||
|
||
// Section below is generated&owned by "gen/generator.go". //template:begin imports | ||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/datasource" | ||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema" | ||
"github.com/hashicorp/terraform-plugin-log/tflog" | ||
cc "github.com/netascode/go-catalystcenter" | ||
) | ||
|
||
// End of section. //template:end imports | ||
|
||
// Section below is generated&owned by "gen/generator.go". //template:begin model | ||
|
||
// Ensure the implementation satisfies the expected interfaces. | ||
var ( | ||
_ datasource.DataSource = &WirelessProfileDataSource{} | ||
_ datasource.DataSourceWithConfigure = &WirelessProfileDataSource{} | ||
) | ||
|
||
func NewWirelessProfileDataSource() datasource.DataSource { | ||
return &WirelessProfileDataSource{} | ||
} | ||
|
||
type WirelessProfileDataSource struct { | ||
client *cc.Client | ||
} | ||
|
||
func (d *WirelessProfileDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { | ||
resp.TypeName = req.ProviderTypeName + "_wireless_profile" | ||
} | ||
|
||
func (d *WirelessProfileDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { | ||
resp.Schema = schema.Schema{ | ||
// This description is used by the documentation generator and the language server. | ||
MarkdownDescription: "This data source can read the Wireless Profile.", | ||
|
||
Attributes: map[string]schema.Attribute{ | ||
"id": schema.StringAttribute{ | ||
MarkdownDescription: "The id of the object", | ||
Required: true, | ||
}, | ||
"wireless_profile_name": schema.StringAttribute{ | ||
MarkdownDescription: "Wireless Network Profile Name", | ||
Computed: true, | ||
}, | ||
"ssid_details": schema.ListNestedAttribute{ | ||
MarkdownDescription: "SSID Details", | ||
Computed: true, | ||
NestedObject: schema.NestedAttributeObject{ | ||
Attributes: map[string]schema.Attribute{ | ||
"ssid_name": schema.StringAttribute{ | ||
MarkdownDescription: "SSID Name", | ||
Computed: true, | ||
}, | ||
"enable_fabric": schema.BoolAttribute{ | ||
MarkdownDescription: "True if fabric is enabled, else False. Flex and fabric cannot be enabled simultaneously and a profile can only contain either flex SSIDs or fabric SSIDs and not both at the same time", | ||
Computed: true, | ||
}, | ||
"enable_flex_connect": schema.BoolAttribute{ | ||
MarkdownDescription: "True if flex connect is enabled, else False. Flex and fabric cannot be enabled simultaneously and a profile can only contain either flex SSIDs or fabric SSIDs and not both at the same time", | ||
Computed: true, | ||
}, | ||
"local_to_vlan": schema.Int64Attribute{ | ||
MarkdownDescription: "Local To Vlan Id", | ||
Computed: true, | ||
}, | ||
"interface_name": schema.StringAttribute{ | ||
MarkdownDescription: "Interface Name", | ||
Computed: true, | ||
}, | ||
"wlan_profile_name": schema.StringAttribute{ | ||
MarkdownDescription: "WLAN Profile Name", | ||
Computed: true, | ||
}, | ||
"dot11be_profile_id": schema.StringAttribute{ | ||
MarkdownDescription: "802.11be Profile Id. Applicable to IOS controllers with version 17.15 and higher. 802.11be Profiles if passed, should be same across all SSIDs in network profile being configured", | ||
Computed: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func (d *WirelessProfileDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) { | ||
if req.ProviderData == nil { | ||
return | ||
} | ||
|
||
d.client = req.ProviderData.(*CcProviderData).Client | ||
} | ||
|
||
// End of section. //template:end model | ||
|
||
// Section below is generated&owned by "gen/generator.go". //template:begin read | ||
func (d *WirelessProfileDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { | ||
var config WirelessProfile | ||
|
||
// Read config | ||
diags := req.Config.Get(ctx, &config) | ||
resp.Diagnostics.Append(diags...) | ||
if resp.Diagnostics.HasError() { | ||
return | ||
} | ||
|
||
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String())) | ||
|
||
params := "" | ||
res, err := d.client.Get(config.getPath() + params) | ||
if err != nil { | ||
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err)) | ||
return | ||
} | ||
res = res.Get("response.#(id==\"" + config.Id.ValueString() + "\")") | ||
|
||
config.fromBody(ctx, res) | ||
|
||
tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Id.ValueString())) | ||
|
||
diags = resp.State.Set(ctx, &config) | ||
resp.Diagnostics.Append(diags...) | ||
} | ||
|
||
// End of section. //template:end read |
Oops, something went wrong.