constellation/hack/build-manifest/azure/options.go
Thomas Tendyck bd63aa3c6b add license headers
sed -i '1i/*\nCopyright (c) Edgeless Systems GmbH\n\nSPDX-License-Identifier: AGPL-3.0-only\n*/\n' `grep -rL --include='*.go' 'DO NOT EDIT'`
gofumpt -w .
2022-09-05 09:17:25 +02:00

44 lines
838 B
Go

/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package azure
import (
"fmt"
"github.com/google/uuid"
)
const (
DefaultResourceGroupName = "CONSTELLATION-IMAGES"
DefaultGalleryName = "Constellation_CVM"
DefaultImageDefinition = "constellation"
)
type Options struct {
SubscriptionID string
ResourceGroupName string
GalleryName string
ImageDefinition string
}
func DefaultOptions() Options {
return Options{
SubscriptionID: "",
ResourceGroupName: DefaultResourceGroupName,
GalleryName: DefaultGalleryName,
ImageDefinition: DefaultImageDefinition,
}
}
func (o *Options) SetSubscription(sub string) error {
if _, err := uuid.Parse(sub); err != nil {
return fmt.Errorf("unable to set subscription: %w", err)
}
o.SubscriptionID = sub
return nil
}