// Describe is used to convert details on current resource lock
// into a string
184084
func (ll *LeaseLock) Describe() string {
	return fmt.Sprintf("%v/%v", ll.LeaseMeta.Namespace, ll.LeaseMeta.Name)
}
1362782
func (c *processCollector) Describe(ch chan<- *Desc) {
	ch <- c.cpuTotal
	ch <- c.openFDs
	ch <- c.maxFDs
	ch <- c.vsize
	ch <- c.maxVsize
	ch <- c.rss
	ch <- c.startTime
}
54399
func (collector *volumeStatsCollector) Describe(ch chan<- *prometheus.Desc) {
	ch <- volumeStatsCapacityBytesDesc
	ch <- volumeStatsAvailableBytesDesc
	ch <- volumeStatsUsedBytesDesc
	ch <- volumeStatsInodesDesc
	ch <- volumeStatsInodesFreeDesc
	ch <- volumeStatsInodesUsedDesc
}
727955
func (collector *procTableCollector) Describe(ch chan<- *prometheus.Desc) {
	ch <- procTableRunning
	ch <- procTableSucceeded
	ch <- procTableFailed
}
1166882
func (h *Exception) Description(description string) *Exception {
	h.description = description
	h.descriptionSet = true
	return h
}
718268
func (client *Client) DescribeResource(stackId, stackName, resourceName string) (*Resource, error) {
	response := &Resource{}
	err := client.Invoke("", http.MethodGet, fmt.Sprintf("/stacks/%s/%s/resources/%s", stackName, stackId, resourceName), nil, nil, &response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1027454
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
	for _, m := range frontendMetrics {
		ch <- m
	}
	for _, m := range backendMetrics {
		ch <- m
	}
	for _, m := range e.serverMetrics {
		ch <- m
	}
	ch <- haproxyUp
	ch <- e.totalScrapes.Desc()
	ch <- e.csvParseFailures.Desc()
}
1103198
func (d *BuildDescriber) Describe(namespace, name string, settings describe.DescriberSettings) (string, error) {
	c := d.buildClient.Builds(namespace)
	buildObj, err := c.Get(name, metav1.GetOptions{})
	if err != nil {
		return "", err
	}
	events, _ := d.kubeClient.CoreV1().Events(namespace).Search(legacyscheme.Scheme, buildObj)
	if events == nil {
		events = &corev1.EventList{}
	}
	// get also pod events and merge it all into one list for describe
	if pod, err := d.kubeClient.CoreV1().Pods(namespace).Get(buildutil.GetBuildPodName(buildObj), metav1.GetOptions{}); err == nil {
		if podEvents, _ := d.kubeClient.CoreV1().Events(namespace).Search(legacyscheme.Scheme, pod); podEvents != nil {
			events.Items = append(events.Items, podEvents.Items...)
		}
	}
	return tabbedString(func(out *tabwriter.Writer) error {
		formatMeta(out, buildObj.ObjectMeta)

		fmt.Fprintln(out, "")

		status := bold(buildObj.Status.Phase)
		if buildObj.Status.Message != "" {
			status += " (" + buildObj.Status.Message + ")"
		}
		formatString(out, "Status", status)

		if buildObj.Status.StartTimestamp != nil && !buildObj.Status.StartTimestamp.IsZero() {
			formatString(out, "Started", buildObj.Status.StartTimestamp.Time.Format(time.RFC1123))
		}

		// Create the time object with second-level precision so we don't get
		// output like "duration: 1.2724395728934s"
		formatString(out, "Duration", describeBuildDuration(buildObj))

		for _, stage := range buildObj.Status.Stages {
			duration := stage.StartTime.Time.Add(time.Duration(stage.DurationMilliseconds * int64(time.Millisecond))).Round(time.Second).Sub(stage.StartTime.Time.Round(time.Second))
			formatString(out, fmt.Sprintf("  %v", stage.Name), fmt.Sprintf("  %v", duration))
		}

		fmt.Fprintln(out, "")

		if buildObj.Status.Config != nil {
			formatString(out, "Build Config", buildObj.Status.Config.Name)
		}
		formatString(out, "Build Pod", buildutil.GetBuildPodName(buildObj))

		if buildObj.Status.Output.To != nil && len(buildObj.Status.Output.To.ImageDigest) > 0 {
			formatString(out, "Image Digest", buildObj.Status.Output.To.ImageDigest)
		}

		describeCommonSpec(buildObj.Spec.CommonSpec, out)
		describeBuildTriggerCauses(buildObj.Spec.TriggeredBy, out)
		if len(buildObj.Status.LogSnippet) != 0 {
			formatString(out, "Log Tail", buildObj.Status.LogSnippet)
		}
		if settings.ShowEvents {
			versioned.DescribeEvents(events, versioned.NewPrefixWriter(out))
		}

		return nil
	})
}
125783
func (s *Store) Describe(ch chan<- *prometheus.Desc) {
	s.metrics.Describe(ch)
}
305601
func (s *scope) describe() (src, dest string) {
	return s.srcStack.describe(), s.destStack.describe()
}
1246232
func (m *ServerMetrics) Describe(ch chan<- *prom.Desc) {
	m.serverStartedCounter.Describe(ch)
	m.serverHandledCounter.Describe(ch)
	m.serverStreamMsgReceived.Describe(ch)
	m.serverStreamMsgSent.Describe(ch)
	if m.serverHandledHistogramEnabled {
		m.serverHandledHistogram.Describe(ch)
	}
}
960508
func (sh *Handler) DescribeLocked(ctx context.Context, dr *DescribeRequest) (dres *DescribeResponse, err error) {
	if verboseDescribe {
		t0 := time.Now()
		defer func() {
			td := time.Since(t0)
			var num int
			if dres != nil {
				num = len(dres.Meta)
			}
			log.Printf("Described %d blobs in %v", num, td)
		}()
	}
	sh.initDescribeRequest(dr)
	if dr.BlobRef.Valid() {
		dr.StartDescribe(ctx, dr.BlobRef, dr.depth())
	}
	for _, br := range dr.BlobRefs {
		dr.StartDescribe(ctx, br, dr.depth())
	}
	if err := dr.expandRules(ctx); err != nil {
		return nil, err
	}
	metaMap, err := dr.metaMap()
	if err != nil {
		return nil, err
	}
	return &DescribeResponse{metaMap}, nil
}
685158
func (c *Collector) Describe(ch chan<- *prometheus.Desc) {
	c.models.Describe(ch)
	c.machines.Describe(ch)
	c.applications.Describe(ch)
	c.units.Describe(ch)
	c.users.Describe(ch)

	c.scrapeErrors.Describe(ch)
	c.scrapeDuration.Describe(ch)
}
807561
func (m *ClientMetrics) Describe(ch chan<- *prom.Desc) {
	m.clientStartedCounter.Describe(ch)
	m.clientHandledCounter.Describe(ch)
	m.clientStreamMsgReceived.Describe(ch)
	m.clientStreamMsgSent.Describe(ch)
	if m.clientHandledHistogramEnabled {
		m.clientHandledHistogram.Describe(ch)
	}
	if m.clientStreamRecvHistogramEnabled {
		m.clientStreamRecvHistogram.Describe(ch)
	}
	if m.clientStreamSendHistogramEnabled {
		m.clientStreamSendHistogram.Describe(ch)
	}
}
134717
func Describe(serviceName string,
	serviceDescription string,
	lambdaAWSInfos []*LambdaAWSInfo,
	api *API,
	s3Site *S3Site,
	s3BucketName string,
	buildTags string,
	linkFlags string,
	outputWriter io.Writer,
	workflowHooks *WorkflowHooks,
	logger *logrus.Logger) error {

	validationErr := validateSpartaPreconditions(lambdaAWSInfos, logger)
	if validationErr != nil {
		return validationErr
	}
	buildID, buildIDErr := provisionBuildID("none", logger)
	if buildIDErr != nil {
		buildID = fmt.Sprintf("%d", time.Now().Unix())
	}
	var cloudFormationTemplate bytes.Buffer
	err := Provision(true,
		serviceName,
		serviceDescription,
		lambdaAWSInfos,
		api,
		s3Site,
		s3BucketName,
		false,
		false,
		buildID,
		"",
		buildTags,
		linkFlags,
		&cloudFormationTemplate,
		workflowHooks,
		logger)
	if nil != err {
		return err
	}

	tmpl, err := template.New("description").Parse(_escFSMustString(false, "/resources/describe/template.html"))
	if err != nil {
		return errors.New(err.Error())
	}

	cytoscapeElements := make([]*cytoscapeNode, 0)
	// Instead of inline mermaid stuff, we're going to stuff raw
	// json through. We can also include AWS images in the icon
	// using base64/encoded:
	// Example: https://cytoscape.github.io/cytoscape.js-tutorial-demo/datasets/social.json
	// Use the "fancy" CSS:
	// https://github.com/cytoscape/cytoscape.js-tutorial-demo/blob/gh-pages/stylesheets/fancy.json
	// Which is dynamically updated at: https://cytoscape.github.io/cytoscape.js-tutorial-demo/

	// Setup the root object
	writeErr := writeNode(&cytoscapeElements,
		serviceName,
		nodeColorService,
		"AWSIcons/Management Tools/ManagementTools_AWSCloudFormation_stack.svg",
		logger)
	if writeErr != nil {
		return writeErr
	}
	for _, eachLambda := range lambdaAWSInfos {
		// Other cytoscape nodes
		// Create the node...
		writeErr = writeNode(&cytoscapeElements,
			eachLambda.lambdaFunctionName(),
			nodeColorLambda,
			"AWSIcons/Compute/Compute_AWSLambda.svg",
			logger)
		if writeErr != nil {
			return writeErr
		}
		writeErr = writeLink(&cytoscapeElements,
			eachLambda.lambdaFunctionName(),
			serviceName,
			"")
		if writeErr != nil {
			return writeErr
		}
		// Create permission & event mappings
		// functions declared in this
		for _, eachPermission := range eachLambda.Permissions {
			nodes, err := eachPermission.descriptionInfo()
			if nil != err {
				return err
			}

			for _, eachNode := range nodes {
				name := strings.TrimSpace(eachNode.Name)
				link := strings.TrimSpace(eachNode.Relation)
				// Style it to have the Amazon color
				nodeColor := eachNode.Color
				if nodeColor == "" {
					nodeColor = nodeColorEventSource
				}

				writeErr = writeNode(&cytoscapeElements,
					name,
					nodeColor,
					iconForAWSResource(eachNode.Name),
					logger)
				if writeErr != nil {
					return writeErr
				}
				writeErr = writeLink(&cytoscapeElements,
					name,
					eachLambda.lambdaFunctionName(),
					link)
				if writeErr != nil {
					return writeErr
				}
			}
		}
		for index, eachEventSourceMapping := range eachLambda.EventSourceMappings {
			dynamicArn := spartaCF.DynamicValueToStringExpr(eachEventSourceMapping.EventSourceArn)
			jsonBytes, jsonBytesErr := json.Marshal(dynamicArn)
			if jsonBytesErr != nil {
				jsonBytes = []byte(fmt.Sprintf("%s-EventSourceMapping[%d]",
					eachLambda.lambdaFunctionName(),
					index))
			}
			nodeName := string(jsonBytes)
			writeErr = writeNode(&cytoscapeElements,
				nodeName,
				nodeColorEventSource,
				iconForAWSResource(dynamicArn),
				logger)
			if writeErr != nil {
				return writeErr
			}
			writeErr = writeLink(&cytoscapeElements,
				nodeName,
				eachLambda.lambdaFunctionName(),
				"")
			if writeErr != nil {
				return writeErr
			}
		}
	}

	// API?
	if nil != api {
		// Create the APIGateway virtual node && connect it to the application
		writeErr = writeNode(&cytoscapeElements,
			nodeNameAPIGateway,
			nodeColorAPIGateway,
			"AWSIcons/Application Services/ApplicationServices_AmazonAPIGateway.svg",
			logger)
		if writeErr != nil {
			return writeErr
		}
		for _, eachResource := range api.resources {
			for eachMethod := range eachResource.Methods {
				// Create the PATH node
				var nodeName = fmt.Sprintf("%s - %s", eachMethod, eachResource.pathPart)
				writeErr = writeNode(&cytoscapeElements,
					nodeName,
					nodeColorAPIGateway,
					"AWSIcons/General/General_Internet.svg",
					logger)
				if writeErr != nil {
					return writeErr
				}
				writeErr = writeLink(&cytoscapeElements,
					nodeNameAPIGateway,
					nodeName,
					"")
				if writeErr != nil {
					return writeErr
				}
				writeErr = writeLink(&cytoscapeElements,
					nodeName,
					eachResource.parentLambda.lambdaFunctionName(),
					"")
				if writeErr != nil {
					return writeErr
				}
			}
		}
	}
	cytoscapeBytes, cytoscapeBytesErr := json.MarshalIndent(cytoscapeElements, "", " ")
	if cytoscapeBytesErr != nil {
		return errors.Wrapf(cytoscapeBytesErr, "Failed to marshal cytoscape data")
	}
	params := struct {
		SpartaVersion          string
		ServiceName            string
		ServiceDescription     string
		CloudFormationTemplate string
		CSSFiles               []*templateResource
		JSFiles                []*templateResource
		ImageMap               map[string]string
		CytoscapeData          interface{}
	}{
		SpartaGitHash[0:8],
		serviceName,
		serviceDescription,
		cloudFormationTemplate.String(),
		templateCSSFiles(logger),
		templateJSFiles(logger),
		templateImageMap(logger),
		string(cytoscapeBytes),
	}
	return tmpl.Execute(outputWriter, params)
}
108618
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
	for _, m := range MetricDescriptions {
		ch <- m
	}
}
1340220
func (p *Parameter) Description(doc string) *Parameter {
	p.data.Description = doc
	return p
}