// InstanceType returns the type of the specified node with the specified NodeName.
504331
func (g *Cloud) InstanceType(ctx context.Context, nodeName types.NodeName) (string, error) {
	instanceName := mapNodeNameToInstanceName(nodeName)
	if g.useMetadataServer {
		// Use metadata, if possible, to fetch ID. See issue #12000
		if g.isCurrentInstance(instanceName) {
			mType, err := getCurrentMachineTypeViaMetadata()
			if err == nil {
				return mType, nil
			}
		}
	}
	instance, err := g.getInstanceByName(instanceName)
	if err != nil {
		return "", err
	}
	return instance.Type, nil
}
12843
func (s *ResourceConfig) SetInstanceType(v string) *ResourceConfig {
	s.InstanceType = &v
	return s
}
629454
func (s *Node) SetInstanceType(v string) *Node {
	s.InstanceType = &v
	return s
}
960381
func (s *BrokerSummary) SetHostInstanceType(v string) *BrokerSummary {
	s.HostInstanceType = &v
	return s
}
219071
func (s *Instance) SetInstanceType(v string) *Instance {
	s.InstanceType = &v
	return s
}
1239301
func (i *Instances) InstanceID(ctx context.Context, name types.NodeName) (string, error) {
	srv, err := getServerByName(i.compute, name)
	if err != nil {
		if err == ErrNotFound {
			return "", cloudprovider.InstanceNotFound
		}
		return "", err
	}
	// In the future it is possible to also return an endpoint as:
	// <endpoint>/<instanceid>
	return "/" + srv.ID, nil
}
1181792
func (f *FakeCloud) InstanceType(ctx context.Context, instance types.NodeName) (string, error) {
	f.addCall("instance-type")
	return f.InstanceTypes[instance], nil
}
1165810
func (s *InstanceDetails) SetInstanceType(v string) *InstanceDetails {
	s.InstanceType = &v
	return s
}
893215
func (c *Cloud) getInstanceByNodeName(nodeName types.NodeName) (*ec2.Instance, error) {
	instance, err := c.findInstanceByNodeName(nodeName)
	if err == nil && instance == nil {
		return nil, cloudprovider.ErrInstanceNotFound
	}
	return instance, err
}
585064
func (s *ContainerProperties) SetInstanceType(v string) *ContainerProperties {
	s.InstanceType = &v
	return s
}
381758
func (s *RestoreServerInput) SetInstanceType(v string) *RestoreServerInput {
	s.InstanceType = &v
	return s
}
1008684
func (gce *Cloud) InstanceType(nodeName types.NodeName) (string, error) {
	instanceName := mapNodeNameToInstanceName(nodeName)
	if gce.useMetadataServer {
		// Use metadata, if possible, to fetch ID. See issue #12000
		if gce.isCurrentInstance(instanceName) {
			mType, err := getCurrentMachineTypeViaMetadata()
			if err == nil {
				return mType, nil
			}
		}
	}
	instance, err := gce.getInstanceByName(instanceName)
	if err != nil {
		return "", err
	}
	return instance.Type, nil
}
312241
func RegionInstanceTypes(region string) []instances.InstanceType {
	// NOTE(axw) at the time of writing, there is no cost
	// information for China (Beijing). For any regions
	// that we don't know about, we substitute us-east-1
	// and hope that they're equivalent.
	instanceTypes, ok := allInstanceTypes[region]
	if !ok {
		instanceTypes = allInstanceTypes["us-east-1"]
	}
	return instanceTypes
}
48573
func (s *TransformResources) SetInstanceType(v string) *TransformResources {
	s.InstanceType = &v
	return s
}
940488
func (c *Cloud) findInstanceByNodeName(nodeName types.NodeName) (*ec2.Instance, error) {
	privateDNSName := mapNodeNameToPrivateDNSName(nodeName)
	filters := []*ec2.Filter{
		newEc2Filter("private-dns-name", privateDNSName),
		// exclude instances in "terminated" state
		newEc2Filter("instance-state-name", aliveFilter...),
	}

	instances, err := c.describeInstances(filters)
	if err != nil {
		return nil, err
	}

	if len(instances) == 0 {
		return nil, nil
	}
	if len(instances) > 1 {
		return nil, fmt.Errorf("multiple instances found for name: %s", nodeName)
	}
	return instances[0], nil
}
512618
func (s *ServerLaunchConfiguration) SetInstanceType(v string) *ServerLaunchConfiguration {
	s.InstanceType = &v
	return s
}
489928
func (s *Fleet) SetInstanceType(v string) *Fleet {
	s.InstanceType = &v
	return s
}