From 1f9257aadabf5af9cda7f9f0daecaea6f7ff26f6 Mon Sep 17 00:00:00 2001 From: Rutvik Shiyani <88027613+RutvikS-crest@users.noreply.github.com> Date: Mon, 8 Aug 2022 10:12:43 +0530 Subject: [PATCH] Aci provider (#82) Phase 2 resources --- cmd/root.go | 4 + docs/aci.md | 64 +++++++- go.sum | 2 + providers/aci/aaep_to_domain.go | 60 ++++++++ providers/aci/access_switch_policy_group.go | 53 +++++++ providers/aci/aci_provider.go | 143 ++++++++++++++++++ .../aci/action_rule_additional_communities.go | 60 ++++++++ providers/aci/annotation.go | 60 ++++++++ providers/aci/authentication_properties.go | 55 +++++++ providers/aci/bfd_interface_policy.go | 56 +++++++ providers/aci/console_authentication.go | 56 +++++++ providers/aci/coop_policy.go | 56 +++++++ providers/aci/default_auth.go | 57 +++++++ providers/aci/duo_provider_group.go | 57 +++++++ providers/aci/encryption_key.go | 59 ++++++++ providers/aci/endpoint_controls.go | 57 +++++++ providers/aci/endpoint_ip_aging_profile.go | 57 +++++++ providers/aci/endpoint_loop_protection.go | 57 +++++++ providers/aci/epg_to_contract_interface.go | 62 ++++++++ providers/aci/error_disable_recovery.go | 91 +++++++++++ providers/aci/fabric_node_control.go | 56 +++++++ providers/aci/fabric_wide_settings.go | 57 +++++++ providers/aci/file_remote_path.go | 52 +++++++ providers/aci/global_security.go | 57 +++++++ providers/aci/interface_blacklist.go | 57 +++++++ providers/aci/isis_domain_policy.go | 57 +++++++ providers/aci/l3_interface_policy.go | 53 +++++++ providers/aci/ldap_group_map.go | 66 ++++++++ providers/aci/ldap_group_map_rule.go | 67 ++++++++ .../aci/ldap_group_map_rule_to_group_map.go | 60 ++++++++ providers/aci/ldap_provider.go | 57 +++++++ providers/aci/login_domain.go | 57 +++++++ providers/aci/login_domain_provider.go | 60 ++++++++ .../aci/managed_node_connectivity_group.go | 53 +++++++ providers/aci/match_community_terms.go | 107 +++++++++++++ providers/aci/match_regex_community_terms.go | 60 ++++++++ providers/aci/match_route_destination_rule.go | 60 ++++++++ providers/aci/match_rule.go | 60 ++++++++ providers/aci/mcp_instance_policy.go | 57 +++++++ providers/aci/mgmt_preference.go | 56 +++++++ providers/aci/mgmt_zone.go | 98 ++++++++++++ providers/aci/port_tracking.go | 56 +++++++ providers/aci/qos_instance_policy.go | 57 +++++++ providers/aci/radius_provider.go | 57 +++++++ providers/aci/radius_provider_group.go | 52 +++++++ providers/aci/recurring_window.go | 60 ++++++++ providers/aci/route_control_context.go | 60 ++++++++ providers/aci/route_control_profile.go | 60 ++++++++ providers/aci/rsa_provider.go | 57 +++++++ providers/aci/saml_provider.go | 52 +++++++ providers/aci/saml_provider_group.go | 57 +++++++ providers/aci/spine_access_port_selector.go | 61 ++++++++ .../aci/spine_interface_profile_selector.go | 60 ++++++++ providers/aci/spine_switch_policy_group.go | 53 +++++++ providers/aci/tacacs_accounting.go | 57 +++++++ .../aci/tacacs_accounting_destination.go | 57 +++++++ providers/aci/tacacs_provider.go | 57 +++++++ providers/aci/tacacs_provider_group.go | 57 +++++++ providers/aci/tacacs_source.go | 60 ++++++++ providers/aci/tag.go | 60 ++++++++ providers/aci/user_security_domain.go | 59 ++++++++ providers/aci/user_security_domain_role.go | 59 ++++++++ providers/aci/vpc_domain_policy.go | 58 +++++++ providers/aci/vrf_snmp_context.go | 58 +++++++ providers/aci/vrf_snmp_context_community.go | 59 ++++++++ .../aci/vrf_to_bgp_address_family_context.go | 56 +++++++ 66 files changed, 3911 insertions(+), 1 deletion(-) create mode 100644 providers/aci/aaep_to_domain.go create mode 100644 providers/aci/access_switch_policy_group.go create mode 100644 providers/aci/action_rule_additional_communities.go create mode 100644 providers/aci/annotation.go create mode 100644 providers/aci/authentication_properties.go create mode 100644 providers/aci/bfd_interface_policy.go create mode 100644 providers/aci/console_authentication.go create mode 100644 providers/aci/coop_policy.go create mode 100644 providers/aci/default_auth.go create mode 100644 providers/aci/duo_provider_group.go create mode 100644 providers/aci/encryption_key.go create mode 100644 providers/aci/endpoint_controls.go create mode 100644 providers/aci/endpoint_ip_aging_profile.go create mode 100644 providers/aci/endpoint_loop_protection.go create mode 100644 providers/aci/epg_to_contract_interface.go create mode 100644 providers/aci/error_disable_recovery.go create mode 100644 providers/aci/fabric_node_control.go create mode 100644 providers/aci/fabric_wide_settings.go create mode 100644 providers/aci/file_remote_path.go create mode 100644 providers/aci/global_security.go create mode 100644 providers/aci/interface_blacklist.go create mode 100644 providers/aci/isis_domain_policy.go create mode 100644 providers/aci/l3_interface_policy.go create mode 100644 providers/aci/ldap_group_map.go create mode 100644 providers/aci/ldap_group_map_rule.go create mode 100644 providers/aci/ldap_group_map_rule_to_group_map.go create mode 100644 providers/aci/ldap_provider.go create mode 100644 providers/aci/login_domain.go create mode 100644 providers/aci/login_domain_provider.go create mode 100644 providers/aci/managed_node_connectivity_group.go create mode 100644 providers/aci/match_community_terms.go create mode 100644 providers/aci/match_regex_community_terms.go create mode 100644 providers/aci/match_route_destination_rule.go create mode 100644 providers/aci/match_rule.go create mode 100644 providers/aci/mcp_instance_policy.go create mode 100644 providers/aci/mgmt_preference.go create mode 100644 providers/aci/mgmt_zone.go create mode 100644 providers/aci/port_tracking.go create mode 100644 providers/aci/qos_instance_policy.go create mode 100644 providers/aci/radius_provider.go create mode 100644 providers/aci/radius_provider_group.go create mode 100644 providers/aci/recurring_window.go create mode 100644 providers/aci/route_control_context.go create mode 100644 providers/aci/route_control_profile.go create mode 100644 providers/aci/rsa_provider.go create mode 100644 providers/aci/saml_provider.go create mode 100644 providers/aci/saml_provider_group.go create mode 100644 providers/aci/spine_access_port_selector.go create mode 100644 providers/aci/spine_interface_profile_selector.go create mode 100644 providers/aci/spine_switch_policy_group.go create mode 100644 providers/aci/tacacs_accounting.go create mode 100644 providers/aci/tacacs_accounting_destination.go create mode 100644 providers/aci/tacacs_provider.go create mode 100644 providers/aci/tacacs_provider_group.go create mode 100644 providers/aci/tacacs_source.go create mode 100644 providers/aci/tag.go create mode 100644 providers/aci/user_security_domain.go create mode 100644 providers/aci/user_security_domain_role.go create mode 100644 providers/aci/vpc_domain_policy.go create mode 100644 providers/aci/vrf_snmp_context.go create mode 100644 providers/aci/vrf_snmp_context_community.go create mode 100644 providers/aci/vrf_to_bgp_address_family_context.go diff --git a/cmd/root.go b/cmd/root.go index ada6783969..f93c7b28fe 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -84,6 +84,8 @@ func providerImporterSubcommands() []func(options ImportOptions) *cobra.Command newCmdGmailfilterImporter, newCmdVaultImporter, newCmdOktaImporter, + // ACI + newCmdACIImporter, newCmdAuth0Importer, // ACI newCmdACIImporter, @@ -134,6 +136,8 @@ func providerGenerators() map[string]func() terraformutils.ProviderGenerator { newGmailfilterProvider, newVaultProvider, newOktaProvider, + // ACI + newACIProvider, newAuth0Provider, // ACI newACIProvider, diff --git a/docs/aci.md b/docs/aci.md index 024231e93f..52bef3a435 100644 --- a/docs/aci.md +++ b/docs/aci.md @@ -19,7 +19,9 @@ terraformer import aci --help * `tenant` * `action_rule_profile` + * `action_rule_additional_communities` * `monitoring_policy` + * `tacacs_source` * `cloud_applicationcontainer` * `cloud_epg` * `cloud_endpoint_selector` @@ -32,8 +34,12 @@ terraformer import aci --help * `epg_to_contract` * `epg_to_domain` * `epg_to_static_path` + * `epg_to_contract_interface` * `vrf` * `any` + * `vrf_snmp_context` + * `vrf_snmp_context_community` + * `vrf_to_bgp_address_family_context` * `bgp_route_control_profile` * `cloud_context_profile` * `cloud_cidr_pool` @@ -101,6 +107,13 @@ terraformer import aci --help * `span_source_group` * `span_sourcedestination_group_match_label` * `end_point_retention_policy` + * `bfd_interface_policy` + * `route_control_profile` + * `route_control_context` + * `match_rule` + * `match_regex_community_terms` + * `match_route_destination_rule` + * `match_community_terms` * `vpc_explicit_protection_group` * `l3_domain_profile` * `vmm_domain` @@ -112,6 +125,7 @@ terraformer import aci --help * `access_generic` * `epgs_using_function` * `vlan_encapsulationfor_vxlan_traffic` + * `aaep_to_domain` * `leaf_interface_profile` * `access_port_selector` * `access_group` @@ -137,14 +151,19 @@ terraformer import aci --help * `spine_profile` * `spine_switch_association` * `spine_port_selector` + * `spine_interface_profile_selector` * `spine_interface_profile` + * `spine_access_port_selector` * `spine_port_policy_group` * `fabric_if_pol` * `node_mgmt_epg` * `static_node_mgmt_address` * `local_user` * `x509_certificate` + * `user_security_domain` + * `user_security_domain_role` * `trigger_scheduler` + * `aci_recurring_window` * `spanning_tree_interface_policy` * `maintenance_policy` * `configuration_export_policy` @@ -162,7 +181,50 @@ terraformer import aci --help * `fc_domain` * `pod_maintenance_group` * `maintenance_group_node` - +* `access_switch_policy_group` +* `l3_interface_policy` +* `mgmt_preference` +* `fabric_node_control` +* `fabric_wide_settings` +* `encryption_key` +* `port_tracking` +* `coop_policy` +* `error_disable_recovery` +* `spine_switch_policy_group` +* `duo_provider_group` + * `login_domain_provider` +* `ldap_provider` +* `tacacs_accounting` + * `tacacs_accounting_destination` +* `rsa_provider` +* `saml_provider_group` +* `console_authentication` +* `qos_instance_policy` +* `mcp_instance_policy` +* `ldap_group_map` + * `ldap_group_map_rule_to_group_map` +* `file_remote_path` +* `radius_provider_group` +* `saml_provider` +* `vpc_domain_policy` +* `managed_node_connectivity_group` + * `aci_mgmt_zone` +* `vpc_domain_policy` +* `endpoint_loop_protection` +* `endpoint_controls` +* `endpoint_ip_aging_profile` +* `annotation` +* `interface_blacklist` +* `radius_provider` +* `default_authentication` +* `tacacs_provider` +* `tacacs_provider_group` +* `tag` +* `ldap_group_map_rule` +* `authentication_properties` +* `isis_domain_policy` +* `global_security` +* `login_domain` #### Attribute filters diff --git a/go.sum b/go.sum index 8a25b044b0..edf4fa8f66 100644 --- a/go.sum +++ b/go.sum @@ -980,6 +980,8 @@ github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba h1:NARVGAAgEXvoM github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba h1:NARVGAAgEXvoMeNPHhPFt1SBt1VMznA3Gnz9d0qj+co= github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= +github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/providers/aci/aaep_to_domain.go b/providers/aci/aaep_to_domain.go new file mode 100644 index 0000000000..8777842af4 --- /dev/null +++ b/providers/aci/aaep_to_domain.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const domainClassName = "infraRsDomP" + +type DomainGenerator struct { + ACIService +} + +func (a *DomainGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, domainClassName) + + DomainCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + DomainCount, err := strconv.Atoi(stripQuotes(DomainCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < DomainCount; i++ { + DomainAttr := DomainCont.S("imdata").Index(i).S(domainClassName, "attributes") + DomainDN := G(DomainAttr, "dn") + tDn := G(DomainAttr, "tDn") + if filterChildrenDn(DomainDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + DomainDN, + resourceNamefromDn(domainClassName, DomainDN, i), + "aci_aaep_to_domain", + "aci", + map[string]string{ + "attachable_access_entity_profile_dn": GetParentDn(DomainDN, fmt.Sprintf("/rsdomP-[%s]", tDn)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/access_switch_policy_group.go b/providers/aci/access_switch_policy_group.go new file mode 100644 index 0000000000..78610dcc63 --- /dev/null +++ b/providers/aci/access_switch_policy_group.go @@ -0,0 +1,53 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const accessSwitchPolicyGroupClassName = "infraAccNodePGrp" + +type AccessSwitchPolicyGroupGenerator struct { + ACIService +} + +func (a *AccessSwitchPolicyGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, accessSwitchPolicyGroupClassName) + AccessSwitchPolicyGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + AccessSwitchPolicyGroupCount, err := strconv.Atoi(stripQuotes(AccessSwitchPolicyGroupCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < AccessSwitchPolicyGroupCount; i++ { + AccessSwitchPolicyGroupAttr := AccessSwitchPolicyGroupCont.S("imdata").Index(i).S(accessSwitchPolicyGroupClassName, "attributes") + AccessSwitchPolicyGroupDN := G(AccessSwitchPolicyGroupAttr, "dn") + if filterChildrenDn(AccessSwitchPolicyGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + AccessSwitchPolicyGroupDN, + resourceNamefromDn(accessSwitchPolicyGroupClassName, AccessSwitchPolicyGroupDN, i), + "aci_access_switch_policy_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/aci_provider.go b/providers/aci/aci_provider.go index dc24a61335..12a47d58a6 100644 --- a/providers/aci/aci_provider.go +++ b/providers/aci/aci_provider.go @@ -165,6 +165,10 @@ func (p ACIProvider) GetResourceConnections() map[string]map[string][]string { "epg_to_static_path": { "application_epg": []string{"application_epg_dn", "id"}, }, + "epg_to_contract_interface": { + "application_epg": []string{"application_epg_dn", "id"}, + "imported_contract": []string{"contract_interface_dn", "id"}, + }, "imported_contract": { "tenant": []string{"tenant_dn", "id"}, }, @@ -256,6 +260,10 @@ func (p ACIProvider) GetResourceConnections() map[string]map[string][]string { "spine_port_selector": { "spine_profile": []string{"spine_profile_dn", "id"}, }, + "spine_interface_profile_selector": { + "spine_profile": []string{"spine_profile_dn", "id"}, + "spine_interface_profile": []string{"tdn", "id"}, + }, "epgs_using_function": { "access_generic": []string{"access_generic_dn", "id"}, }, @@ -320,6 +328,79 @@ func (p ACIProvider) GetResourceConnections() map[string]map[string][]string { "l3out_hsrp_secondary_vip": { "l3out_hsrp_interface_group": []string{"l3out_hsrp_interface_group_dn", "id"}, }, + "vrf_snmp_context": { + "vrf": []string{"vrf_dn", "id"}, + }, + "vrf_snmp_context_community": { + "vrf_snmp_context": []string{"vrf_snmp_context_dn", "id"}, + }, + "user_security_domain": { + "local_user": []string{"local_user_dn", "id"}, + }, + "bfd_interface_policy": { + "tenant": []string{"tenant_dn", "id"}, + }, + "user_security_domain_role": { + "user_security_domain": []string{"user_domain_dn", "id"}, + }, + "ldap_group_map_rule_to_group_map": { + "ldap_group_map": []string{"ldap_group_map_dn", "id"}, + }, + "tacacs_accounting_destination": { + "tacacs_accounting": []string{"tacacs_accounting_dn", "id"}, + }, + "vrf_to_bgp_address_family_context": { + "vrf": []string{"vrf_dn", "id"}, + "bgp_address_family_context": []string{"bgp_address_family_context_dn", "id"}, + }, + "mgmt_zone": { + "managed_node_connectivity_group": []string{"managed_node_connectivity_group_dn", "id"}, + }, + "recurring_window": { + "trigger_scheduler": []string{"scheduler_dn", "id"}, + }, + "match_rule": { + "tenant": []string{"tenant_dn", "id"}, + }, + "route_control_profile": { + "l3_outside": []string{"parent_dn", "id"}, + "tenant": []string{"parent_dn", "id"}, + }, + "route_control_context": { + "route_control_profile": []string{"route_control_profile_dn", "id"}, + "set_rule": []string{"action_rule_profile_dn", "id"}, + }, + "action_rule_additional_communities": { + "action_rule_profile": []string{"action_rule_profile_dn", "id"}, + }, + "spine_access_port_selector": { + "spine_interface_profile": []string{"spine_interface_profile_dn", "id"}, + }, + "aaep_to_domain": { + "attachable_access_entity_profile": []string{"attachable_access_entity_profile_dn", "id"}, + "l3_domain_profile": []string{"domain_dn", "id"}, + "l2_domain": []string{"domain_dn", "id"}, + "fc_domain": []string{"domain_dn", "id"}, + "vmm_domain": []string{"domain_dn", "id"}, + }, + "tacacs_source": { + "monitoring_policy": []string{"parent_dn", "id"}, + }, + "login_domain_provider": { + "duo_provider_group": []string{"parent_dn", "id"}, + "saml_provider_group": []string{"parent_dn", "id"}, + "tacacs_provider_group": []string{"parent_dn", "id"}, + "radius_provider_group": []string{"parent_dn", "id"}, + }, + "match_regex_community_terms": { + "match_rule": []string{"match_rule_dn", "id"}, + }, + "match_route_destination_rule": { + "match_rule": []string{"match_rule_dn", "id"}, + }, + "match_community_terms": { + "match_rule": []string{"match_rule_dn", "id"}, + }, } } @@ -521,5 +602,67 @@ func (p *ACIProvider) GetSupportedService() map[string]terraformutils.ServiceGen "fc_domain": &FCDomainGenerator{}, "leaf_profile": &LeafProfileGenerator{}, "pod_maintenance_group": &PodMaintenanceGroupGenerator{}, + "l3_interface_policy": &L3InterfacePolicyGenerator{}, + "access_switch_policy_group": &AccessSwitchPolicyGroupGenerator{}, + "mgmt_preference": &MgmtconnectivitypreferenceGenerator{}, + "fabric_node_control": &FabricNodeControlGenerator{}, + "vrf_snmp_context": &SNMPContextProfileGenerator{}, + "vrf_snmp_context_community": &SNMPCommunityGenerator{}, + "fabric_wide_settings": &fabricWideSettingsPolicyGenerator{}, + "encryption_key": &AESEncryptionPassphraseandKeysforConfigExportandImportGenerator{}, + "coop_policy": &COOPGroupPolicyGenerator{}, + "port_tracking": &PortTrackingGenerator{}, + "user_security_domain": &UserDomainGenerator{}, + "error_disable_recovery": &ErrorDisabledRecoveryPolicyGenerator{}, + "bfd_interface_policy": &BFDInterfacePolicyGenerator{}, + "managed_node_connectivity_group": &ManagedNodeConnectivityGroupGenerator{}, + "spine_switch_policy_group": &SpineSwitchPolicyGroupGenerator{}, + "duo_provider_group": &DuoProviderGroupGenerator{}, + "console_authentication": &ConsoleAuthenticationMethodGenerator{}, + "ldap_provider": &LDAPProviderGenerator{}, + "tacacs_accounting": &TACACSMonitoringDestinationGroupGenerator{}, + "rsa_provider": &RSAProviderGenerator{}, + "saml_provider_group": &SAMLProviderGroupGenerator{}, + "user_security_domain_role": &UserRoleGenerator{}, + "mcp_instance_policy": &MiscablingProtocolInstancePolicyGenerator{}, + "qos_instance_policy": &QOSInstancePolicyGenerator{}, + "ldap_group_map": &LDAPGroupMapGenerator{}, + "ldap_group_map_rule_to_group_map": &LDAPGroupMaprulerefGenerator{}, + "vpc_domain_policy": &VPCDomainPolicyGenerator{}, + "mgmt_zone": &OOBManagedNodesZoneGenerator{}, + "recurring_window": &RecurringWindowGenerator{}, + "file_remote_path": &RemotePathofaFileGenerator{}, + "radius_provider_group": &RadiusProviderGroupGenerator{}, + "saml_provider": &SAMLProviderGenerator{}, + "tacacs_accounting_destination": &TACACSDestinationGenerator{}, + "vrf_to_bgp_address_family_context": &BGPAddressFamilyContextPolicyGenerator{}, + "match_rule": &MatchRuleGenerator{}, + "annotation": &TagGenerator{}, + "route_control_profile": &RouteControlProfileGenerator{}, + "route_control_context": &RouteControlContextGenerator{}, + "action_rule_additional_communities": &RtctrlSetAddCommGenerator{}, + "tag": &tagOriginalGenerator{}, + "aaep_to_domain": &DomainGenerator{}, + "spine_access_port_selector": &SpineAccessPortSelectorGenerator{}, + "endpoint_loop_protection": &EPLoopProtectionPolicyGenerator{}, + "endpoint_controls": &EndpointControlPolicyGenerator{}, + "endpoint_ip_aging_profile": &IPAgingPolicyGenerator{}, + "tacacs_source": &TACACSSourceGenerator{}, + "login_domain_provider": &ProviderGroupMemberGenerator{}, + "radius_provider": &RADIUSProviderGenerator{}, + "interface_blacklist": &OutofServiceFabricPathGenerator{}, + "default_authentication": &DefaultAuthenticationMethodforallLoginsGenerator{}, + "tacacs_provider": &TACACSPlusProviderGenerator{}, + "tacacs_provider_group": &TACACSPlusProviderGroupGenerator{}, + "ldap_group_map_rule": &LDAPGroupMapRuleGenerator{}, + "authentication_properties": &AAAAuthenticationGenerator{}, + "isis_domain_policy": &ISISDomainPolicyGenerator{}, + "match_regex_community_terms": &MatchRuleBasedonCommunityRegularExpressionGenerator{}, + "match_route_destination_rule": &MatchRouteDestinationRuleGenerator{}, + "epg_to_contract_interface": &ContractInterfaceGenerator{}, + "spine_interface_profile_selector": &InterfaceProfileGenerator{}, + "global_security": &UserManagementGenerator{}, + "match_community_terms": &MatchCommunityTermGenerator{}, + "login_domain": &LoginDomainGenerator{}, } } diff --git a/providers/aci/action_rule_additional_communities.go b/providers/aci/action_rule_additional_communities.go new file mode 100644 index 0000000000..fd81b65518 --- /dev/null +++ b/providers/aci/action_rule_additional_communities.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const rtctrlSetAddCommClassName = "rtctrlSetAddComm" + +type RtctrlSetAddCommGenerator struct { + ACIService +} + +func (a *RtctrlSetAddCommGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, rtctrlSetAddCommClassName) + + RtctrlSetAddCommCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + RtctrlSetAddCommCount, err := strconv.Atoi(stripQuotes(RtctrlSetAddCommCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < RtctrlSetAddCommCount; i++ { + RtctrlSetAddCommAttr := RtctrlSetAddCommCont.S("imdata").Index(i).S(rtctrlSetAddCommClassName, "attributes") + RtctrlSetAddCommDN := G(RtctrlSetAddCommAttr, "dn") + community := G(RtctrlSetAddCommAttr, "community") + if filterChildrenDn(RtctrlSetAddCommDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RtctrlSetAddCommDN, + resourceNamefromDn(rtctrlSetAddCommClassName, RtctrlSetAddCommDN, i), + "aci_action_rule_additional_communities", + "aci", + map[string]string{ + "action_rule_profile_dn": GetParentDn(RtctrlSetAddCommDN, fmt.Sprintf("/saddcomm-%s", community)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/annotation.go b/providers/aci/annotation.go new file mode 100644 index 0000000000..6304d2c19e --- /dev/null +++ b/providers/aci/annotation.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const tagClassName = "tagAnnotation" + +type TagGenerator struct { + ACIService +} + +func (a *TagGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, tagClassName) + + TagCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + TagCount, err := strconv.Atoi(stripQuotes(TagCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < TagCount; i++ { + TagAttr := TagCont.S("imdata").Index(i).S(tagClassName, "attributes") + TagDN := G(TagAttr, "dn") + key := G(TagAttr, "key") + if filterChildrenDn(TagDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TagDN, + resourceNamefromDn(tagClassName, TagDN, i), + "aci_annotation", + "aci", + map[string]string{ + "parent_dn": GetParentDn(TagDN, fmt.Sprintf("/annotationKey-[%s]", key)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/authentication_properties.go b/providers/aci/authentication_properties.go new file mode 100644 index 0000000000..1a26f1b2bd --- /dev/null +++ b/providers/aci/authentication_properties.go @@ -0,0 +1,55 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const aAAAuthenticationClassName = "aaaAuthRealm" + +type AAAAuthenticationGenerator struct { + ACIService +} + +func (a *AAAAuthenticationGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, aAAAuthenticationClassName) + + AAAAuthenticationCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + AAAAuthenticationCount, err := strconv.Atoi(stripQuotes(AAAAuthenticationCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < AAAAuthenticationCount; i++ { + AAAAuthenticationAttr := AAAAuthenticationCont.S("imdata").Index(i).S(aAAAuthenticationClassName, "attributes") + AAAAuthenticationDN := G(AAAAuthenticationAttr, "dn") + if filterChildrenDn(AAAAuthenticationDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + AAAAuthenticationDN, + resourceNamefromDn(aAAAuthenticationClassName, AAAAuthenticationDN, i), + "aci_authentication_properties", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/bfd_interface_policy.go b/providers/aci/bfd_interface_policy.go new file mode 100644 index 0000000000..412bed11d3 --- /dev/null +++ b/providers/aci/bfd_interface_policy.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const bFDInterfacePolicyClassName = "bfdIfPol" + +type BFDInterfacePolicyGenerator struct { + ACIService +} + +func (a *BFDInterfacePolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, bFDInterfacePolicyClassName) + BFDInterfacePolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + BFDInterfacePolicyCount, err := strconv.Atoi(stripQuotes(BFDInterfacePolicyCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < BFDInterfacePolicyCount; i++ { + BFDInterfacePolicyAttr := BFDInterfacePolicyCont.S("imdata").Index(i).S(bFDInterfacePolicyClassName, "attributes") + BFDInterfacePolicyDN := G(BFDInterfacePolicyAttr, "dn") + name := G(BFDInterfacePolicyAttr, "name") + if filterChildrenDn(BFDInterfacePolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + BFDInterfacePolicyDN, + resourceNamefromDn(bFDInterfacePolicyClassName, BFDInterfacePolicyDN, i), + "aci_bfd_interface_policy", + "aci", + map[string]string{ + "tenant_dn": GetParentDn(BFDInterfacePolicyDN, fmt.Sprintf("/bfdIfPol-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/console_authentication.go b/providers/aci/console_authentication.go new file mode 100644 index 0000000000..ebef5ee26c --- /dev/null +++ b/providers/aci/console_authentication.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const consoleAuthenticationMethodClassName = "aaaConsoleAuth" + +type ConsoleAuthenticationMethodGenerator struct { + ACIService +} + +func (a *ConsoleAuthenticationMethodGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, consoleAuthenticationMethodClassName) + + ConsoleAuthenticationMethodCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + ConsoleAuthenticationMethodCount, err := strconv.Atoi(stripQuotes(ConsoleAuthenticationMethodCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < ConsoleAuthenticationMethodCount; i++ { + ConsoleAuthenticationMethodAttr := ConsoleAuthenticationMethodCont.S("imdata").Index(i).S(consoleAuthenticationMethodClassName, "attributes") + ConsoleAuthenticationMethodDN := G(ConsoleAuthenticationMethodAttr, "dn") + if filterChildrenDn(ConsoleAuthenticationMethodDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + ConsoleAuthenticationMethodDN, + resourceNamefromDn(consoleAuthenticationMethodClassName, ConsoleAuthenticationMethodDN, i), + "aci_console_authentication", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/coop_policy.go b/providers/aci/coop_policy.go new file mode 100644 index 0000000000..9b12f8a8f1 --- /dev/null +++ b/providers/aci/coop_policy.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const cOOPGroupPolicyClassName = "coopPol" + +type COOPGroupPolicyGenerator struct { + ACIService +} + +func (a *COOPGroupPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, cOOPGroupPolicyClassName) + + COOPGroupPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + COOPGroupPolicyCount, err := strconv.Atoi(stripQuotes(COOPGroupPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < COOPGroupPolicyCount; i++ { + COOPGroupPolicyAttr := COOPGroupPolicyCont.S("imdata").Index(i).S(cOOPGroupPolicyClassName, "attributes") + COOPGroupPolicyDN := G(COOPGroupPolicyAttr, "dn") + if filterChildrenDn(COOPGroupPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + COOPGroupPolicyDN, + resourceNamefromDn(cOOPGroupPolicyClassName, COOPGroupPolicyDN, i), + "aci_coop_policy", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/default_auth.go b/providers/aci/default_auth.go new file mode 100644 index 0000000000..7e894d7400 --- /dev/null +++ b/providers/aci/default_auth.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const defaultAuthenticationMethodforallLoginsClassName = "aaaDefaultAuth" + +type DefaultAuthenticationMethodforallLoginsGenerator struct { + ACIService +} + +func (a *DefaultAuthenticationMethodforallLoginsGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, defaultAuthenticationMethodforallLoginsClassName) + + DefaultAuthenticationMethodforallLoginsCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + DefaultAuthenticationMethodforallLoginsCount, err := strconv.Atoi(stripQuotes(DefaultAuthenticationMethodforallLoginsCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < DefaultAuthenticationMethodforallLoginsCount; i++ { + DefaultAuthenticationMethodforallLoginsAttr := DefaultAuthenticationMethodforallLoginsCont.S("imdata").Index(i).S(defaultAuthenticationMethodforallLoginsClassName, "attributes") + DefaultAuthenticationMethodforallLoginsDN := G(DefaultAuthenticationMethodforallLoginsAttr, "dn") + if filterChildrenDn(DefaultAuthenticationMethodforallLoginsDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + DefaultAuthenticationMethodforallLoginsDN, + resourceNamefromDn(defaultAuthenticationMethodforallLoginsClassName, DefaultAuthenticationMethodforallLoginsDN, i), + "aci_default_authentication", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/duo_provider_group.go b/providers/aci/duo_provider_group.go new file mode 100644 index 0000000000..8175b311db --- /dev/null +++ b/providers/aci/duo_provider_group.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const duoProviderGroupClassName = "aaaDuoProviderGroup" + +type DuoProviderGroupGenerator struct { + ACIService +} + +func (a *DuoProviderGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, duoProviderGroupClassName) + + DuoProviderGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + DuoProviderGroupCount, err := strconv.Atoi(stripQuotes(DuoProviderGroupCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < DuoProviderGroupCount; i++ { + DuoProviderGroupAttr := DuoProviderGroupCont.S("imdata").Index(i).S(duoProviderGroupClassName, "attributes") + DuoProviderGroupDN := G(DuoProviderGroupAttr, "dn") + if filterChildrenDn(DuoProviderGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + DuoProviderGroupDN, + resourceNamefromDn(duoProviderGroupClassName, DuoProviderGroupDN, i), + "aci_duo_provider_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/encryption_key.go b/providers/aci/encryption_key.go new file mode 100644 index 0000000000..fdc8c4e23d --- /dev/null +++ b/providers/aci/encryption_key.go @@ -0,0 +1,59 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const aESEncryptionPassphraseandKeysforConfigExportandImportClassName = "pkiExportEncryptionKey" + +type AESEncryptionPassphraseandKeysforConfigExportandImportGenerator struct { + ACIService +} + +func (a *AESEncryptionPassphraseandKeysforConfigExportandImportGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, aESEncryptionPassphraseandKeysforConfigExportandImportClassName) + + AESEncryptionPassphraseandKeysforConfigExportandImportCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + AESEncryptionPassphraseandKeysforConfigExportandImportCount, err := strconv.Atoi(stripQuotes(AESEncryptionPassphraseandKeysforConfigExportandImportCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < AESEncryptionPassphraseandKeysforConfigExportandImportCount; i++ { + AESEncryptionPassphraseandKeysforConfigExportandImportAttr := AESEncryptionPassphraseandKeysforConfigExportandImportCont.S("imdata").Index(i).S(aESEncryptionPassphraseandKeysforConfigExportandImportClassName, "attributes") + AESEncryptionPassphraseandKeysforConfigExportandImportDN := G(AESEncryptionPassphraseandKeysforConfigExportandImportAttr, "dn") + if filterChildrenDn(AESEncryptionPassphraseandKeysforConfigExportandImportDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + AESEncryptionPassphraseandKeysforConfigExportandImportDN, + resourceNamefromDn(aESEncryptionPassphraseandKeysforConfigExportandImportClassName, AESEncryptionPassphraseandKeysforConfigExportandImportDN, i), + "aci_encryption_key", + "aci", + map[string]string{ + "clear_encryption_key": "no", + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/endpoint_controls.go b/providers/aci/endpoint_controls.go new file mode 100644 index 0000000000..56cc83bb68 --- /dev/null +++ b/providers/aci/endpoint_controls.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const endpointControlPolicyClassName = "epControlP" + +type EndpointControlPolicyGenerator struct { + ACIService +} + +func (a *EndpointControlPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, endpointControlPolicyClassName) + + EndpointControlPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + EndpointControlPolicyCount, err := strconv.Atoi(stripQuotes(EndpointControlPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < EndpointControlPolicyCount; i++ { + EndpointControlPolicyAttr := EndpointControlPolicyCont.S("imdata").Index(i).S(endpointControlPolicyClassName, "attributes") + EndpointControlPolicyDN := G(EndpointControlPolicyAttr, "dn") + if filterChildrenDn(EndpointControlPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + EndpointControlPolicyDN, + resourceNamefromDn(endpointControlPolicyClassName, EndpointControlPolicyDN, i), + "aci_endpoint_controls", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/endpoint_ip_aging_profile.go b/providers/aci/endpoint_ip_aging_profile.go new file mode 100644 index 0000000000..7de37294aa --- /dev/null +++ b/providers/aci/endpoint_ip_aging_profile.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const iPAgingPolicyClassName = "epIpAgingP" + +type IPAgingPolicyGenerator struct { + ACIService +} + +func (a *IPAgingPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, iPAgingPolicyClassName) + + IPAgingPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + IPAgingPolicyCount, err := strconv.Atoi(stripQuotes(IPAgingPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < IPAgingPolicyCount; i++ { + IPAgingPolicyAttr := IPAgingPolicyCont.S("imdata").Index(i).S(iPAgingPolicyClassName, "attributes") + IPAgingPolicyDN := G(IPAgingPolicyAttr, "dn") + if filterChildrenDn(IPAgingPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + IPAgingPolicyDN, + resourceNamefromDn(iPAgingPolicyClassName, IPAgingPolicyDN, i), + "aci_endpoint_ip_aging_profile", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/endpoint_loop_protection.go b/providers/aci/endpoint_loop_protection.go new file mode 100644 index 0000000000..fbb4acce29 --- /dev/null +++ b/providers/aci/endpoint_loop_protection.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const ePLoopProtectionPolicyClassName = "epLoopProtectP" + +type EPLoopProtectionPolicyGenerator struct { + ACIService +} + +func (a *EPLoopProtectionPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, ePLoopProtectionPolicyClassName) + + EPLoopProtectionPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + EPLoopProtectionPolicyCount, err := strconv.Atoi(stripQuotes(EPLoopProtectionPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < EPLoopProtectionPolicyCount; i++ { + EPLoopProtectionPolicyAttr := EPLoopProtectionPolicyCont.S("imdata").Index(i).S(ePLoopProtectionPolicyClassName, "attributes") + EPLoopProtectionPolicyDN := G(EPLoopProtectionPolicyAttr, "dn") + if filterChildrenDn(EPLoopProtectionPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + EPLoopProtectionPolicyDN, + resourceNamefromDn(ePLoopProtectionPolicyClassName, EPLoopProtectionPolicyDN, i), + "aci_endpoint_loop_protection", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/epg_to_contract_interface.go b/providers/aci/epg_to_contract_interface.go new file mode 100644 index 0000000000..cf7d35a3c7 --- /dev/null +++ b/providers/aci/epg_to_contract_interface.go @@ -0,0 +1,62 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const contractInterfaceClassName = "fvRsConsIf" + +type ContractInterfaceGenerator struct { + ACIService +} + +func (a *ContractInterfaceGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, contractInterfaceClassName) + + ContractInterfaceCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + ContractInterfaceCount, err := strconv.Atoi(stripQuotes(ContractInterfaceCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < ContractInterfaceCount; i++ { + ContractInterfaceAttr := ContractInterfaceCont.S("imdata").Index(i).S(contractInterfaceClassName, "attributes") + ContractInterfaceDN := G(ContractInterfaceAttr, "dn") + tnVzCPIfName := G(ContractInterfaceAttr, "tnVzCPIfName") + tDn := G(ContractInterfaceAttr, "tDn") + if filterChildrenDn(ContractInterfaceDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + ContractInterfaceDN, + resourceNamefromDn(contractInterfaceClassName, ContractInterfaceDN, i), + "aci_epg_to_contract_interface", + "aci", + map[string]string{ + "application_epg_dn": GetParentDn(ContractInterfaceDN, fmt.Sprintf("/rsconsIf-%s", tnVzCPIfName)), + "contract_interface_dn": tDn, + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/error_disable_recovery.go b/providers/aci/error_disable_recovery.go new file mode 100644 index 0000000000..db578be4d5 --- /dev/null +++ b/providers/aci/error_disable_recovery.go @@ -0,0 +1,91 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const errorDisabledRecoveryPolicyClassName = "edrErrDisRecoverPol" + +type ErrorDisabledRecoveryPolicyGenerator struct { + ACIService +} + +func (a *ErrorDisabledRecoveryPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, errorDisabledRecoveryPolicyClassName) + + ErrorDisabledRecoveryPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + ErrorDisabledRecoveryPolicyCount, err := strconv.Atoi(stripQuotes(ErrorDisabledRecoveryPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + eventMap, eventIds, err := getEventMap(client) + if err != nil { + return err + } + + for i := 0; i < ErrorDisabledRecoveryPolicyCount; i++ { + ErrorDisabledRecoveryPolicyAttr := ErrorDisabledRecoveryPolicyCont.S("imdata").Index(i).S(errorDisabledRecoveryPolicyClassName, "attributes") + ErrorDisabledRecoveryPolicyDN := G(ErrorDisabledRecoveryPolicyAttr, "dn") + if filterChildrenDn(ErrorDisabledRecoveryPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + ErrorDisabledRecoveryPolicyDN, + resourceNamefromDn(errorDisabledRecoveryPolicyClassName, ErrorDisabledRecoveryPolicyDN, i), + "aci_error_disable_recovery", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{ + "edr_event": eventMap, + "edr_event_ids": eventIds, + }, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} + +func getEventMap(c *ACIClient) ([]map[string]string, []string, error) { + cont, err := c.GetViaURL("api/node/class/edrEventP.json") + if err != nil { + return nil, nil, err + } + eventValues := make([]map[string]string, 0, 1) + eventIds := make([]string, 0, 1) + eventData := cont.S("imdata") + for i := 0; i < len(eventData.Data().([]interface{})); i++ { + eventCont := eventData.Index(i) + eventContOut := eventCont.S("edrEventP") + eventAttrCont := eventContOut.S("attributes") + event := G(eventAttrCont, "event") + name := G(eventAttrCont, "name") + recover := G(eventAttrCont, "recover") + id := G(eventAttrCont, "dn") + eventValue := make(map[string]string, 0) + eventValue["event"] = event + eventValue["name"] = name + eventValue["recover"] = recover + eventValues = append(eventValues, eventValue) + eventIds = append(eventIds, id) + } + return eventValues, eventIds, nil +} diff --git a/providers/aci/fabric_node_control.go b/providers/aci/fabric_node_control.go new file mode 100644 index 0000000000..fa47c5e6e4 --- /dev/null +++ b/providers/aci/fabric_node_control.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const fabricNodeControlClassName = "fabricNodeControl" + +type FabricNodeControlGenerator struct { + ACIService +} + +func (a *FabricNodeControlGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, fabricNodeControlClassName) + + FabricNodeControlCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + FabricNodeControlCount, err := strconv.Atoi(stripQuotes(FabricNodeControlCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < FabricNodeControlCount; i++ { + FabricNodeControlAttr := FabricNodeControlCont.S("imdata").Index(i).S(fabricNodeControlClassName, "attributes") + FabricNodeControlDN := G(FabricNodeControlAttr, "dn") + if filterChildrenDn(FabricNodeControlDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + FabricNodeControlDN, + resourceNamefromDn(fabricNodeControlClassName, FabricNodeControlDN, i), + "aci_fabric_node_control", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/fabric_wide_settings.go b/providers/aci/fabric_wide_settings.go new file mode 100644 index 0000000000..1eb7e00116 --- /dev/null +++ b/providers/aci/fabric_wide_settings.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const fabricWideSettingsPolicyClassName = "infraSetPol" + +type fabricWideSettingsPolicyGenerator struct { + ACIService +} + +func (a *fabricWideSettingsPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, fabricWideSettingsPolicyClassName) + + fabricWideSettingsPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + fabricWideSettingsPolicyCount, err := strconv.Atoi(stripQuotes(fabricWideSettingsPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < fabricWideSettingsPolicyCount; i++ { + fabricWideSettingsPolicyAttr := fabricWideSettingsPolicyCont.S("imdata").Index(i).S(fabricWideSettingsPolicyClassName, "attributes") + fabricWideSettingsPolicyDN := G(fabricWideSettingsPolicyAttr, "dn") + if filterChildrenDn(fabricWideSettingsPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + fabricWideSettingsPolicyDN, + resourceNamefromDn(fabricWideSettingsPolicyClassName, fabricWideSettingsPolicyDN, i), + "aci_fabric_wide_settings", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/file_remote_path.go b/providers/aci/file_remote_path.go new file mode 100644 index 0000000000..eecd4516e3 --- /dev/null +++ b/providers/aci/file_remote_path.go @@ -0,0 +1,52 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const remotePathofaFileClassName = "fileRemotePath" + +type RemotePathofaFileGenerator struct { + ACIService +} + +func (a *RemotePathofaFileGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, remotePathofaFileClassName) + RemotePathofaFileCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + RemotePathofaFileCount, err := strconv.Atoi(stripQuotes(RemotePathofaFileCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < RemotePathofaFileCount; i++ { + RemotePathofaFileAttr := RemotePathofaFileCont.S("imdata").Index(i).S(remotePathofaFileClassName, "attributes") + RemotePathofaFileDN := G(RemotePathofaFileAttr, "dn") + if filterChildrenDn(RemotePathofaFileDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RemotePathofaFileDN, + resourceNamefromDn(remotePathofaFileClassName, RemotePathofaFileDN, i), + "aci_file_remote_path", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/global_security.go b/providers/aci/global_security.go new file mode 100644 index 0000000000..fc71661c61 --- /dev/null +++ b/providers/aci/global_security.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const userManagementClassName = "aaaUserEp" + +type UserManagementGenerator struct { + ACIService +} + +func (a *UserManagementGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, userManagementClassName) + + UserManagementCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + UserManagementCount, err := strconv.Atoi(stripQuotes(UserManagementCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < UserManagementCount; i++ { + UserManagementAttr := UserManagementCont.S("imdata").Index(i).S(userManagementClassName, "attributes") + UserManagementDN := G(UserManagementAttr, "dn") + if filterChildrenDn(UserManagementDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + UserManagementDN, + resourceNamefromDn(userManagementClassName, UserManagementDN, i), + "aci_global_security", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/interface_blacklist.go b/providers/aci/interface_blacklist.go new file mode 100644 index 0000000000..14cb7b9ac0 --- /dev/null +++ b/providers/aci/interface_blacklist.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const outofServiceFabricPathClassName = "fabricRsOosPath" + +type OutofServiceFabricPathGenerator struct { + ACIService +} + +func (a *OutofServiceFabricPathGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, outofServiceFabricPathClassName) + + OutofServiceFabricPathCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + OutofServiceFabricPathCount, err := strconv.Atoi(stripQuotes(OutofServiceFabricPathCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < OutofServiceFabricPathCount; i++ { + OutofServiceFabricPathAttr := OutofServiceFabricPathCont.S("imdata").Index(i).S(outofServiceFabricPathClassName, "attributes") + OutofServiceFabricPathDN := G(OutofServiceFabricPathAttr, "dn") + if filterChildrenDn(OutofServiceFabricPathDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + OutofServiceFabricPathDN, + resourceNamefromDn(outofServiceFabricPathClassName, OutofServiceFabricPathDN, i), + "aci_interface_blacklist", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/isis_domain_policy.go b/providers/aci/isis_domain_policy.go new file mode 100644 index 0000000000..93f3e4d58d --- /dev/null +++ b/providers/aci/isis_domain_policy.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const iSISDomainPolicyClassName = "isisDomPol" + +type ISISDomainPolicyGenerator struct { + ACIService +} + +func (a *ISISDomainPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, iSISDomainPolicyClassName) + + ISISDomainPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + ISISDomainPolicyCount, err := strconv.Atoi(stripQuotes(ISISDomainPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < ISISDomainPolicyCount; i++ { + ISISDomainPolicyAttr := ISISDomainPolicyCont.S("imdata").Index(i).S(iSISDomainPolicyClassName, "attributes") + ISISDomainPolicyDN := G(ISISDomainPolicyAttr, "dn") + if filterChildrenDn(ISISDomainPolicyDN, client.parentResource) != "" && ISISDomainPolicyDN == "uni/fabric/isisDomP-default" { + resource := terraformutils.NewResource( + ISISDomainPolicyDN, + resourceNamefromDn(iSISDomainPolicyClassName, ISISDomainPolicyDN, i), + "aci_isis_domain_policy", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/l3_interface_policy.go b/providers/aci/l3_interface_policy.go new file mode 100644 index 0000000000..50ac35389f --- /dev/null +++ b/providers/aci/l3_interface_policy.go @@ -0,0 +1,53 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const l3InterfacePolicyClassName = "l3IfPol" + +type L3InterfacePolicyGenerator struct { + ACIService +} + +func (a *L3InterfacePolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, l3InterfacePolicyClassName) + L3InterfacePolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + L3InterfacePolicyCount, err := strconv.Atoi(stripQuotes(L3InterfacePolicyCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < L3InterfacePolicyCount; i++ { + L3InterfacePolicyAttr := L3InterfacePolicyCont.S("imdata").Index(i).S(l3InterfacePolicyClassName, "attributes") + L3InterfacePolicyDN := G(L3InterfacePolicyAttr, "dn") + if filterChildrenDn(L3InterfacePolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + L3InterfacePolicyDN, + resourceNamefromDn(l3InterfacePolicyClassName, L3InterfacePolicyDN, i), + "aci_l3_interface_policy", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/ldap_group_map.go b/providers/aci/ldap_group_map.go new file mode 100644 index 0000000000..0cf86bd26e --- /dev/null +++ b/providers/aci/ldap_group_map.go @@ -0,0 +1,66 @@ +package aci + +import ( + "fmt" + "regexp" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const lDAPGroupMapClassName = "aaaLdapGroupMap" + +type LDAPGroupMapGenerator struct { + ACIService +} + +func (a *LDAPGroupMapGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, lDAPGroupMapClassName) + + LDAPGroupMapCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + LDAPGroupMapCount, err := strconv.Atoi(stripQuotes(LDAPGroupMapCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < LDAPGroupMapCount; i++ { + LDAPGroupMapAttr := LDAPGroupMapCont.S("imdata").Index(i).S(lDAPGroupMapClassName, "attributes") + LDAPGroupMapDN := G(LDAPGroupMapAttr, "dn") + re := regexp.MustCompile("uni/userext/ldapext/ldapgroupmap-(.)+") + match := re.FindStringSubmatch(LDAPGroupMapDN) + LDAPGroupMapType := "duo" + if len(match) > 0 { + LDAPGroupMapType = "ldap" + } + if filterChildrenDn(LDAPGroupMapDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + LDAPGroupMapDN, + resourceNamefromDn(lDAPGroupMapClassName, LDAPGroupMapDN, i), + "aci_ldap_group_map", + "aci", + map[string]string{ + "type": LDAPGroupMapType, + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/ldap_group_map_rule.go b/providers/aci/ldap_group_map_rule.go new file mode 100644 index 0000000000..b9e708d1cf --- /dev/null +++ b/providers/aci/ldap_group_map_rule.go @@ -0,0 +1,67 @@ +package aci + +import ( + "fmt" + "strconv" + "strings" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const lDAPGroupMapRuleClassName = "aaaLdapGroupMapRule" + +type LDAPGroupMapRuleGenerator struct { + ACIService +} + +func (a *LDAPGroupMapRuleGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, lDAPGroupMapRuleClassName) + + LDAPGroupMapRuleCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + LDAPGroupMapRuleCount, err := strconv.Atoi(stripQuotes(LDAPGroupMapRuleCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < LDAPGroupMapRuleCount; i++ { + LDAPGroupMapRuleAttr := LDAPGroupMapRuleCont.S("imdata").Index(i).S(lDAPGroupMapRuleClassName, "attributes") + LDAPGroupMapRuleDN := G(LDAPGroupMapRuleAttr, "dn") + arr := strings.Split(LDAPGroupMapRuleDN, "/") + type_grp := "" + if arr[2] == "duoext" { + type_grp = "duo" + } else { + type_grp = "ldap" + } + if filterChildrenDn(LDAPGroupMapRuleDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + LDAPGroupMapRuleDN, + resourceNamefromDn(lDAPGroupMapRuleClassName, LDAPGroupMapRuleDN, i), + "aci_ldap_group_map_rule", + "aci", + map[string]string{ + "type": type_grp, + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/ldap_group_map_rule_to_group_map.go b/providers/aci/ldap_group_map_rule_to_group_map.go new file mode 100644 index 0000000000..e185574c33 --- /dev/null +++ b/providers/aci/ldap_group_map_rule_to_group_map.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const lDAPGroupMaprulerefClassName = "aaaLdapGroupMapRuleRef" + +type LDAPGroupMaprulerefGenerator struct { + ACIService +} + +func (a *LDAPGroupMaprulerefGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, lDAPGroupMaprulerefClassName) + + LDAPGroupMaprulerefCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + LDAPGroupMaprulerefCount, err := strconv.Atoi(stripQuotes(LDAPGroupMaprulerefCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < LDAPGroupMaprulerefCount; i++ { + LDAPGroupMaprulerefAttr := LDAPGroupMaprulerefCont.S("imdata").Index(i).S(lDAPGroupMaprulerefClassName, "attributes") + LDAPGroupMaprulerefDN := G(LDAPGroupMaprulerefAttr, "dn") + name := G(LDAPGroupMaprulerefAttr, "name") + if filterChildrenDn(LDAPGroupMaprulerefDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + LDAPGroupMaprulerefDN, + resourceNamefromDn(lDAPGroupMaprulerefClassName, LDAPGroupMaprulerefDN, i), + "aci_ldap_group_map_rule_to_group_map", + "aci", + map[string]string{ + "ldap_group_map_dn": GetParentDn(LDAPGroupMaprulerefDN, fmt.Sprintf("/ldapgroupmapruleref-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/ldap_provider.go b/providers/aci/ldap_provider.go new file mode 100644 index 0000000000..b7120ef910 --- /dev/null +++ b/providers/aci/ldap_provider.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const lDAPProviderClassName = "aaaLdapProvider" + +type LDAPProviderGenerator struct { + ACIService +} + +func (a *LDAPProviderGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, lDAPProviderClassName) + + LDAPProviderCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + LDAPProviderCount, err := strconv.Atoi(stripQuotes(LDAPProviderCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < LDAPProviderCount; i++ { + LDAPProviderAttr := LDAPProviderCont.S("imdata").Index(i).S(lDAPProviderClassName, "attributes") + LDAPProviderDN := G(LDAPProviderAttr, "dn") + if filterChildrenDn(LDAPProviderDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + LDAPProviderDN, + resourceNamefromDn(lDAPProviderClassName, LDAPProviderDN, i), + "aci_ldap_provider", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/login_domain.go b/providers/aci/login_domain.go new file mode 100644 index 0000000000..88943ebe8a --- /dev/null +++ b/providers/aci/login_domain.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const loginDomainClassName = "aaaLoginDomain" + +type LoginDomainGenerator struct { + ACIService +} + +func (a *LoginDomainGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, loginDomainClassName) + + LoginDomainCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + LoginDomainCount, err := strconv.Atoi(stripQuotes(LoginDomainCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < LoginDomainCount; i++ { + LoginDomainAttr := LoginDomainCont.S("imdata").Index(i).S(loginDomainClassName, "attributes") + LoginDomainDN := G(LoginDomainAttr, "dn") + if filterChildrenDn(LoginDomainDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + LoginDomainDN, + resourceNamefromDn(loginDomainClassName, LoginDomainDN, i), + "aci_login_domain", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/login_domain_provider.go b/providers/aci/login_domain_provider.go new file mode 100644 index 0000000000..2503e12c3b --- /dev/null +++ b/providers/aci/login_domain_provider.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const providerGroupMemberClassName = "aaaProviderRef" + +type ProviderGroupMemberGenerator struct { + ACIService +} + +func (a *ProviderGroupMemberGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, providerGroupMemberClassName) + + ProviderGroupMemberCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + ProviderGroupMemberCount, err := strconv.Atoi(stripQuotes(ProviderGroupMemberCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < ProviderGroupMemberCount; i++ { + ProviderGroupMemberAttr := ProviderGroupMemberCont.S("imdata").Index(i).S(providerGroupMemberClassName, "attributes") + ProviderGroupMemberDN := G(ProviderGroupMemberAttr, "dn") + name := G(ProviderGroupMemberAttr, "name") + if filterChildrenDn(ProviderGroupMemberDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + ProviderGroupMemberDN, + resourceNamefromDn(providerGroupMemberClassName, ProviderGroupMemberDN, i), + "aci_login_domain_provider", + "aci", + map[string]string{ + "parent_dn": GetParentDn(ProviderGroupMemberDN, fmt.Sprintf("/providerref-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/managed_node_connectivity_group.go b/providers/aci/managed_node_connectivity_group.go new file mode 100644 index 0000000000..767335110a --- /dev/null +++ b/providers/aci/managed_node_connectivity_group.go @@ -0,0 +1,53 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const managedNodeConnectivityGroupClassName = "mgmtGrp" + +type ManagedNodeConnectivityGroupGenerator struct { + ACIService +} + +func (a *ManagedNodeConnectivityGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, managedNodeConnectivityGroupClassName) + ManagedNodeConnectivityGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + ManagedNodeConnectivityGroupCount, err := strconv.Atoi(stripQuotes(ManagedNodeConnectivityGroupCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < ManagedNodeConnectivityGroupCount; i++ { + ManagedNodeConnectivityGroupAttr := ManagedNodeConnectivityGroupCont.S("imdata").Index(i).S(managedNodeConnectivityGroupClassName, "attributes") + ManagedNodeConnectivityGroupDN := G(ManagedNodeConnectivityGroupAttr, "dn") + if filterChildrenDn(ManagedNodeConnectivityGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + ManagedNodeConnectivityGroupDN, + resourceNamefromDn(managedNodeConnectivityGroupClassName, ManagedNodeConnectivityGroupDN, i), + "aci_managed_node_connectivity_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/match_community_terms.go b/providers/aci/match_community_terms.go new file mode 100644 index 0000000000..e515a31619 --- /dev/null +++ b/providers/aci/match_community_terms.go @@ -0,0 +1,107 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const matchCommunityTermClassName = "rtctrlMatchCommTerm" + +type MatchCommunityTermGenerator struct { + ACIService +} + +func (a *MatchCommunityTermGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, matchCommunityTermClassName) + MatchCommunityTermCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + MatchCommunityTermCount, err := strconv.Atoi(stripQuotes(MatchCommunityTermCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < MatchCommunityTermCount; i++ { + MatchCommunityTermAttr := MatchCommunityTermCont.S("imdata").Index(i).S(matchCommunityTermClassName, "attributes") + MatchCommunityTermDN := G(MatchCommunityTermAttr, "dn") + name := G(MatchCommunityTermAttr, "name") + if filterChildrenDn(MatchCommunityTermDN, client.parentResource) != "" { + matchMap, err := getMatchMap(client, MatchCommunityTermDN) + if err != nil { + return err + } + var resource terraformutils.Resource + if len(matchMap) > 0 { + resource = terraformutils.NewResource( + MatchCommunityTermDN, + resourceNamefromDn(matchCommunityTermClassName, MatchCommunityTermDN, i), + "aci_match_community_terms", + "aci", + map[string]string{ + "match_rule_dn": GetParentDn(MatchCommunityTermDN, fmt.Sprintf("/commtrm-%s", name)), + }, + []string{}, + map[string]interface{}{ + "match_community_factors": matchMap, + }, + ) + } else { + resource = terraformutils.NewResource( + MatchCommunityTermDN, + resourceNamefromDn(matchCommunityTermClassName, MatchCommunityTermDN, i), + "aci_match_community_terms", + "aci", + map[string]string{ + "match_rule_dn": GetParentDn(MatchCommunityTermDN, fmt.Sprintf("/commtrm-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + } + + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} + +func getMatchMap(c *ACIClient, parentDN string) ([]map[string]string, error) { + cont, err := c.GetViaURL("api/node/class/rtctrlMatchCommFactor.json") + if err != nil { + return nil, err + } + matchValues := make([]map[string]string, 0, 1) + matchData := cont.S("imdata") + for i := 0; i < len(matchData.Data().([]interface{})); i++ { + matchCont := matchData.Index(i) + matchContOut := matchCont.S("rtctrlMatchCommFactor") + matchAttrCont := matchContOut.S("attributes") + factorDN := G(matchAttrCont, "dn") + if filterChildrenDn(factorDN, parentDN) != "" { + community := G(matchAttrCont, "community") + scope := G(matchAttrCont, "scope") + desc := G(matchAttrCont, "descr") + matchValue := make(map[string]string, 0) + matchValue["community"] = community + matchValue["scope"] = scope + if desc != "" { + matchValue["description"] = desc + } + matchValues = append(matchValues, matchValue) + } + + } + return matchValues, nil +} diff --git a/providers/aci/match_regex_community_terms.go b/providers/aci/match_regex_community_terms.go new file mode 100644 index 0000000000..875067b339 --- /dev/null +++ b/providers/aci/match_regex_community_terms.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const matchRuleBasedonCommunityRegularExpressionClassName = "rtctrlMatchCommRegexTerm" + +type MatchRuleBasedonCommunityRegularExpressionGenerator struct { + ACIService +} + +func (a *MatchRuleBasedonCommunityRegularExpressionGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, matchRuleBasedonCommunityRegularExpressionClassName) + + MatchRuleBasedonCommunityRegularExpressionCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + MatchRuleBasedonCommunityRegularExpressionCount, err := strconv.Atoi(stripQuotes(MatchRuleBasedonCommunityRegularExpressionCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < MatchRuleBasedonCommunityRegularExpressionCount; i++ { + MatchRuleBasedonCommunityRegularExpressionAttr := MatchRuleBasedonCommunityRegularExpressionCont.S("imdata").Index(i).S(matchRuleBasedonCommunityRegularExpressionClassName, "attributes") + MatchRuleBasedonCommunityRegularExpressionDN := G(MatchRuleBasedonCommunityRegularExpressionAttr, "dn") + commType := G(MatchRuleBasedonCommunityRegularExpressionAttr, "commType") + if filterChildrenDn(MatchRuleBasedonCommunityRegularExpressionDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + MatchRuleBasedonCommunityRegularExpressionDN, + resourceNamefromDn(matchRuleBasedonCommunityRegularExpressionClassName, MatchRuleBasedonCommunityRegularExpressionDN, i), + "aci_match_regex_community_terms", + "aci", + map[string]string{ + "match_rule_dn": GetParentDn(MatchRuleBasedonCommunityRegularExpressionDN, fmt.Sprintf("/commrxtrm-%s", commType)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/match_route_destination_rule.go b/providers/aci/match_route_destination_rule.go new file mode 100644 index 0000000000..169f9a40d9 --- /dev/null +++ b/providers/aci/match_route_destination_rule.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const matchRouteDestinationRuleClassName = "rtctrlMatchRtDest" + +type MatchRouteDestinationRuleGenerator struct { + ACIService +} + +func (a *MatchRouteDestinationRuleGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, matchRouteDestinationRuleClassName) + + MatchRouteDestinationRuleCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + MatchRouteDestinationRuleCount, err := strconv.Atoi(stripQuotes(MatchRouteDestinationRuleCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < MatchRouteDestinationRuleCount; i++ { + MatchRouteDestinationRuleAttr := MatchRouteDestinationRuleCont.S("imdata").Index(i).S(matchRouteDestinationRuleClassName, "attributes") + MatchRouteDestinationRuleDN := G(MatchRouteDestinationRuleAttr, "dn") + ip := G(MatchRouteDestinationRuleAttr, "ip") + if filterChildrenDn(MatchRouteDestinationRuleDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + MatchRouteDestinationRuleDN, + resourceNamefromDn(matchRouteDestinationRuleClassName, MatchRouteDestinationRuleDN, i), + "aci_match_route_destination_rule", + "aci", + map[string]string{ + "match_rule_dn": GetParentDn(MatchRouteDestinationRuleDN, fmt.Sprintf("/dest-[%s]", ip)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/match_rule.go b/providers/aci/match_rule.go new file mode 100644 index 0000000000..c196ec9ef0 --- /dev/null +++ b/providers/aci/match_rule.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const matchRuleClassName = "rtctrlSubjP" + +type MatchRuleGenerator struct { + ACIService +} + +func (a *MatchRuleGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, matchRuleClassName) + + MatchRuleCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + MatchRuleCount, err := strconv.Atoi(stripQuotes(MatchRuleCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < MatchRuleCount; i++ { + MatchRuleAttr := MatchRuleCont.S("imdata").Index(i).S(matchRuleClassName, "attributes") + MatchRuleDN := G(MatchRuleAttr, "dn") + name := G(MatchRuleAttr, "name") + if filterChildrenDn(MatchRuleDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + MatchRuleDN, + resourceNamefromDn(matchRuleClassName, MatchRuleDN, i), + "aci_match_rule", + "aci", + map[string]string{ + "tenant_dn": GetParentDn(MatchRuleDN, fmt.Sprintf("/subj-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/mcp_instance_policy.go b/providers/aci/mcp_instance_policy.go new file mode 100644 index 0000000000..5a888f8479 --- /dev/null +++ b/providers/aci/mcp_instance_policy.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const MiscablingProtocolInstancePolicyClassName = "mcpInstPol" + +type MiscablingProtocolInstancePolicyGenerator struct { + ACIService +} + +func (a *MiscablingProtocolInstancePolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, MiscablingProtocolInstancePolicyClassName) + + MiscablingProtocolInstancePolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + MiscablingProtocolInstancePolicyCount, err := strconv.Atoi(stripQuotes(MiscablingProtocolInstancePolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < MiscablingProtocolInstancePolicyCount; i++ { + MiscablingProtocolInstancePolicyAttr := MiscablingProtocolInstancePolicyCont.S("imdata").Index(i).S(MiscablingProtocolInstancePolicyClassName, "attributes") + MiscablingProtocolInstancePolicyDN := G(MiscablingProtocolInstancePolicyAttr, "dn") + if filterChildrenDn(MiscablingProtocolInstancePolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + MiscablingProtocolInstancePolicyDN, + resourceNamefromDn(MiscablingProtocolInstancePolicyClassName, MiscablingProtocolInstancePolicyDN, i), + "aci_mcp_instance_policy", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/mgmt_preference.go b/providers/aci/mgmt_preference.go new file mode 100644 index 0000000000..d50e1ba282 --- /dev/null +++ b/providers/aci/mgmt_preference.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const mgmtconnectivitypreferenceClassName = "mgmtConnectivityPrefs" + +type MgmtconnectivitypreferenceGenerator struct { + ACIService +} + +func (a *MgmtconnectivitypreferenceGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, mgmtconnectivitypreferenceClassName) + + MgmtconnectivitypreferenceCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + MgmtconnectivitypreferenceCount, err := strconv.Atoi(stripQuotes(MgmtconnectivitypreferenceCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < MgmtconnectivitypreferenceCount; i++ { + MgmtconnectivitypreferenceAttr := MgmtconnectivitypreferenceCont.S("imdata").Index(i).S(mgmtconnectivitypreferenceClassName, "attributes") + MgmtconnectivitypreferenceDN := G(MgmtconnectivitypreferenceAttr, "dn") + if filterChildrenDn(MgmtconnectivitypreferenceDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + MgmtconnectivitypreferenceDN, + resourceNamefromDn(mgmtconnectivitypreferenceClassName, MgmtconnectivitypreferenceDN, i), + "aci_mgmt_preference", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/mgmt_zone.go b/providers/aci/mgmt_zone.go new file mode 100644 index 0000000000..d74ca69873 --- /dev/null +++ b/providers/aci/mgmt_zone.go @@ -0,0 +1,98 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const oOBManagedNodesZoneClassName = "mgmtOoBZone" +const inBManagedNodesZoneClassName = "mgmtInBZone" + +type OOBManagedNodesZoneGenerator struct { + ACIService +} + +func (a *OOBManagedNodesZoneGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + OobDnURL := fmt.Sprintf("%s/%s.json", baseURL, oOBManagedNodesZoneClassName) + IndDnURL := fmt.Sprintf("%s/%s.json", baseURL, inBManagedNodesZoneClassName) + OOBManagedNodesZoneCont, err := client.GetViaURL(OobDnURL) + if err != nil { + return err + } + + INBManagedNodesZoneCont, err := client.GetViaURL(IndDnURL) + if err != nil { + return err + } + + OOBManagedNodesZoneCount, err := strconv.Atoi(stripQuotes(OOBManagedNodesZoneCont.S("totalCount").String())) + if err != nil { + return err + } + + INBManagedNodesZoneCount, err := strconv.Atoi(stripQuotes(INBManagedNodesZoneCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < OOBManagedNodesZoneCount; i++ { + OOBManagedNodesZoneAttr := OOBManagedNodesZoneCont.S("imdata").Index(i).S(oOBManagedNodesZoneClassName, "attributes") + OOBManagedNodesZoneDN := G(OOBManagedNodesZoneAttr, "dn") + nameMgmtZone := G(OOBManagedNodesZoneAttr, "name") + type_band := "out_of_band" + if filterChildrenDn(OOBManagedNodesZoneDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + OOBManagedNodesZoneDN, + resourceNamefromDn(oOBManagedNodesZoneClassName, OOBManagedNodesZoneDN, i), + "aci_mgmt_zone", + "aci", + map[string]string{ + "managed_node_connectivity_group_dn": GetParentDn(OOBManagedNodesZoneDN, fmt.Sprintf("/oobzone")), + "type": type_band, + "name": nameMgmtZone, + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + + for i := 0; i < INBManagedNodesZoneCount; i++ { + INBManagedNodesZoneAttr := INBManagedNodesZoneCont.S("imdata").Index(i).S(inBManagedNodesZoneClassName, "attributes") + INBManagedNodesZoneDN := G(INBManagedNodesZoneAttr, "dn") + nameMgmtZone := G(INBManagedNodesZoneAttr, "name") + type_band := "in_band" + if filterChildrenDn(INBManagedNodesZoneDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + INBManagedNodesZoneDN, + resourceNamefromDn(inBManagedNodesZoneClassName, INBManagedNodesZoneDN, i), + "aci_mgmt_zone", + "aci", + map[string]string{ + "managed_node_connectivity_group_dn": GetParentDn(INBManagedNodesZoneDN, fmt.Sprintf("/inbzone")), + "type": type_band, + "name": nameMgmtZone, + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/port_tracking.go b/providers/aci/port_tracking.go new file mode 100644 index 0000000000..bbb7f66f99 --- /dev/null +++ b/providers/aci/port_tracking.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const portTrackingClassName = "infraPortTrackPol" + +type PortTrackingGenerator struct { + ACIService +} + +func (a *PortTrackingGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, portTrackingClassName) + + PortTrackingCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + PortTrackingCount, err := strconv.Atoi(stripQuotes(PortTrackingCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < PortTrackingCount; i++ { + PortTrackingAttr := PortTrackingCont.S("imdata").Index(i).S(portTrackingClassName, "attributes") + PortTrackingDN := G(PortTrackingAttr, "dn") + if filterChildrenDn(PortTrackingDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + PortTrackingDN, + resourceNamefromDn(portTrackingClassName, PortTrackingDN, i), + "aci_port_tracking", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/qos_instance_policy.go b/providers/aci/qos_instance_policy.go new file mode 100644 index 0000000000..3caec7e3f1 --- /dev/null +++ b/providers/aci/qos_instance_policy.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const qOSInstancePolicyClassName = "qosInstPol" + +type QOSInstancePolicyGenerator struct { + ACIService +} + +func (a *QOSInstancePolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, qOSInstancePolicyClassName) + + QOSInstancePolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + QOSInstancePolicyCount, err := strconv.Atoi(stripQuotes(QOSInstancePolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < QOSInstancePolicyCount; i++ { + QOSInstancePolicyAttr := QOSInstancePolicyCont.S("imdata").Index(i).S(qOSInstancePolicyClassName, "attributes") + QOSInstancePolicyDN := G(QOSInstancePolicyAttr, "dn") + if filterChildrenDn(QOSInstancePolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + QOSInstancePolicyDN, + resourceNamefromDn(qOSInstancePolicyClassName, QOSInstancePolicyDN, i), + "aci_qos_instance_policy", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/radius_provider.go b/providers/aci/radius_provider.go new file mode 100644 index 0000000000..46c7238505 --- /dev/null +++ b/providers/aci/radius_provider.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const rADIUSProviderClassName = "aaaRadiusProvider" + +type RADIUSProviderGenerator struct { + ACIService +} + +func (a *RADIUSProviderGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, rADIUSProviderClassName) + + RADIUSProviderCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + RADIUSProviderCount, err := strconv.Atoi(stripQuotes(RADIUSProviderCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < RADIUSProviderCount; i++ { + RADIUSProviderAttr := RADIUSProviderCont.S("imdata").Index(i).S(rADIUSProviderClassName, "attributes") + RADIUSProviderDN := G(RADIUSProviderAttr, "dn") + if filterChildrenDn(RADIUSProviderDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RADIUSProviderDN, + resourceNamefromDn(rADIUSProviderClassName, RADIUSProviderDN, i), + "aci_radius_provider", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/radius_provider_group.go b/providers/aci/radius_provider_group.go new file mode 100644 index 0000000000..783054ed48 --- /dev/null +++ b/providers/aci/radius_provider_group.go @@ -0,0 +1,52 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const radiusProviderGroupClassName = "aaaRadiusProviderGroup" + +type RadiusProviderGroupGenerator struct { + ACIService +} + +func (a *RadiusProviderGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, radiusProviderGroupClassName) + radiusProviderGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + radiusProviderGroupCount, err := strconv.Atoi(stripQuotes(radiusProviderGroupCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < radiusProviderGroupCount; i++ { + radiusProviderGroupAttr := radiusProviderGroupCont.S("imdata").Index(i).S(radiusProviderGroupClassName, "attributes") + radiusProviderGroupDN := G(radiusProviderGroupAttr, "dn") + if filterChildrenDn(radiusProviderGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + radiusProviderGroupDN, + resourceNamefromDn(radiusProviderGroupClassName, radiusProviderGroupDN, i), + "aci_radius_provider_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/recurring_window.go b/providers/aci/recurring_window.go new file mode 100644 index 0000000000..8d43b41f6f --- /dev/null +++ b/providers/aci/recurring_window.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const recurringWindowClassName = "trigRecurrWindowP" + +type RecurringWindowGenerator struct { + ACIService +} + +func (a *RecurringWindowGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, recurringWindowClassName) + + RecurringWindowCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + RecurringWindowCount, err := strconv.Atoi(stripQuotes(RecurringWindowCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < RecurringWindowCount; i++ { + RecurringWindowAttr := RecurringWindowCont.S("imdata").Index(i).S(recurringWindowClassName, "attributes") + RecurringWindowDN := G(RecurringWindowAttr, "dn") + name := G(RecurringWindowAttr, "name") + if filterChildrenDn(RecurringWindowDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RecurringWindowDN, + resourceNamefromDn(recurringWindowClassName, RecurringWindowDN, i), + "aci_recurring_window", + "aci", + map[string]string{ + "scheduler_dn": GetParentDn(RecurringWindowDN, fmt.Sprintf("/recurrwinp-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/route_control_context.go b/providers/aci/route_control_context.go new file mode 100644 index 0000000000..50d496d455 --- /dev/null +++ b/providers/aci/route_control_context.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const routeControlContextClassName = "rtctrlCtxP" + +type RouteControlContextGenerator struct { + ACIService +} + +func (a *RouteControlContextGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, routeControlContextClassName) + + RouteControlContextCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + RouteControlContextCount, err := strconv.Atoi(stripQuotes(RouteControlContextCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < RouteControlContextCount; i++ { + RouteControlContextAttr := RouteControlContextCont.S("imdata").Index(i).S(routeControlContextClassName, "attributes") + RouteControlContextDN := G(RouteControlContextAttr, "dn") + name := G(RouteControlContextAttr, "name") + if filterChildrenDn(RouteControlContextDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RouteControlContextDN, + resourceNamefromDn(routeControlContextClassName, RouteControlContextDN, i), + "aci_route_control_context", + "aci", + map[string]string{ + "route_control_profile_dn": GetParentDn(RouteControlContextDN, fmt.Sprintf("/ctx-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/route_control_profile.go b/providers/aci/route_control_profile.go new file mode 100644 index 0000000000..229baadade --- /dev/null +++ b/providers/aci/route_control_profile.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const routeControlProfileClassName = "rtctrlProfile" + +type RouteControlProfileGenerator struct { + ACIService +} + +func (a *RouteControlProfileGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, routeControlProfileClassName) + + RouteControlProfileCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + RouteControlProfileCount, err := strconv.Atoi(stripQuotes(RouteControlProfileCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < RouteControlProfileCount; i++ { + RouteControlProfileAttr := RouteControlProfileCont.S("imdata").Index(i).S(routeControlProfileClassName, "attributes") + RouteControlProfileDN := G(RouteControlProfileAttr, "dn") + name := G(RouteControlProfileAttr, "name") + if filterChildrenDn(RouteControlProfileDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RouteControlProfileDN, + resourceNamefromDn(routeControlProfileClassName, RouteControlProfileDN, i), + "aci_route_control_profile", + "aci", + map[string]string{ + "parent_dn": GetParentDn(RouteControlProfileDN, fmt.Sprintf("/prof-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/rsa_provider.go b/providers/aci/rsa_provider.go new file mode 100644 index 0000000000..834a90e4dd --- /dev/null +++ b/providers/aci/rsa_provider.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const rSAProviderClassName = "aaaRsaProvider" + +type RSAProviderGenerator struct { + ACIService +} + +func (a *RSAProviderGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, rSAProviderClassName) + + RSAProviderCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + RSAProviderCount, err := strconv.Atoi(stripQuotes(RSAProviderCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < RSAProviderCount; i++ { + RSAProviderAttr := RSAProviderCont.S("imdata").Index(i).S(rSAProviderClassName, "attributes") + RSAProviderDN := G(RSAProviderAttr, "dn") + if filterChildrenDn(RSAProviderDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + RSAProviderDN, + resourceNamefromDn(rSAProviderClassName, RSAProviderDN, i), + "aci_rsa_provider", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/saml_provider.go b/providers/aci/saml_provider.go new file mode 100644 index 0000000000..6d21d57bb1 --- /dev/null +++ b/providers/aci/saml_provider.go @@ -0,0 +1,52 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const samlProviderClassName = "aaaSamlProvider" + +type SAMLProviderGenerator struct { + ACIService +} + +func (a *SAMLProviderGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, samlProviderClassName) + samlProviderCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + samlProviderCount, err := strconv.Atoi(stripQuotes(samlProviderCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < samlProviderCount; i++ { + samlProviderAttr := samlProviderCont.S("imdata").Index(i).S(samlProviderClassName, "attributes") + samlProviderDN := G(samlProviderAttr, "dn") + if filterChildrenDn(samlProviderDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + samlProviderDN, + resourceNamefromDn(samlProviderClassName, samlProviderDN, i), + "aci_saml_provider", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/saml_provider_group.go b/providers/aci/saml_provider_group.go new file mode 100644 index 0000000000..3ed49ba204 --- /dev/null +++ b/providers/aci/saml_provider_group.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const sAMLProviderGroupClassName = "aaaSamlProviderGroup" + +type SAMLProviderGroupGenerator struct { + ACIService +} + +func (a *SAMLProviderGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, sAMLProviderGroupClassName) + + SAMLProviderGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + SAMLProviderGroupCount, err := strconv.Atoi(stripQuotes(SAMLProviderGroupCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < SAMLProviderGroupCount; i++ { + SAMLProviderGroupAttr := SAMLProviderGroupCont.S("imdata").Index(i).S(sAMLProviderGroupClassName, "attributes") + SAMLProviderGroupDN := G(SAMLProviderGroupAttr, "dn") + if filterChildrenDn(SAMLProviderGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + SAMLProviderGroupDN, + resourceNamefromDn(sAMLProviderGroupClassName, SAMLProviderGroupDN, i), + "aci_saml_provider_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/spine_access_port_selector.go b/providers/aci/spine_access_port_selector.go new file mode 100644 index 0000000000..68809e0f33 --- /dev/null +++ b/providers/aci/spine_access_port_selector.go @@ -0,0 +1,61 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const spineAccessPortSelectorClassName = "infraSHPortS" + +type SpineAccessPortSelectorGenerator struct { + ACIService +} + +func (a *SpineAccessPortSelectorGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, spineAccessPortSelectorClassName) + + SpineAccessPortSelectorCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + SpineAccessPortSelectorCount, err := strconv.Atoi(stripQuotes(SpineAccessPortSelectorCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < SpineAccessPortSelectorCount; i++ { + SpineAccessPortSelectorAttr := SpineAccessPortSelectorCont.S("imdata").Index(i).S(spineAccessPortSelectorClassName, "attributes") + SpineAccessPortSelectorDN := G(SpineAccessPortSelectorAttr, "dn") + name := G(SpineAccessPortSelectorAttr, "name") + spine_access_port_selector_type := G(SpineAccessPortSelectorAttr, "spine_access_port_selector_type") + if filterChildrenDn(SpineAccessPortSelectorDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + SpineAccessPortSelectorDN, + resourceNamefromDn(spineAccessPortSelectorClassName, SpineAccessPortSelectorDN, i), + "aci_spine_access_port_selector", + "aci", + map[string]string{ + "spine_interface_profile_dn": GetParentDn(SpineAccessPortSelectorDN, fmt.Sprintf("/shports-%s-typ-%s", name, spine_access_port_selector_type)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/spine_interface_profile_selector.go b/providers/aci/spine_interface_profile_selector.go new file mode 100644 index 0000000000..3f4f3db7f1 --- /dev/null +++ b/providers/aci/spine_interface_profile_selector.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const interfaceProfileClassName = "infraRsSpAccPortP" + +type InterfaceProfileGenerator struct { + ACIService +} + +func (a *InterfaceProfileGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, interfaceProfileClassName) + + InterfaceProfileCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + InterfaceProfileCount, err := strconv.Atoi(stripQuotes(InterfaceProfileCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < InterfaceProfileCount; i++ { + InterfaceProfileAttr := InterfaceProfileCont.S("imdata").Index(i).S(interfaceProfileClassName, "attributes") + InterfaceProfileDN := G(InterfaceProfileAttr, "dn") + tDn := G(InterfaceProfileAttr, "tDn") + if filterChildrenDn(InterfaceProfileDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + InterfaceProfileDN, + resourceNamefromDn(interfaceProfileClassName, InterfaceProfileDN, i), + "aci_spine_interface_profile_selector", + "aci", + map[string]string{ + "spine_profile_dn": GetParentDn(InterfaceProfileDN, fmt.Sprintf("/rsspAccPortP-[%s]", tDn)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/spine_switch_policy_group.go b/providers/aci/spine_switch_policy_group.go new file mode 100644 index 0000000000..13a97b9237 --- /dev/null +++ b/providers/aci/spine_switch_policy_group.go @@ -0,0 +1,53 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const spineSwitchPolicyGroupClassName = "infraSpineAccNodePGrp" + +type SpineSwitchPolicyGroupGenerator struct { + ACIService +} + +func (a *SpineSwitchPolicyGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, spineSwitchPolicyGroupClassName) + SpineSwitchPolicyGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + SpineSwitchPolicyGroupCount, err := strconv.Atoi(stripQuotes(SpineSwitchPolicyGroupCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < SpineSwitchPolicyGroupCount; i++ { + SpineSwitchPolicyGroupAttr := SpineSwitchPolicyGroupCont.S("imdata").Index(i).S(spineSwitchPolicyGroupClassName, "attributes") + SpineSwitchPolicyGroupDN := G(SpineSwitchPolicyGroupAttr, "dn") + if filterChildrenDn(SpineSwitchPolicyGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + SpineSwitchPolicyGroupDN, + resourceNamefromDn(spineSwitchPolicyGroupClassName, SpineSwitchPolicyGroupDN, i), + "aci_spine_switch_policy_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/tacacs_accounting.go b/providers/aci/tacacs_accounting.go new file mode 100644 index 0000000000..23c492f573 --- /dev/null +++ b/providers/aci/tacacs_accounting.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const tACACSMonitoringDestinationGroupClassName = "tacacsGroup" + +type TACACSMonitoringDestinationGroupGenerator struct { + ACIService +} + +func (a *TACACSMonitoringDestinationGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, tACACSMonitoringDestinationGroupClassName) + + TACACSMonitoringDestinationGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + TACACSMonitoringDestinationGroupCount, err := strconv.Atoi(stripQuotes(TACACSMonitoringDestinationGroupCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < TACACSMonitoringDestinationGroupCount; i++ { + TACACSMonitoringDestinationGroupAttr := TACACSMonitoringDestinationGroupCont.S("imdata").Index(i).S(tACACSMonitoringDestinationGroupClassName, "attributes") + TACACSMonitoringDestinationGroupDN := G(TACACSMonitoringDestinationGroupAttr, "dn") + if filterChildrenDn(TACACSMonitoringDestinationGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TACACSMonitoringDestinationGroupDN, + resourceNamefromDn(tACACSMonitoringDestinationGroupClassName, TACACSMonitoringDestinationGroupDN, i), + "aci_tacacs_accounting", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/tacacs_accounting_destination.go b/providers/aci/tacacs_accounting_destination.go new file mode 100644 index 0000000000..38ae8a0391 --- /dev/null +++ b/providers/aci/tacacs_accounting_destination.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const TACACSDestinationClassName = "tacacsTacacsDest" + +type TACACSDestinationGenerator struct { + ACIService +} + +func (a *TACACSDestinationGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, TACACSDestinationClassName) + TACACSDestinationCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + TACACSDestinationCount, err := strconv.Atoi(stripQuotes(TACACSDestinationCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < TACACSDestinationCount; i++ { + TACACSDestinationAttr := TACACSDestinationCont.S("imdata").Index(i).S(TACACSDestinationClassName, "attributes") + TACACSDestinationDN := G(TACACSDestinationAttr, "dn") + host := G(TACACSDestinationAttr, "host") + port := G(TACACSDestinationAttr, "port") + if filterChildrenDn(TACACSDestinationDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TACACSDestinationDN, + resourceNamefromDn(TACACSDestinationClassName, TACACSDestinationDN, i), + "aci_tacacs_accounting_destination", + "aci", + map[string]string{ + "tacacs_accounting_dn": GetParentDn(TACACSDestinationDN, fmt.Sprintf("/tacacsdest-%s-port-%s", host, port)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/tacacs_provider.go b/providers/aci/tacacs_provider.go new file mode 100644 index 0000000000..d9b0f76fbb --- /dev/null +++ b/providers/aci/tacacs_provider.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const tACACSPlusProviderClassName = "aaaTacacsPlusProvider" + +type TACACSPlusProviderGenerator struct { + ACIService +} + +func (a *TACACSPlusProviderGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, tACACSPlusProviderClassName) + + TACACSPlusProviderCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + TACACSPlusProviderCount, err := strconv.Atoi(stripQuotes(TACACSPlusProviderCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < TACACSPlusProviderCount; i++ { + TACACSPlusProviderAttr := TACACSPlusProviderCont.S("imdata").Index(i).S(tACACSPlusProviderClassName, "attributes") + TACACSPlusProviderDN := G(TACACSPlusProviderAttr, "dn") + if filterChildrenDn(TACACSPlusProviderDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TACACSPlusProviderDN, + resourceNamefromDn(tACACSPlusProviderClassName, TACACSPlusProviderDN, i), + "aci_tacacs_provider", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/tacacs_provider_group.go b/providers/aci/tacacs_provider_group.go new file mode 100644 index 0000000000..e868c65291 --- /dev/null +++ b/providers/aci/tacacs_provider_group.go @@ -0,0 +1,57 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const tACACSPlusProviderGroupClassName = "aaaTacacsPlusProviderGroup" + +type TACACSPlusProviderGroupGenerator struct { + ACIService +} + +func (a *TACACSPlusProviderGroupGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, tACACSPlusProviderGroupClassName) + + TACACSPlusProviderGroupCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + TACACSPlusProviderGroupCount, err := strconv.Atoi(stripQuotes(TACACSPlusProviderGroupCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < TACACSPlusProviderGroupCount; i++ { + TACACSPlusProviderGroupAttr := TACACSPlusProviderGroupCont.S("imdata").Index(i).S(tACACSPlusProviderGroupClassName, "attributes") + TACACSPlusProviderGroupDN := G(TACACSPlusProviderGroupAttr, "dn") + if filterChildrenDn(TACACSPlusProviderGroupDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TACACSPlusProviderGroupDN, + resourceNamefromDn(tACACSPlusProviderGroupClassName, TACACSPlusProviderGroupDN, i), + "aci_tacacs_provider_group", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/tacacs_source.go b/providers/aci/tacacs_source.go new file mode 100644 index 0000000000..e7372ac62e --- /dev/null +++ b/providers/aci/tacacs_source.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const tACACSSourceClassName = "tacacsSrc" + +type TACACSSourceGenerator struct { + ACIService +} + +func (a *TACACSSourceGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, tACACSSourceClassName) + + TACACSSourceCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + TACACSSourceCount, err := strconv.Atoi(stripQuotes(TACACSSourceCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < TACACSSourceCount; i++ { + TACACSSourceAttr := TACACSSourceCont.S("imdata").Index(i).S(tACACSSourceClassName, "attributes") + TACACSSourceDN := G(TACACSSourceAttr, "dn") + name := G(TACACSSourceAttr, "name") + if filterChildrenDn(TACACSSourceDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TACACSSourceDN, + resourceNamefromDn(tACACSSourceClassName, TACACSSourceDN, i), + "aci_tacacs_source", + "aci", + map[string]string{ + "parent_dn": GetParentDn(TACACSSourceDN, fmt.Sprintf("/tacacssrc-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/tag.go b/providers/aci/tag.go new file mode 100644 index 0000000000..40e12a4a4e --- /dev/null +++ b/providers/aci/tag.go @@ -0,0 +1,60 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const tagOriginalClassName = "tagTag" + +type tagOriginalGenerator struct { + ACIService +} + +func (a *tagOriginalGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, tagOriginalClassName) + + TagCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + TagCount, err := strconv.Atoi(stripQuotes(TagCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < TagCount; i++ { + TagAttr := TagCont.S("imdata").Index(i).S(tagOriginalClassName, "attributes") + TagDN := G(TagAttr, "dn") + key := G(TagAttr, "key") + if filterChildrenDn(TagDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + TagDN, + resourceNamefromDn(tagOriginalClassName, TagDN, i), + "aci_tag", + "aci", + map[string]string{ + "parent_dn": GetParentDn(TagDN, fmt.Sprintf("/tagKey-%s", key)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/user_security_domain.go b/providers/aci/user_security_domain.go new file mode 100644 index 0000000000..9d2ea0102d --- /dev/null +++ b/providers/aci/user_security_domain.go @@ -0,0 +1,59 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const userDomainClassName = "aaaUserDomain" + +type UserDomainGenerator struct { + ACIService +} + +func (a *UserDomainGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, userDomainClassName) + + UserDomainCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + UserDomainCount, err := strconv.Atoi(stripQuotes(UserDomainCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < UserDomainCount; i++ { + UserDomainAttr := UserDomainCont.S("imdata").Index(i).S(userDomainClassName, "attributes") + UserDomainDN := G(UserDomainAttr, "dn") + name := G(UserDomainAttr, "name") + if filterChildrenDn(UserDomainDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + UserDomainDN, + resourceNamefromDn(userDomainClassName, UserDomainDN, i), + "aci_user_security_domain", + "aci", + map[string]string{ + "local_user_dn": GetParentDn(UserDomainDN, fmt.Sprintf("/userdomain-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/user_security_domain_role.go b/providers/aci/user_security_domain_role.go new file mode 100644 index 0000000000..21508b28f9 --- /dev/null +++ b/providers/aci/user_security_domain_role.go @@ -0,0 +1,59 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const userRoleClassName = "aaaUserRole" + +type UserRoleGenerator struct { + ACIService +} + +func (a *UserRoleGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, userRoleClassName) + + UserRoleCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + UserRoleCount, err := strconv.Atoi(stripQuotes(UserRoleCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < UserRoleCount; i++ { + UserRoleAttr := UserRoleCont.S("imdata").Index(i).S(userRoleClassName, "attributes") + UserRoleDN := G(UserRoleAttr, "dn") + name := G(UserRoleAttr, "name") + if filterChildrenDn(UserRoleDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + UserRoleDN, + resourceNamefromDn(userRoleClassName, UserRoleDN, i), + "aci_user_security_domain_role", + "aci", + map[string]string{ + "user_domain_dn": GetParentDn(UserRoleDN, fmt.Sprintf("/role-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/vpc_domain_policy.go b/providers/aci/vpc_domain_policy.go new file mode 100644 index 0000000000..57459e0cff --- /dev/null +++ b/providers/aci/vpc_domain_policy.go @@ -0,0 +1,58 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const vPCDomainPolicyClassName = "vpcInstPol" + +type VPCDomainPolicyGenerator struct { + ACIService +} + +func (a *VPCDomainPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, vPCDomainPolicyClassName) + + VPCDomainPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + VPCDomainPolicyCount, err := strconv.Atoi(stripQuotes(VPCDomainPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < VPCDomainPolicyCount; i++ { + VPCDomainPolicyAttr := VPCDomainPolicyCont.S("imdata").Index(i).S(vPCDomainPolicyClassName, "attributes") + VPCDomainPolicyDN := G(VPCDomainPolicyAttr, "dn") + name := G(VPCDomainPolicyAttr, "name") + if filterChildrenDn(VPCDomainPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + VPCDomainPolicyDN, + name, + "aci_vpc_domain_policy", + "aci", + map[string]string{}, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/vrf_snmp_context.go b/providers/aci/vrf_snmp_context.go new file mode 100644 index 0000000000..5e05a7a2aa --- /dev/null +++ b/providers/aci/vrf_snmp_context.go @@ -0,0 +1,58 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const sNMPContextProfileClassName = "snmpCtxP" + +type SNMPContextProfileGenerator struct { + ACIService +} + +func (a *SNMPContextProfileGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, sNMPContextProfileClassName) + + SNMPContextProfileCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + SNMPContextProfileCount, err := strconv.Atoi(stripQuotes(SNMPContextProfileCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < SNMPContextProfileCount; i++ { + SNMPContextProfileAttr := SNMPContextProfileCont.S("imdata").Index(i).S(sNMPContextProfileClassName, "attributes") + SNMPContextProfileDN := G(SNMPContextProfileAttr, "dn") + if filterChildrenDn(SNMPContextProfileDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + SNMPContextProfileDN, + resourceNamefromDn(sNMPContextProfileClassName, SNMPContextProfileDN, i), + "aci_vrf_snmp_context", + "aci", + map[string]string{ + "vrf_dn": GetParentDn(SNMPContextProfileDN, fmt.Sprint("/snmpctx")), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/vrf_snmp_context_community.go b/providers/aci/vrf_snmp_context_community.go new file mode 100644 index 0000000000..7339e2ba0e --- /dev/null +++ b/providers/aci/vrf_snmp_context_community.go @@ -0,0 +1,59 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const sNMPCommunityClassName = "snmpCommunityP" + +type SNMPCommunityGenerator struct { + ACIService +} + +func (a *SNMPCommunityGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, sNMPCommunityClassName) + + SNMPCommunityCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + + SNMPCommunityCount, err := strconv.Atoi(stripQuotes(SNMPCommunityCont.S("totalCount").String())) + if err != nil { + return err + } + + for i := 0; i < SNMPCommunityCount; i++ { + SNMPCommunityAttr := SNMPCommunityCont.S("imdata").Index(i).S(sNMPCommunityClassName, "attributes") + SNMPCommunityDN := G(SNMPCommunityAttr, "dn") + name := G(SNMPCommunityAttr, "name") + if filterChildrenDn(SNMPCommunityDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + SNMPCommunityDN, + resourceNamefromDn(sNMPCommunityClassName, SNMPCommunityDN, i), + "aci_vrf_snmp_context_community", + "aci", + map[string]string{ + "vrf_snmp_context_dn": GetParentDn(SNMPCommunityDN, fmt.Sprintf("/community-%s", name)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +} diff --git a/providers/aci/vrf_to_bgp_address_family_context.go b/providers/aci/vrf_to_bgp_address_family_context.go new file mode 100644 index 0000000000..57f23ff830 --- /dev/null +++ b/providers/aci/vrf_to_bgp_address_family_context.go @@ -0,0 +1,56 @@ +package aci + +import ( + "fmt" + "strconv" + + "github.com/GoogleCloudPlatform/terraformer/terraformutils" +) + +const bGPAddressFamilyContextPolicyClassName = "fvRsCtxToBgpCtxAfPol" + +type BGPAddressFamilyContextPolicyGenerator struct { + ACIService +} + +func (a *BGPAddressFamilyContextPolicyGenerator) InitResources() error { + if clientImpl == nil { + _, err := a.createClient() + if err != nil { + return err + } + } + client := clientImpl + baseURL := "/api/node/class" + dnURL := fmt.Sprintf("%s/%s.json", baseURL, bGPAddressFamilyContextPolicyClassName) + BGPAddressFamilyContextPolicyCont, err := client.GetViaURL(dnURL) + if err != nil { + return err + } + BGPAddressFamilyContextPolicyCount, err := strconv.Atoi(stripQuotes(BGPAddressFamilyContextPolicyCont.S("totalCount").String())) + if err != nil { + return err + } + for i := 0; i < BGPAddressFamilyContextPolicyCount; i++ { + BGPAddressFamilyContextPolicyAttr := BGPAddressFamilyContextPolicyCont.S("imdata").Index(i).S(bGPAddressFamilyContextPolicyClassName, "attributes") + BGPAddressFamilyContextPolicyDN := G(BGPAddressFamilyContextPolicyAttr, "dn") + tnBgpCtxAfPolName := G(BGPAddressFamilyContextPolicyAttr, "tnBgpCtxAfPolName") + af := G(BGPAddressFamilyContextPolicyAttr, "af") + if filterChildrenDn(BGPAddressFamilyContextPolicyDN, client.parentResource) != "" { + resource := terraformutils.NewResource( + BGPAddressFamilyContextPolicyDN, + resourceNamefromDn(bGPAddressFamilyContextPolicyClassName, BGPAddressFamilyContextPolicyDN, i), + "aci_vrf_to_bgp_address_family_context", + "aci", + map[string]string{ + "vrf_dn": GetParentDn(BGPAddressFamilyContextPolicyDN, fmt.Sprintf("/rsctxToBgpCtxAfPol-[%s]-%s", tnBgpCtxAfPolName, af)), + }, + []string{}, + map[string]interface{}{}, + ) + resource.SlowQueryRequired = true + a.Resources = append(a.Resources, resource) + } + } + return nil +}