storj/private/apigen/common.go
Jeremy Wharton 5ce7d980af private/apigen: Make API generation deterministic
This change fixes the issue where the API generator would produce
different Go code for the same API definition upon each invocation
due to the random nature of map iteration.

Change-Id: I6770a10faf06311c24f541611c25d0b2b0f8e521
2022-06-17 12:06:08 -05:00

30 lines
567 B
Go

// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
package apigen
import (
"storj.io/storj/private/api"
)
// API represents specific API's configuration.
type API struct {
Version string
Description string
PackageName string
Auth api.Auth
EndpointGroups []*EndpointGroup
}
// Group adds new endpoints group to API.
func (a *API) Group(name, prefix string) *EndpointGroup {
group := &EndpointGroup{
Name: name,
Prefix: prefix,
}
a.EndpointGroups = append(a.EndpointGroups, group)
return group
}