Alex Vanin
e02ee50d7b
Due to source code relocation from GitHub. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
19 lines
559 B
Go
19 lines
559 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-http-gw/resolver"
|
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
|
)
|
|
|
|
// GetContainerID decode container id, if it's not a valid container id
|
|
// then trey to resolve name using provided resolver.
|
|
func GetContainerID(ctx context.Context, containerID string, resolver *resolver.ContainerResolver) (*cid.ID, error) {
|
|
cnrID := new(cid.ID)
|
|
err := cnrID.DecodeString(containerID)
|
|
if err != nil {
|
|
cnrID, err = resolver.Resolve(ctx, containerID)
|
|
}
|
|
return cnrID, err
|
|
}
|