Skip to content

Commit

Permalink
Merge branch 'main' into docs-audit_CDNs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething authored Nov 29, 2023
2 parents 65367c9 + e9c6b11 commit 99e0d70
Show file tree
Hide file tree
Showing 106 changed files with 2,227 additions and 606 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DOCS_OUT = $(shell echo $${DOCS_OUT:-$(my_d)/builds/docs/yaml})
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
GOFILES_NOVENDOR_NOMOCK = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "*_mock.go")

GOOS = linux
ifeq ($(UNAME_S),Darwin)
Expand Down Expand Up @@ -113,7 +113,7 @@ shellcheck:
gofmt_check:
@echo "==> ensure code adheres to gofmt (with vendor directory excluded)"
@echo ""
@GOFMT=$$(gofmt -l ${GOFILES_NOVENDOR}); \
@GOFMT=$$(gofmt -w -r 'interface{} -> any' -l ${GOFILES_NOVENDOR_NOMOCK}); \
if [ -n "$${GOFMT}" ]; then \
echo "gofmt checking failed:\n"; echo "$${GOFMT} \n"; exit 1; \
fi
Expand Down
49 changes: 49 additions & 0 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ const (
ArgDatabaseRestoreFromTimestamp = "restore-from-timestamp"
// ArgDatabaseEngine is a flag for specifying which database engine to use
ArgDatabaseEngine = "engine"
// ArgDatabaseConfigJson is a flag for specifying the database configuration in JSON format for an update
ArgDatabaseConfigJson = "config-json"
// ArgDatabaseNumNodes is the number of nodes in the database cluster
ArgDatabaseNumNodes = "num-nodes"
// ArgDatabaseStorageSizeMib is the amount of disk space, in MiB, that should be allocated to the database cluster
Expand All @@ -387,6 +389,53 @@ const (
// ArgDatabasePrivateConnectionBool determine if the private connection details should be shown
ArgDatabasePrivateConnectionBool = "private"

// ArgDatabaseTopicReplicationFactor is the replication factor of a kafka topic
ArgDatabaseTopicReplicationFactor = "replication-factor"
// ArgDatabaseTopicPartitionCount is the number of partitions that are associated with a kafka topic
ArgDatabaseTopicPartitionCount = "partition-count"
// ArgDatabaseTopicCleanupPolicy is the cleanup policy associated with a kafka topic
ArgDatabaseTopicCleanupPolicy = "cleanup-policy"
// ArgDatabaseTopicCompressionType is the compression algorithm used for a kafka topic
ArgDatabaseTopicCompressionType = "compression-type"
// ArgDatabaseTopicDeleteRetentionMS is the amount of time, in ms, to retain delete tombstone markers for a kafka topic
ArgDatabaseTopicDeleteRetentionMS = "delete-retention-ms"
// ArgDatabaseTopicFileDeleteDelayMS is the amount of time, in ms, to wait before deleting a file from the filesystem
ArgDatabaseTopicFileDeleteDelayMS = "file-delete-delay-ms"
// ArgDatabaseTopicFlushMessages is the size, in bytes, of all messages to accumulate on a partition before flushing them to disk
ArgDatabaseTopicFlushMessages = "flush-messages"
// ArgDatabaseTopicFlushMS is the amount of time, in ms, a message is kept in memory before it is flushed to disk
ArgDatabaseTopicFlushMS = "flush-ms"
// ArgDatabaseTopicIntervalIndexBytes is the number of bytes between entries being added into the offset index
ArgDatabaseTopicIntervalIndexBytes = "interval-index-bytes"
// ArgDatabaseTopicMaxCompactionLagMS is the maximum amount of time, in ms, that a message will remain uncompacted (if compaction is enabled)
ArgDatabaseTopicMaxCompactionLagMS = "max-compaction-lag-ms"
// ArgDatabaseTopicMaxMessageBytes is the maximum size, in bytes, of the largest record batch that can be sent to the server
ArgDatabaseTopicMaxMessageBytes = "max-message-bytes"
// ArgDatabaseTopicMesssageDownConversionEnable determines whether brokers should convert messages for consumers expecting older message formats
ArgDatabaseTopicMesssageDownConversionEnable = "message-down-conversion-enable"
// ArgDatabaseTopicMessageFormatVersion is the version used by the broker to append messages to the kafka topic logs
ArgDatabaseTopicMessageFormatVersion = "message-format-version"
// ArgDatabaseTopicMessageTimestampType is the timestamp used for messages
ArgDatabaseTopicMessageTimestampType = "message-timestamp-type"
// ArgDatabaseTopicMinCleanableDirtyRatio is ratio, between 0 and 1, specifying the frequenty of log compaction
ArgDatabaseTopicMinCleanableDirtyRatio = "min-cleanable-dirty-ratio"
// ArgDatabaseTopicMinCompactionLagMS is the minimum time, in ms, that a message will remain uncompacted
ArgDatabaseTopicMinCompactionLagMS = "min-compaction-lag-ms"
// ArgDatabaseTopicMinInsyncReplicas is the minimum number of replicas that must ACK a write for the write to be considered successful
ArgDatabaseTopicMinInsyncReplicas = "min-insync-replicas"
// ArgDatabaseTopicPreallocate determines whether a file should be preallocated on disk when creating a new log segment
ArgDatabaseTopicPreallocate = "preallocate"
// ArgDatabaseTopicRetentionBytes is the maximum size, in bytes, of a topic log before messages are deleted
ArgDatabaseTopicRetentionBytes = "retention-bytes"
// ArgDatabaseTopicRetentionMS is the maximum time, in ms, that a message is retained before deleting it
ArgDatabaseTopicRetentionMS = "retention-ms"
// ArgDatabaseTopicSegmentBytes is the maximum size, in bytes, of a single log file
ArgDatabaseTopicSegmentBytes = "segment-bytes"
// ArgDatabaseTopicSegmentJitterMS is the maximum random jitter, in ms, subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling
ArgDatabaseTopicSegmentJitterMS = "segment-jitter-ms"
// ArgDatabaseTopicSegmentMS is the period of time, in ms, after which the log will be forced to roll if the segment file isn't full
ArgDatabaseTopicSegmentMS = "segment-ms"

// ArgPrivateNetworkUUID is the flag for VPC UUID
ArgPrivateNetworkUUID = "private-network-uuid"

Expand Down
18 changes: 9 additions & 9 deletions commands/activations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ func TestActivationsCommand(t *testing.T) {
assert.ElementsMatch(t, expected, names)
}

var hello1Result = whisk.Result(map[string]interface{}{
var hello1Result = whisk.Result(map[string]any{
"body": "Hello stranger!",
})

var hello2Result = whisk.Result(map[string]interface{}{
var hello2Result = whisk.Result(map[string]any{
"body": "Hello Archie!",
})

var hello3Result = whisk.Result(map[string]interface{}{
var hello3Result = whisk.Result(map[string]any{
"error": "Missing main/no code to execute.",
})

Expand Down Expand Up @@ -354,10 +354,10 @@ func TestActivationsList(t *testing.T) {
}

count := false
var limit interface{}
var since interface{}
var upto interface{}
var skip interface{}
var limit any
var since any
var upto any
var skip any

if tt.doctlFlags != nil {
for k, v := range tt.doctlFlags {
Expand Down Expand Up @@ -466,8 +466,8 @@ func TestActivationsLogs(t *testing.T) {
activationId = config.Args[0]
}

var limit interface{}
var funcName interface{}
var limit any
var funcName any

if tt.doctlFlags != nil {
for k, v := range tt.doctlFlags {
Expand Down
4 changes: 2 additions & 2 deletions commands/apps_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ func appDevPrepareEnvironment(ctx context.Context, ws *workspace.AppDev, cli bui
}

// TODO: get stack run image from builder image md after we pull it, see below
images = append(images, "digitaloceanapps/apps-run:heroku-18_1b6264d")
images = append(images, "digitaloceanapps/apps-run:heroku-22_1b6264d")
images = append(images, "digitaloceanapps/apps-run:heroku-18_db5978a")
images = append(images, "digitaloceanapps/apps-run:heroku-22_db5978a")
}

if componentSpec.GetType() == godo.AppComponentTypeStaticSite {
Expand Down
2 changes: 1 addition & 1 deletion commands/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func RunAuthList(c *CmdConfig) error {
return nil
}

func displayAuthContexts(out io.Writer, currentContext string, contexts map[string]interface{}) {
func displayAuthContexts(out io.Writer, currentContext string, contexts map[string]any) {
// Because the default context isn't present on the auth-contexts field,
// we add it manually so that it's always included in the output, and so
// we can check if it's the current context.
Expand Down
26 changes: 13 additions & 13 deletions commands/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ func TestAuthInitConfig(t *testing.T) {
// Ensure that the dev.config.set.dev-config setting is correct to prevent
// a conflict with the base config setting.
devConfig := configFile["dev"]
devConfigSetting := devConfig.(map[interface{}]interface{})["config"]
expectedConfigSetting := map[interface{}]interface{}(
map[interface{}]interface{}{
"set": map[interface{}]interface{}{"dev-config": ""},
"unset": map[interface{}]interface{}{"dev-config": ""},
devConfigSetting := devConfig.(map[any]any)["config"]
expectedConfigSetting := map[any]any(
map[any]any{
"set": map[any]any{"dev-config": ""},
"unset": map[any]any{"dev-config": ""},
},
)
assert.Equal(t, expectedConfigSetting, devConfigSetting, "unexpected setting for 'dev.config'")
Expand Down Expand Up @@ -140,15 +140,15 @@ func TestAuthForcesLowercase(t *testing.T) {
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
tm.oauth.EXPECT().TokenInfo(gomock.Any()).Return(&do.OAuthTokenInfo{}, nil)

contexts := map[string]interface{}{doctl.ArgDefaultContext: true, "TestCapitalCase": true}
contexts := map[string]any{doctl.ArgDefaultContext: true, "TestCapitalCase": true}
context := "TestCapitalCase"
viper.Set("auth-contexts", contexts)
viper.Set("context", context)

err := RunAuthInit(retrieveUserTokenFunc)(config)
assert.NoError(t, err)

contexts = map[string]interface{}{doctl.ArgDefaultContext: true, "TestCapitalCase": true}
contexts = map[string]any{doctl.ArgDefaultContext: true, "TestCapitalCase": true}
viper.Set("auth-contexts", contexts)
viper.Set("context", "contextDoesntExist")
err = RunAuthSwitch(config)
Expand All @@ -175,14 +175,14 @@ func Test_displayAuthContexts(t *testing.T) {
Name string
Out *bytes.Buffer
Context string
Contexts map[string]interface{}
Contexts map[string]any
Expected string
}{
{
Name: "default context only",
Out: &bytes.Buffer{},
Context: doctl.ArgDefaultContext,
Contexts: map[string]interface{}{
Contexts: map[string]any{
doctl.ArgDefaultContext: true,
},
Expected: "default (current)\n",
Expand All @@ -191,7 +191,7 @@ func Test_displayAuthContexts(t *testing.T) {
Name: "default context and additional context",
Out: &bytes.Buffer{},
Context: doctl.ArgDefaultContext,
Contexts: map[string]interface{}{
Contexts: map[string]any{
doctl.ArgDefaultContext: true,
"test": true,
},
Expand All @@ -201,7 +201,7 @@ func Test_displayAuthContexts(t *testing.T) {
Name: "default context and additional context set to additional context",
Out: &bytes.Buffer{},
Context: "test",
Contexts: map[string]interface{}{
Contexts: map[string]any{
doctl.ArgDefaultContext: true,
"test": true,
},
Expand All @@ -211,7 +211,7 @@ func Test_displayAuthContexts(t *testing.T) {
Name: "unset context",
Out: &bytes.Buffer{},
Context: "missing",
Contexts: map[string]interface{}{
Contexts: map[string]any{
doctl.ArgDefaultContext: true,
"test": true,
},
Expand Down Expand Up @@ -284,7 +284,7 @@ func TestTokenInputValidator(t *testing.T) {
}
}

type testConfig map[string]interface{}
type testConfig map[string]any

type nopWriteCloser struct {
io.Writer
Expand Down
33 changes: 18 additions & 15 deletions commands/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,51 @@ Once a certificate has been stored, it is assigned a unique certificate ID that
- The name you gave the certificate
- A comma-separated list of domain names associated with the certificate
- The SHA-1 fingerprint of the certificate
- The certificate's expiration date given in ISO8601 date/time format
- The certificate's creation date given in ISO8601 date/time format
- The certificate's expiration date, in ISO8601 date/time format
- The certificate's creation date, in ISO8601 date/time format
- The certificate type (` + "`" + `custom` + "`" + ` or ` + "`" + `lets_encrypt` + "`" + `)
- The certificate state (` + "`" + `pending` + "`" + `, ` + "`" + `verified` + "`" + `, or ` + "`" + `error` + "`" + `)`

CmdBuilder(cmd, RunCertificateGet, "get <id>", "Retrieve details about a certificate", `This command retrieves the following details about a certificate:`+certDetails, Writer,
cmdCertificateGet := CmdBuilder(cmd, RunCertificateGet, "get <id>", "Retrieve details about a certificate", `This command retrieves the following details about a certificate:`+certDetails, Writer,
aliasOpt("g"), displayerType(&displayers.Certificate{}))
cmdCertificateGet.Example = "The following example retrieves the ID, name, and domains associated with a certificate: doctl compute certificate get f81d4fae-7dec-11d0-a765-00a0c91e6bf6 --format ID,Name,DNSNames"

cmdCertificateCreate := CmdBuilder(cmd, RunCertificateCreate, "create",
"Create a new certificate", `This command allows you to create a certificate. There are two supported certificate types: Let's Encrypt certificates, and custom certificates.
"Create a new certificate", `Creates a new Let's Encrypt certificate or adds an existing custom certificate to your team. There are two supported certificate types: Let's Encrypt certificates, and custom certificates.
Let's Encrypt certificates are free and will be auto-renewed and managed for you by DigitalOcean.
Let's Encrypt certificates are free, auto-renewed and managed for you by DigitalOcean.
To create a Let's Encrypt certificate, you'll need to add the domain(s) to your account at cloud.digitalocean.com, or via `+"`"+`doctl compute domain create`+"`"+`, then provide a certificate name and a comma-separated list of the domain names you'd like to associate with the certificate:
To create a Let's Encrypt certificate, you need to add the domain(s) to your account at using the DigitalOcean control panel, or via `+"`"+`doctl compute domain create`+"`"+`, then provide a certificate name and a comma-separated list of the domain names you'd like to associate with the certificate:
doctl compute certificate create --type lets_encrypt --name mycert --dns-names example.org
To upload a custom certificate, you'll need to provide a certificate name, the path to the certificate, the path to the private key for the certificate, and the path to the certificate chain, all in PEM format:
To upload a custom certificate, you need to provide a certificate name, the path to the certificate, the path to the certificate's private key, and the path to the certificate chain, all in PEM format:
doctl compute certificate create --type custom --name mycert --leaf-certificate-path cert.pem --certificate-chain-path fullchain.pem --private-key-path privkey.pem`, Writer, aliasOpt("c"))
AddStringFlag(cmdCertificateCreate, doctl.ArgCertificateName, "", "",
"Certificate name", requiredOpt())
"A user-specified name for the certificate.", requiredOpt())
AddStringSliceFlag(cmdCertificateCreate, doctl.ArgCertificateDNSNames, "",
[]string{}, "Comma-separated list of domains for which the certificate will be issued. The domains must be managed using DigitalOcean's DNS.")
AddStringFlag(cmdCertificateCreate, doctl.ArgPrivateKeyPath, "", "",
"The path to a PEM-formatted private-key corresponding to the SSL certificate.")
"The path on your local machine to a PEM-formatted private-key corresponding to the SSL certificate.")
AddStringFlag(cmdCertificateCreate, doctl.ArgLeafCertificatePath, "", "",
"The path to a PEM-formatted public SSL certificate.")
"The path on your local machine to a PEM-formatted public SSL certificate.")
AddStringFlag(cmdCertificateCreate, doctl.ArgCertificateChainPath, "", "",
"The path to a full PEM-formatted trust chain between the certificate authority's certificate and your domain's SSL certificate.")
"The path on your local machine to a full PEM-formatted trust chain between the certificate authority's certificate and your domain's SSL certificate.")
AddStringFlag(cmdCertificateCreate, doctl.ArgCertificateType, "", "",
"Certificate type [custom|lets_encrypt]")
"The type of certificate, `custom` or `lets_encrypt`.")

CmdBuilder(cmd, RunCertificateList, "list", "Retrieve list of the account's stored certificates", `This command retrieves a list of all certificates associated with the account. The following details are shown for each certificate:`+certDetails, Writer,
cmdCertificateList := CmdBuilder(cmd, RunCertificateList, "list", "Retrieve list of the account's stored certificates", `This command retrieves a list of all certificates associated with the account. The following details are shown for each certificate:`+certDetails, Writer,
aliasOpt("ls"), displayerType(&displayers.Certificate{}))
cmdCertificateList.Example = `The following example retrieves a list of all certificates associated with your account and uses the ` + "`" + `--format` + "`" + ` flag return only the IDs, names, and the domains associated with each ticket: doctl compute certificate list --format ID,Name,DNSNames`

cmdCertificateDelete := CmdBuilder(cmd, RunCertificateDelete, "delete <id>",
"Delete the specified certificate", `This command deletes the specified certificate.
"Delete the specified certificate", `Deletes the specified certificate.
Use `+"`"+`doctl compute certificate list`+"`"+` to see all available certificates associated with your account.`, Writer, aliasOpt("d", "rm"))
AddBoolFlag(cmdCertificateDelete, doctl.ArgForce, doctl.ArgShortForce, false,
"Delete the certificate without a confirmation prompt")

cmdCertificateDelete.Example = `The following example deletes the certificate with the ID ` + "`" + `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` + "`" + `: doctl compute certificate delete f81d4fae-7dec-11d0-a765-00a0c91e6bf6`
return cmd
}

Expand Down
Loading

0 comments on commit 99e0d70

Please sign in to comment.