// Inspect method inspects schedule policy
961522
func (s *SchedulePolicyServer) Inspect(
	ctx context.Context,
	req *api.SdkSchedulePolicyInspectRequest,
) (*api.SdkSchedulePolicyInspectResponse, error) {
	if s.cluster() == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	if len(req.GetName()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must supply Schedule name")
	}

	policy, err := s.cluster().SchedPolicyGet(req.GetName())
	if err != nil {
		if err == kvdb.ErrNotFound {
			return nil, status.Errorf(
				codes.NotFound,
				"Schedule policy %s not found",
				req.GetName())
		}
		return nil, status.Errorf(
			codes.Internal,
			"Failed to inspect schedule policy: %v",
			err.Error())
	}

	schedules, err := retainInternalSpecYamlByteToSdkSched([]byte(policy.Schedule))
	if err != nil {
		return nil, err
	}

	sdkpolicy := &api.SdkSchedulePolicy{
		Name:      policy.Name,
		Schedules: schedules,
	}

	return &api.SdkSchedulePolicyInspectResponse{Policy: sdkpolicy}, err
}
1005367
func (d *driverPluginClient) InspectTask(taskID string) (*TaskStatus, error) {
	req := &proto.InspectTaskRequest{TaskId: taskID}

	resp, err := d.client.InspectTask(d.doneCtx, req)
	if err != nil {
		return nil, grpcutils.HandleGrpcErr(err, d.doneCtx)
	}

	status, err := taskStatusFromProto(resp.Task)
	if err != nil {
		return nil, err
	}

	if resp.Driver != nil {
		status.DriverAttributes = resp.Driver.Attributes
	}
	if resp.NetworkOverride != nil {
		status.NetworkOverride = &DriverNetwork{
			PortMap:       map[string]int{},
			IP:            resp.NetworkOverride.Addr,
			AutoAdvertise: resp.NetworkOverride.AutoAdvertise,
		}
		for k, v := range resp.NetworkOverride.PortMap {
			status.NetworkOverride.PortMap[k] = int(v)
		}
	}

	return status, nil
}
726337
func httpInspectPolicy(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	var obj PolicyInspect
	log.Debugf("Received httpInspectPolicy: %+v", vars)

	key := vars["key"]

	collections.policyMutex.Lock()
	defer collections.policyMutex.Unlock()
	objConfig := collections.policys[key]
	if objConfig == nil {
		log.Errorf("policy %s not found", key)
		return nil, errors.New("policy not found")
	}
	obj.Config = *objConfig

	if err := GetOperPolicy(&obj); err != nil {
		log.Errorf("GetPolicy error for: %+v. Err: %v", obj, err)
		return nil, err
	}

	// Return the obj
	return &obj, nil
}
1069464
func (n *Network) Inspect(ctx context.Context) (types.NetworkResource, error) {
	return n.client.NetworkInspect(ctx, n.fullName(), types.NetworkInspectOptions{
		Verbose: true,
	})
}
321373
func (c *Cluster) InspectContainer(id string) (*docker.Container, error) {
	node, err := c.getNodeForContainer(id)
	if err != nil {
		return nil, err
	}
	cont, err := node.InspectContainer(id)
	return cont, wrapError(node, err)
}
545477
func (c *Client) InspectPlugins(name string, ctx context.Context) (*PluginDetail, error) {
	resp, err := c.do("GET", "/plugins/"+name+"/json", doOptions{
		context: ctx,
	})
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if err != nil {
		if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
			return nil, &NoSuchPlugin{ID: name}
		}
		return nil, err
	}
	resp.Body.Close()
	var pluginDetail PluginDetail
	if err := json.NewDecoder(resp.Body).Decode(&pluginDetail); err != nil {
		return nil, err
	}
	return &pluginDetail, nil
}
933439
func (m *MockInterface) Policy() v1beta18.PolicyV1beta1Interface {
	ret := m.ctrl.Call(m, "Policy")
	ret0, _ := ret[0].(v1beta18.PolicyV1beta1Interface)
	return ret0
}
290463
func (v *Volume) InspectTemplate(ctx context.Context) (*client.VolumeTemplate, error) {
	volumes, err := v.context.Client.VolumeTemplate.List(&client.ListOpts{
		Filters: map[string]interface{}{
			"name":    v.name,
			"stackId": v.context.Stack.Id,
		},
	})
	if err != nil {
		return nil, err
	}

	if len(volumes.Data) > 0 {
		return &volumes.Data[0], nil
	}

	return nil, nil
}
1179250
func (d *OvsDriver) InspectNameserver() ([]byte, error) {
	if d.nameServer == nil {
		return []byte{}, nil
	}

	ns, err := d.nameServer.InspectState()
	jsonState, err := json.Marshal(ns)
	if err != nil {
		log.Errorf("Error encoding nameserver state. Err: %v", err)
		return []byte{}, err
	}

	return jsonState, nil
}
1004025
func (c *Client) InspectContainer(id string) (*Container, error) {
	return c.inspectContainer(id, doOptions{})
}
200914
func (p *Project) Inspect(c *check.C, containerID string) types.ContainerJSON {
	container, err := p.project.Inspect(containerID)
	c.Assert(err, check.IsNil,
		check.Commentf("error while inspecting with container %s", containerID))
	return container
}
1109567
func Inspect(node Node, f func(Node) bool) {
	Walk(inspector(f), node)
}
445109
func (e *defaultStoreEnumerator) Inspect(ids []string) ([]*api.Volume, error) {
	volumes := make([]*api.Volume, 0, len(ids))
	for _, id := range ids {
		volume, err := e.GetVol(id)
		// XXX Distinguish between ENOENT and an internal error from KVDB
		if err != nil {
			continue
		}
		volumes = append(volumes, volume)
	}
	return volumes, nil
}
548339
func (op *Operator) SchedulerGetConfiguration(q *QueryOptions) (*SchedulerConfigurationResponse, *QueryMeta, error) {
	var resp SchedulerConfigurationResponse
	qm, err := op.c.query("/v1/operator/scheduler/configuration", &resp, q)
	if err != nil {
		return nil, nil, err
	}
	return &resp, qm, nil
}
154933
func (w *Worker) ScheduleCancel(scheduleId string) (err error) {
	_, err = w.schedules(scheduleId, "cancel").Request("POST", nil)
	return
}
344765
func (c *ClusterManager) Inspect(nodeID string) (api.Node, error) {
	c.nodeCacheLock.Lock()
	defer c.nodeCacheLock.Unlock()
	return c.getNodeEntry(nodeID, &cluster.ClusterInfo{})
}
277419
func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte) error {
	if rawElement != nil {
		i.rawElements = append(i.rawElements, rawElement)
	} else {
		i.elements = append(i.elements, typedElement)
	}
	return nil
}