-
Notifications
You must be signed in to change notification settings - Fork 14
Update wireless_profile resource to use new api intent/api/v1/wirelessProfiles #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
danischm
merged 35 commits into
CiscoDevNet:main
from
kuba-mazurkiewicz:wireless_profile2
Aug 8, 2024
Merged
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
c95fc8e
added GenerateQueryParamString templating helper function
kuba-mazurkiewicz b853a94
use create_query_path instead of query_param in Create and Update fun…
kuba-mazurkiewicz d0e2c6f
add query_param_no_body and data_source_no_id attributes
kuba-mazurkiewicz c1381fd
add import_no_id attribute, if import does not require and ID
kuba-mazurkiewicz a98ad26
add anycast_gateway
kuba-mazurkiewicz 5545db0
update changelog
kuba-mazurkiewicz 9c69bd5
add transitPeerNetworkId as id to transit_peer_network resource
kuba-mazurkiewicz c70bd2a
updated changelog
kuba-mazurkiewicz 38d93bf
add fabric_l3_handoff_ip_transit resource and data source
kuba-mazurkiewicz 59173f3
add fabric_device resource and data source
kuba-mazurkiewicz 522d49c
pnp bulk import
kuba-mazurkiewicz 30854ad
update changelog
kuba-mazurkiewicz 9a6533c
rename pnp_device_import to pnp_import_devices
kuba-mazurkiewicz 35565f0
add tag and assign_templates_to_tag
kuba-mazurkiewicz 241fe0a
changed template_ids from List to Set
kuba-mazurkiewicz 2db5bce
update changelog
kuba-mazurkiewicz b10aeaa
add fabric_provision_device resource and data source
kuba-mazurkiewicz f478bfb
modified max_async_wait_time in fabric_device resource
kuba-mazurkiewicz 25435ac
modified max_async_wait_time in fabric_provision_device resource
kuba-mazurkiewicz 01fefd8
add wireless_device_provision, add additional params in enterprise_ss…
kuba-mazurkiewicz 4906ccb
update changelog
kuba-mazurkiewicz 9f31f09
Merge branch 'main' into tags_to_template
kuba-mazurkiewicz df90953
update changelog
kuba-mazurkiewicz c8291fd
modified res_description
kuba-mazurkiewicz 7252a29
Merge branch 'tags_to_template' into provision_sda
kuba-mazurkiewicz efa562b
Merge branch 'provision_sda' into fix_provision_borders
kuba-mazurkiewicz 9a02a97
fix data source test for resources with data_source_no_id: true
kuba-mazurkiewicz 7b1404d
fix confilcts
kuba-mazurkiewicz efb6157
update changelog
kuba-mazurkiewicz a7d936f
fix typo in virtualNetworkName description in fabric_l3_handoff_ip_tr…
kuba-mazurkiewicz d3c42c2
modified wireless_profile to use new endpoint /intent/api/v1/wireless…
kuba-mazurkiewicz ce879d8
add test tag CC2376 to wireles_profile resource
kuba-mazurkiewicz f74ce30
update changelog
kuba-mazurkiewicz 7d3ba2f
removed test tag from wireless_profile
kuba-mazurkiewicz 4496a67
removed ghz24_policy from test prerequisites
kuba-mazurkiewicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.