-
Notifications
You must be signed in to change notification settings - Fork 82
/
args.go
41 lines (32 loc) · 1.39 KB
/
args.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Helper methods for Oracle Cloud Infrastructure Go SDK Samples
package helpers
import (
"os"
"github.com/oracle/oci-go-sdk/v65/common"
)
var (
availabilityDomain string
compartmentID string
rootCompartmentID string
)
// ParseEnvironmentVariables parse shared variables from environment variables, other samples should define their own
// viariables and call this function to initialize shared variables
func ParseEnvironmentVariables() {
availabilityDomain = os.Getenv("OCI_AVAILABILITY_DOMAIN")
compartmentID = os.Getenv("OCI_COMPARTMENT_ID")
rootCompartmentID = os.Getenv("OCI_ROOT_COMPARTMENT_ID")
}
// AvailabilityDomain return the aviailability domain defined in .env.sample file
func AvailabilityDomain() *string {
return common.String(availabilityDomain)
}
// CompartmentID return the compartment ID defined in .env.sample file
func CompartmentID() *string {
return common.String(compartmentID)
}
// RootCompartmentID return the root compartment ID defined in .env.sample file
func RootCompartmentID() *string {
return common.String(rootCompartmentID)
}