-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for aci_snmp_community a more generic version of aci_vrf_…
…snmp_context_community and deprecate aci_vrf_snmp_context_community
- Loading branch information
Showing
13 changed files
with
471 additions
and
55 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,50 @@ | ||
package aci | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/ciscoecosystem/aci-go-client/client" | ||
"github.com/ciscoecosystem/aci-go-client/models" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func dataSourceAciSNMPCommunityDeprecated() *schema.Resource { | ||
return &schema.Resource{ | ||
DeprecationMessage: "Use aci_snmp_community data source instead", | ||
ReadContext: dataSourceAciSNMPCommunityReadDeprecated, | ||
SchemaVersion: 1, | ||
Schema: AppendBaseAttrSchema(AppendNameAliasAttrSchema(map[string]*schema.Schema{ | ||
"vrf_snmp_context_dn": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
"name": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
})), | ||
} | ||
} | ||
|
||
func dataSourceAciSNMPCommunityReadDeprecated(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { | ||
aciClient := m.(*client.Client) | ||
name := d.Get("name").(string) | ||
parentDn := d.Get("vrf_snmp_context_dn").(string) | ||
dn := fmt.Sprintf(models.DnsnmpCommunityP, parentDn, name) | ||
|
||
snmpCommunityP, err := getRemoteSNMPCommunity(aciClient, dn) | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
d.SetId(dn) | ||
|
||
_, err = setSNMPCommunityAttributesDeprecated(snmpCommunityP, d) | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
return nil | ||
} |
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
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
Oops, something went wrong.