github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cmd/roachprod/vm/azure/flags.go (about)

     1  // Copyright 2019 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package azure
    12  
    13  import (
    14  	"fmt"
    15  	"strings"
    16  	"time"
    17  
    18  	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
    19  	"github.com/cockroachdb/cockroach/pkg/cmd/roachprod/vm"
    20  	"github.com/spf13/pflag"
    21  )
    22  
    23  type providerOpts struct {
    24  	locations        []string
    25  	machineType      string
    26  	operationTimeout time.Duration
    27  	syncDelete       bool
    28  	vnetName         string
    29  }
    30  
    31  var defaultLocations = []string{
    32  	"eastus2",
    33  	"westus",
    34  	"westeurope",
    35  }
    36  
    37  // ConfigureCreateFlags implements vm.ProviderFlags.
    38  func (o *providerOpts) ConfigureCreateFlags(flags *pflag.FlagSet) {
    39  	flags.DurationVar(&o.operationTimeout, ProviderName+"-timeout", 10*time.Minute,
    40  		"The maximum amount of time for an Azure API operation to take")
    41  	flags.BoolVar(&o.syncDelete, ProviderName+"-sync-delete", false,
    42  		"Wait for deletions to finish before returning")
    43  	flags.StringVar(&o.machineType, ProviderName+"-machine-type",
    44  		string(compute.VirtualMachineSizeTypesStandardD4V3),
    45  		"Machine type (see https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/)")
    46  	flags.StringSliceVar(&o.locations, ProviderName+"-locations", nil,
    47  		fmt.Sprintf("Locations for cluster (see `az account list-locations`) (default\n[%s])",
    48  			strings.Join(defaultLocations, ",")))
    49  	flags.StringVar(&o.vnetName, ProviderName+"-vnet-name", "common",
    50  		"The name of the VNet to use")
    51  }
    52  
    53  // ConfigureClusterFlags implements vm.ProviderFlags and is a no-op.
    54  func (o *providerOpts) ConfigureClusterFlags(*pflag.FlagSet, vm.MultipleProjectsOption) {
    55  }