// GetInstanceID returns the instance ID object
542676
func GetInstanceID(
	ctx types.Context, config gofig.Config) (*types.InstanceID, error) {

	d := &driver{}
	d.Init(ctx, config)
	return d.getInstanceID()
}
451472
func (s *RegisterInstanceInput) SetInstanceId(v string) *RegisterInstanceInput {
	s.InstanceId = &v
	return s
}
407276
func (s *Instance) SetInstanceId(v string) *Instance {
	s.InstanceId = &v
	return s
}
967330
func (s *CreateAssociationInput) SetInstanceId(v string) *CreateAssociationInput {
	s.InstanceId = &v
	return s
}
754392
func (s *DeregisterManagedInstanceInput) SetInstanceId(v string) *DeregisterManagedInstanceInput {
	s.InstanceId = &v
	return s
}
585289
func (client *storageRESTClient) getInstanceID() (err error) {
	// getInstanceID() does not use storageRESTClient.call()
	// function so we need to update lastError field here.
	defer func() {
		if err != nil {
			client.lastError = err
		}
	}()

	respBody, err := client.restClient.Call(storageRESTMethodGetInstanceID, nil, nil, -1)
	if err != nil {
		return err
	}
	defer http.DrainBody(respBody)
	instanceIDBuf := make([]byte, 64)
	n, err := io.ReadFull(respBody, instanceIDBuf)
	if err != io.EOF && err != io.ErrUnexpectedEOF {
		return err
	}
	client.instanceID = string(instanceIDBuf[:n])
	return nil
}
453770
func (s *Volume) SetInstanceId(v string) *Volume {
	s.InstanceId = &v
	return s
}
144737
func (s *InstanceDetails) SetInstanceId(v string) *InstanceDetails {
	s.InstanceId = &v
	return s
}
131432
func (s *DescribeCommandsInput) SetInstanceId(v string) *DescribeCommandsInput {
	s.InstanceId = &v
	return s
}
1332374
func (s *SetInstanceHealthInput) SetInstanceId(v string) *SetInstanceHealthInput {
	s.InstanceId = &v
	return s
}
776245
func MustInstanceID(ctx context.Context) *types.InstanceID {
	return ctx.Value(InstanceIDKey).(*types.InstanceID)
}
889532
func (s *UpdateAssociationStatusInput) SetInstanceId(v string) *UpdateAssociationStatusInput {
	s.InstanceId = &v
	return s
}
975984
func (c *Cloud) getInstanceByID(instanceID string) (*ec2.Instance, error) {
	instances, err := c.getInstancesByIDs([]*string{&instanceID})
	if err != nil {
		return nil, err
	}

	if len(instances) == 0 {
		return nil, cloudprovider.ErrInstanceNotFound
	}
	if len(instances) > 1 {
		return nil, fmt.Errorf("multiple instances found for instance: %s", instanceID)
	}

	return instances[instanceID], nil
}
240097
func (s *CreateUserInput) SetInstanceId(v string) *CreateUserInput {
	s.InstanceId = &v
	return s
}
30614
func GetInstancePortID(client *gophercloud.ServiceClient, id string) (string, error) {
	interfacesPage, err := attachinterfaces.List(client, id).AllPages()
	if err != nil {
		return "", err
	}
	interfaces, err := attachinterfaces.ExtractInterfaces(interfacesPage)
	if err != nil {
		return "", err
	}
	if len(interfaces) == 0 {
		return "", fmt.Errorf("instance '%s' has no interfaces", id)
	}

	return interfaces[0].PortID, nil
}
891533
func (s *DescribeInstancesInput) SetInstanceId(v string) *DescribeInstancesInput {
	s.InstanceId = &v
	return s
}
1214168
func (s *TerminateInstanceInAutoScalingGroupInput) SetInstanceId(v string) *TerminateInstanceInAutoScalingGroupInput {
	s.InstanceId = &v
	return s
}