Skip to content

cannot use []ltm.Profile literal (type []ltm.Profile) as type []string in field value #1

@vincentmli

Description

@vincentmli

when go building the sample script to create virtual from https://devcentral.f5.com/codeshare/go-library-to-manage-big-ip-icontrol-rest-api-925, got build error

cannot use []ltm.Profile literal (type []ltm.Profile) as type []string in field value

        // Create a Virtual Server
        log.Print("Create a Virtual Server")

        vsConfig := ltm.VirtualServer{
                Name:        "vs_http_" + tx.TransactionID(),
                Destination: "10.1.20.130:80",
                IPProtocol:  "tcp",
                Pool:        "pool_" + tx.TransactionID(),
                SourceAddressTranslation: ltm.SourceAddressTranslation{
                        Type: "automap",
                },
                Profiles: []ltm.Profile{
                        {
                                Name:    "tcp-mobile-optimized",
                                Context: "all",
                        },
                        {
                                Name: "http",
                        },
                },
        }

        if err := ltmClient.Virtual().Create(vsConfig); err != nil {
                log.Fatal(err)
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions