// InstanceID returns the cloud provider ID of the node with the specified nodeName.
771750
func (c *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error) {
	// In the future it is possible to also return an endpoint as:
	// <endpoint>/<zone>/<instanceid>
	if c.selfAWSInstance.nodeName == nodeName {
		return "/" + c.selfAWSInstance.availabilityZone + "/" + c.selfAWSInstance.awsID, nil
	}
	inst, err := c.getInstanceByNodeName(nodeName)
	if err != nil {
		if err == cloudprovider.InstanceNotFound {
			// The Instances interface requires that we return InstanceNotFound (without wrapping)
			return "", err
		}
		return "", fmt.Errorf("getInstanceByNodeName failed for %q with %q", nodeName, err)
	}
	return "/" + aws.StringValue(inst.Placement.AvailabilityZone) + "/" + aws.StringValue(inst.InstanceId), nil
}
106047
func (s *StartOutboundVoiceContactInput) SetInstanceId(v string) *StartOutboundVoiceContactInput {
	s.InstanceId = &v
	return s
}
555482
func (s *ElasticIp) SetInstanceId(v string) *ElasticIp {
	s.InstanceId = &v
	return s
}
332592
func (s *RecordLifecycleActionHeartbeatInput) SetInstanceId(v string) *RecordLifecycleActionHeartbeatInput {
	s.InstanceId = &v
	return s
}
1332374
func (s *SetInstanceHealthInput) SetInstanceId(v string) *SetInstanceHealthInput {
	s.InstanceId = &v
	return s
}
752405
func (s *AssociateElasticIpInput) SetInstanceId(v string) *AssociateElasticIpInput {
	s.InstanceId = &v
	return s
}
1157072
func (s *ListUsersInput) SetInstanceId(v string) *ListUsersInput {
	s.InstanceId = &v
	return s
}
165788
func (m *Machine) InstanceId() (instance.Id, error) {
	m.mu.Lock()
	defer m.mu.Unlock()

	if m.details.InstanceId == "" {
		return "", errors.NotProvisionedf("machine %v", m.details.Id)
	}
	return instance.Id(m.details.InstanceId), nil
}
669081
func (s *GetInstanceInput) SetInstanceId(v string) *GetInstanceInput {
	s.InstanceId = &v
	return s
}
477727
func InstanceID(
	ctx types.Context,
	driverName string) (*types.InstanceID, error) {

	req, err := http.NewRequest(http.MethodGet, iidURL, nil)
	if err != nil {
		return nil, err
	}

	res, err := doRequest(ctx, req)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()

	iid := instanceIdentityDoc{}
	dec := json.NewDecoder(res.Body)
	if err := dec.Decode(&iid); err != nil {
		return nil, err
	}

	return &types.InstanceID{
		ID:     iid.InstanceID,
		Driver: driverName,
		Fields: map[string]string{
			ebs.InstanceIDFieldRegion:           iid.Region,
			ebs.InstanceIDFieldAvailabilityZone: iid.AvailabilityZone,
		},
	}, nil
}
686399
func (s *DescribeAssociationInput) SetInstanceId(v string) *DescribeAssociationInput {
	s.InstanceId = &v
	return s
}
1211726
func instanceIDFromProviderID(providerID string) (instanceID string, err error) {
	// If Instances.InstanceID or cloudprovider.GetInstanceProviderID is changed, the regexp should be changed too.
	var providerIDRegexp = regexp.MustCompile(`^` + ProviderName + `:///([^/]+)$`)

	matches := providerIDRegexp.FindStringSubmatch(providerID)
	if len(matches) != 2 {
		return "", fmt.Errorf("ProviderID \"%s\" didn't match expected format \"openstack:///InstanceID\"", providerID)
	}
	return matches[1], nil
}
672752
func (s *SingleInstanceHealth) SetInstanceId(v string) *SingleInstanceHealth {
	s.InstanceId = &v
	return s
}
1137505
func (s *UpdateManagedInstanceRoleInput) SetInstanceId(v string) *UpdateManagedInstanceRoleInput {
	s.InstanceId = &v
	return s
}
304415
func (s *ListCommandsInput) SetInstanceId(v string) *ListCommandsInput {
	s.InstanceId = &v
	return s
}
333801
func (s *GetCommandInvocationInput) SetInstanceId(v string) *GetCommandInvocationInput {
	s.InstanceId = &v
	return s
}
1152044
func (s *GrantAccessInput) SetInstanceId(v string) *GrantAccessInput {
	s.InstanceId = &v
	return s
}