// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
// All rights reserved.
//
// Licensed under the Mozilla Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://mozilla.org/MPL/2.0/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: MPL-2.0

// Code generated by "gen/generator.go"; DO NOT EDIT.

package provider

// Section below is generated&owned by "gen/generator.go". //template:begin imports
import (
	"fmt"
	"testing"

	"github.com/hashicorp/terraform-plugin-testing/helper/resource"
	"github.com/hashicorp/terraform-plugin-testing/terraform"
)

// End of section. //template:end imports

// Section below is generated&owned by "gen/generator.go". //template:begin testAcc

func TestAccIosxeFlowExporter(t *testing.T) {
	var checks []resource.TestCheckFunc
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_flow_exporter.test", "name", "EXPORTER1"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_flow_exporter.test", "description", "My exporter"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_flow_exporter.test", "destination_ip", "1.1.1.1"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_flow_exporter.test", "source_loopback", "123"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_flow_exporter.test", "transport_udp", "655"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_flow_exporter.test", "template_data_timeout", "60"))
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t) },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config: testAccIosxeFlowExporterConfig_minimum(),
			},
			{
				Config: testAccIosxeFlowExporterConfig_all(),
				Check:  resource.ComposeTestCheckFunc(checks...),
			},
			{
				ResourceName:            "iosxe_flow_exporter.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateIdFunc:       iosxeFlowExporterImportStateIdFunc("iosxe_flow_exporter.test"),
				ImportStateVerifyIgnore: []string{"option_sampler_table"},
				Check:                   resource.ComposeTestCheckFunc(checks...),
			},
		},
	})
}

// End of section. //template:end testAcc

// Section below is generated&owned by "gen/generator.go". //template:begin importStateIdFunc

func iosxeFlowExporterImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
	return func(s *terraform.State) (string, error) {
		primary := s.RootModule().Resources[resourceName].Primary
		Name := primary.Attributes["name"]

		return fmt.Sprintf("%s", Name), nil
	}
}

// End of section. //template:end importStateIdFunc

// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
// End of section. //template:end testPrerequisites

// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimal

func testAccIosxeFlowExporterConfig_minimum() string {
	config := `resource "iosxe_flow_exporter" "test" {` + "\n"
	config += `	name = "EXPORTER1"` + "\n"
	config += `}` + "\n"
	return config
}

// End of section. //template:end testAccConfigMinimal

// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll

func testAccIosxeFlowExporterConfig_all() string {
	config := `resource "iosxe_flow_exporter" "test" {` + "\n"
	config += `	name = "EXPORTER1"` + "\n"
	config += `	description = "My exporter"` + "\n"
	config += `	destination_ip = "1.1.1.1"` + "\n"
	config += `	source_loopback = 123` + "\n"
	config += `	transport_udp = 655` + "\n"
	config += `	template_data_timeout = 60` + "\n"
	config += `}` + "\n"
	return config
}

// End of section. //template:end testAccConfigAll
