// GetRequestMetadata returns nil, nil since TLS credentials do not have metadata.
551011
func (tc *serverTransportCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
	return nil, nil
}
188348
func GetMetadata(data []byte, format string) (metadata []byte, err error) {
	return webpGetMetadata(data, strings.ToUpper(format))
}
302028
func (l *Layer0) GetMetadata(id string) (map[string]string, error) {
	id = l.realID(id)
	return l.Driver.GetMetadata(id)
}
486196
func extractMetadata(ctx context.Context, r *http.Request) (metadata map[string]string, err error) {
	query := r.URL.Query()
	header := r.Header
	metadata = make(map[string]string)
	// Extract all query values.
	err = extractMetadataFromMap(ctx, query, metadata)
	if err != nil {
		return nil, err
	}

	// Extract all header values.
	err = extractMetadataFromMap(ctx, header, metadata)
	if err != nil {
		return nil, err
	}

	// Set content-type to default value if it is not set.
	if _, ok := metadata["content-type"]; !ok {
		metadata["content-type"] = "application/octet-stream"
	}

	// Success.
	return metadata, nil
}
1264589
func (goPlatform *Platform) GetMetadataProvider(code []byte) platforms.MetadataProvider {
	return &ccmetadata.TargzMetadataProvider{Code: code}
}
1098191
func (c *KafkaClient) GetTopicMetadata(topics []string) (*MetadataResponse, error) {
	for i := 0; i <= c.config.MetadataRetries; i++ {
		if metadata, err := c.getMetadata(topics); err == nil {
			return metadata, nil
		}

		log.Debugf("GetTopicMetadata for %s failed after %d try", topics, i)
		time.Sleep(c.config.MetadataBackoff)
	}

	return nil, fmt.Errorf("Could not get topic metadata for %s after %d retries", topics, c.config.MetadataRetries)
}
1249391
func fetchMetadata(ctx context.Context, path, scheme string) (rc io.ReadCloser, err error) {
	defer func() {
		if err != nil {
			err = fmt.Errorf("unable to determine remote metadata protocol: %s", err)
		}
	}()

	if scheme == "http" {
		rc, err = doFetchMetadata(ctx, "http", path)
		return
	}

	rc, err = doFetchMetadata(ctx, "https", path)
	if err == nil {
		return
	}

	rc, err = doFetchMetadata(ctx, "http", path)
	return
}
41203
func (idp *IdentityProvider) ServeMetadata(w http.ResponseWriter, r *http.Request) {
	buf, _ := xml.MarshalIndent(idp.Metadata(), "", "  ")
	w.Header().Set("Content-Type", "application/samlmetadata+xml")
	w.Write(buf)
}
153717
func (b *Broker) GetMetadata(request *MetadataRequest) (*MetadataResponse, error) {
	response := new(MetadataResponse)

	err := b.sendAndReceive(request, response)

	if err != nil {
		return nil, err
	}

	return response, nil
}
204112
func getMetadata(e encoder, adapter PanamaxAdapter) (int, string) {

	data := &Metadata{Version: VERSION, Type: "marathon"}

	return http.StatusOK, e.Encode(data)
}
259714
func (NoopBlockMetadataStore) GetMetadata(ctx context.Context,
	blockID kbfsblock.ID) (value BlockMetadataValue, err error) {
	return BlockMetadataValue{}, ldberrors.ErrNotFound
}
47821
func FetchMetadata(stream string, sources ...simplestreams.DataSource) ([]*Metadata, error) {
	params := simplestreams.GetMetadataParams{
		StreamsVersion: streamsVersion,
		LookupConstraint: &constraint{
			LookupParams: simplestreams.LookupParams{Stream: stream},
			majorVersion: jujuversion.Current.Major,
		},
		ValueParams: simplestreams.ValueParams{
			DataType:        downloadType,
			MirrorContentId: contentId(stream),
			FilterFunc:      appendArchives,
			ValueTemplate:   Metadata{},
		},
	}
	items, _, err := simplestreams.GetMetadata(sources, params)
	if err != nil {
		return nil, errors.Annotate(err, "error fetching simplestreams metadata")
	}
	allMeta := make([]*Metadata, len(items))
	for i, item := range items {
		allMeta[i] = item.(*Metadata)
	}
	sort.Sort(byVersion(allMeta))
	return allMeta, nil
}
478808
func (c cacheObjects) getMetadata(objInfo ObjectInfo) map[string]string {
	metadata := make(map[string]string)
	metadata["etag"] = objInfo.ETag
	metadata["content-type"] = objInfo.ContentType
	metadata["content-encoding"] = objInfo.ContentEncoding

	for key, val := range objInfo.UserDefined {
		metadata[key] = val
	}
	return metadata
}
1366156
func (mj *Client) GetData(mdr *DataRequest, res interface{}, options ...RequestOptions) (err error) {
	url := buildDataURL(mj.apiBase, mdr)
	req, err := createRequest("GET", url, nil, nil, options...)
	if err != nil {
		return err
	}

	_, _, err = mj.httpClient.Send(req).Read(res).Call()
	return err
}
520054
func (e *Ec2Meta) retrieveMetadata(url string, def ...string) (string, error) {
	if value, ok := e.cache[url]; ok {
		return value, nil
	}

	if e.nonAWS {
		return returnDefault(def), nil
	}

	if e.Client == nil {
		timeout := e.options.Timeout
		if timeout == 0 {
			timeout = 500 * time.Millisecond
		}
		e.Client = &http.Client{Timeout: timeout}
	}
	resp, err := e.Client.Get(url)
	if err != nil {
		if unreachable(err) {
			e.nonAWS = true
		}
		return returnDefault(def), nil
	}

	// nolint: errcheck
	defer resp.Body.Close()
	if resp.StatusCode > 399 {
		return returnDefault(def), nil
	}

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return "", errors.Wrapf(err, "Failed to read response body from %s", url)
	}
	value := strings.TrimSpace(string(body))
	e.cache[url] = value

	return value, nil
}
534871
func GetMetadataFromBlockOrPanic(block *cb.Block, index cb.BlockMetadataIndex) *cb.Metadata {
	md, err := GetMetadataFromBlock(block, index)
	if err != nil {
		panic(err)
	}
	return md
}
276433
func fetchMetadata(c context.Context, pfx string) (*metadataBlock, error) {
	meta, err := impl.PublicRepo.GetInheritedPrefixMetadata(c, &api.PrefixRequest{
		Prefix: pfx,
	})
	switch grpc.Code(err) {
	case codes.OK:
		break // handled below
	case codes.PermissionDenied:
		return fetchCallerRoles(c, pfx)
	default:
		return nil, err
	}

	// Grab URL of an auth server with the groups, if available.
	groupsURL := ""
	if url, err := auth.GetState(c).DB().GetAuthServiceURL(c); err == nil {
		groupsURL = url + "/auth/groups/"
	}

	out := &metadataBlock{CanView: true}
	for _, m := range meta.PerPrefixMetadata {
		for _, a := range m.Acls {
			role := strings.Title(strings.ToLower(a.Role.String()))

			prefix := m.Prefix
			if prefix == "" {
				prefix = "[root]"
			}

			for _, p := range a.Principals {
				whoHref := ""
				switch {
				case strings.HasPrefix(p, "group:"):
					p = strings.TrimPrefix(p, "group:")
					if groupsURL != "" {
						whoHref = groupsURL + p
					}
				case p == string(identity.AnonymousIdentity):
					p = "anonymous"
				default:
					p = strings.TrimPrefix(p, "user:")
				}

				out.ACLs = append(out.ACLs, metadataACL{
					RolePb:     a.Role,
					Role:       role,
					Who:        p,
					WhoHref:    whoHref,
					Prefix:     prefix,
					PrefixHref: prefixPageURL(m.Prefix),
				})
			}
		}
	}

	sort.Slice(out.ACLs, func(i, j int) bool {
		l, r := out.ACLs[i], out.ACLs[j]
		if l.RolePb != r.RolePb {
			return l.RolePb > r.RolePb // "stronger" role (e.g. OWNERS) first
		}
		if l.Prefix != r.Prefix {
			return l.Prefix > r.Prefix // longer prefix first
		}
		return l.Who < r.Who // alphabetically
	})

	return out, nil
}