// InstanceID returns the local system's InstanceID.
437375
func (d *driver) InstanceID(
	ctx types.Context,
	opts types.Store) (*types.InstanceID, error) {

	return d.getInstanceID()
}
793992
func (g *Cloud) InstanceID(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) {
			projectID, zone, err := getProjectAndZone()
			if err == nil {
				return projectID + "/" + zone + "/" + canonicalizeInstanceName(instanceName), nil
			}
		}
	}
	instance, err := g.getInstanceByName(instanceName)
	if err != nil {
		return "", err
	}
	return g.projectID + "/" + instance.Zone + "/" + instance.Name, nil
}
1364550
func InstanceID(
	ctx types.Context, config gofig.Config) (*types.InstanceID, error) {

	var hostName string
	if config == nil {
		hostName = config.GetString(s3fs.ConfigS3FSHostName)
	} else {
		hostName, _ = os.Hostname()
	}
	return &types.InstanceID{ID: hostName, Driver: s3fs.Name}, nil
}
594326
func (d *driver) InstanceID(
	ctx types.Context,
	opts types.Store) (*types.InstanceID, error) {

	// find all local IP addresses on the data subnet
	ipList, err := net.InterfaceAddrs()
	if err != nil {
		return nil, goof.WithError("no network interface addresses", err)
	}

	var ipListS []string
	for _, ipa := range ipList {
		ipListS = append(ipListS, ipa.String())
	}

	iid := &types.InstanceID{Driver: isilon.Name}
	if err := iid.MarshalMetadata(ipListS); err != nil {
		return nil, err
	}

	return iid, nil
}
332592
func (s *RecordLifecycleActionHeartbeatInput) SetInstanceId(v string) *RecordLifecycleActionHeartbeatInput {
	s.InstanceId = &v
	return s
}
224269
func (s *AssignVolumeInput) SetInstanceId(v string) *AssignVolumeInput {
	s.InstanceId = &v
	return s
}
1152044
func (s *GrantAccessInput) SetInstanceId(v string) *GrantAccessInput {
	s.InstanceId = &v
	return s
}
1214168
func (s *TerminateInstanceInAutoScalingGroupInput) SetInstanceId(v string) *TerminateInstanceInAutoScalingGroupInput {
	s.InstanceId = &v
	return s
}
1278593
func (s *SetTimeBasedAutoScalingInput) SetInstanceId(v string) *SetTimeBasedAutoScalingInput {
	s.InstanceId = &v
	return s
}
672752
func (s *SingleInstanceHealth) SetInstanceId(v string) *SingleInstanceHealth {
	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
}
1059253
func (s *GetInstanceAccessInput) SetInstanceId(v string) *GetInstanceAccessInput {
	s.InstanceId = &v
	return s
}
542676
func GetInstanceID(
	ctx types.Context, config gofig.Config) (*types.InstanceID, error) {

	d := &driver{}
	d.Init(ctx, config)
	return d.getInstanceID()
}
1135493
func (vs *VSphere) InstanceID(ctx context.Context, nodeName k8stypes.NodeName) (string, error) {

	instanceIDInternal := func() (string, error) {
		if vs.hostName == convertToString(nodeName) {
			return vs.vmUUID, nil
		}

		// Below logic can be performed only on master node where VC details are preset.
		if vs.cfg == nil {
			return "", fmt.Errorf("The current node can't detremine InstanceID for %q", convertToString(nodeName))
		}

		// Create context
		ctx, cancel := context.WithCancel(context.Background())
		defer cancel()
		vsi, err := vs.getVSphereInstance(nodeName)
		if err != nil {
			return "", err
		}
		// Ensure client is logged in and session is valid
		err = vs.nodeManager.vcConnect(ctx, vsi)
		if err != nil {
			return "", err
		}
		vm, err := vs.getVMFromNodeName(ctx, nodeName)
		if err != nil {
			klog.Errorf("Failed to get VM object for node: %q. err: +%v", convertToString(nodeName), err)
			return "", err
		}
		isActive, err := vm.IsActive(ctx)
		if err != nil {
			klog.Errorf("Failed to check whether node %q is active. err: %+v.", convertToString(nodeName), err)
			return "", err
		}
		if isActive {
			return vs.vmUUID, nil
		}
		klog.Warningf("The VM: %s is not in %s state", convertToString(nodeName), vclib.ActivePowerState)
		return "", cloudprovider.InstanceNotFound
	}

	instanceID, err := instanceIDInternal()
	if err != nil {
		if vclib.IsManagedObjectNotFoundError(err) {
			err = vs.nodeManager.RediscoverNode(nodeName)
			if err == nil {
				klog.V(4).Infof("InstanceID: Found node %q", convertToString(nodeName))
				instanceID, err = instanceIDInternal()
			} else if err == vclib.ErrNoVMFound {
				return "", cloudprovider.InstanceNotFound
			}
		}
	}

	return instanceID, err
}
1300512
func (s *GetDeployablePatchSnapshotForInstanceInput) SetInstanceId(v string) *GetDeployablePatchSnapshotForInstanceInput {
	s.InstanceId = &v
	return s
}
807796
func (pc *PCCloud) InstanceID(ctx context.Context, nodeName k8stypes.NodeName) (string, error) {
	name := string(nodeName)
	if name == pc.localK8sHostname {
		return pc.localInstanceID, nil
	}
	// We assume only master need to get InstanceID of a node other than itself
	id, err := getInstanceID(pc, name)
	if err != nil {
		klog.Errorf("Photon Cloud Provider: getInstanceID failed for InstanceID. Error[%v]", err)
	}
	return id, err

}
1010238
func (s *DescribeVolumesInput) SetInstanceId(v string) *DescribeVolumesInput {
	s.InstanceId = &v
	return s
}