github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/provider/gce/export_test.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package gce
     5  
     6  import (
     7  	"github.com/juju/juju/core/instance"
     8  	"github.com/juju/juju/environs"
     9  	"github.com/juju/juju/environs/context"
    10  	"github.com/juju/juju/environs/imagemetadata"
    11  	"github.com/juju/juju/environs/instances"
    12  	"github.com/juju/juju/provider/gce/google"
    13  )
    14  
    15  var (
    16  	Provider                 environs.EnvironProvider = providerInstance
    17  	NewInstance                                       = newInstance
    18  	CheckInstanceType                                 = checkInstanceType
    19  	GetMetadata                                       = getMetadata
    20  	GetDisks                                          = getDisks
    21  	UbuntuImageBasePath                               = ubuntuImageBasePath
    22  	UbuntuDailyImageBasePath                          = ubuntuDailyImageBasePath
    23  	WindowsImageBasePath                              = windowsImageBasePath
    24  )
    25  
    26  func ExposeInstBase(inst instances.Instance) *google.Instance {
    27  	return inst.(*environInstance).base
    28  }
    29  
    30  func ExposeInstEnv(inst *environInstance) *environ {
    31  	return inst.env
    32  }
    33  
    34  func ExposeEnvConfig(env *environ) *environConfig {
    35  	return env.ecfg
    36  }
    37  
    38  func ExposeEnvConnection(env *environ) gceConnection {
    39  	return env.gce
    40  }
    41  
    42  func GlobalFirewallName(env *environ) string {
    43  	return env.globalFirewallName()
    44  }
    45  
    46  func ParsePlacement(env *environ, ctx context.ProviderCallContext, placement string) (*instPlacement, error) {
    47  	return env.parsePlacement(ctx, placement)
    48  }
    49  
    50  func FinishInstanceConfig(env *environ, args environs.StartInstanceParams, spec *instances.InstanceSpec) error {
    51  	return env.finishInstanceConfig(args, spec)
    52  }
    53  
    54  func FindInstanceSpec(
    55  	env *environ,
    56  	ic *instances.InstanceConstraint,
    57  	imageMetadata []*imagemetadata.ImageMetadata,
    58  ) (*instances.InstanceSpec, error) {
    59  	return env.findInstanceSpec(ic, imageMetadata)
    60  }
    61  
    62  func BuildInstanceSpec(env *environ, args environs.StartInstanceParams) (*instances.InstanceSpec, error) {
    63  	return env.buildInstanceSpec(args)
    64  }
    65  
    66  func NewRawInstance(env *environ, ctx context.ProviderCallContext, args environs.StartInstanceParams, spec *instances.InstanceSpec) (*google.Instance, error) {
    67  	return env.newRawInstance(ctx, args, spec)
    68  }
    69  
    70  func GetHardwareCharacteristics(env *environ, spec *instances.InstanceSpec, inst *environInstance) *instance.HardwareCharacteristics {
    71  	return env.getHardwareCharacteristics(spec, inst)
    72  }
    73  
    74  func GetInstances(env *environ, ctx context.ProviderCallContext) ([]instances.Instance, error) {
    75  	return env.instances(ctx)
    76  }