stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
224 stars 117 forks source link

Unexported links #227

Closed Danile71 closed 1 year ago

Danile71 commented 1 year ago

Abstract case:

1 First app 1.1 Connect to BMC via redfish and get session (id+token). 1.2 Get root service 1.3 Execute next app

2 Second app 2.1 Get all systems with session from first app 2.2 Execute next app

config := gofish.ClientConfig{
    Endpoint: m.Endpoint,
    Session:  m.Session,
}

client,err := gofish.ConnectContext(ctx, config)

// systemsCollectionLink? need from first app
links, err := common.GetCollection(client, systemsCollectionLink)

for _, link := range links.ItemLinks {
computerSystem, err := redfish.GetComputerSystem(client, link)
}

3 Third app 3.1 Get bios by system with session from second app ....

What about public methods?

func (serviceroot *Service) SystemsLink() (string) {
    return serviceroot.systems
}
stmcginnis commented 1 year ago

Links are intentionally not public. They should be accessed through their parent objects.

This is a bit of a different use case with trying to share between two different apps. I would recommend passing the systems OID between apps, then having the second app find the requested object by matching on that.