How to use the taskcluster-lib-urls.withRootUrl function in taskcluster-lib-urls

To help you get started, we’ve selected a few taskcluster-lib-urls examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taskcluster / taskcluster / services / web-server / src / loaders / artifacts.js View on Github external
module.exports = ({ queue }, isAuthed, rootUrl) => {
  const urls = withRootUrl(rootUrl);
  const withUrl = ({ method, taskId, artifact, runId }) => {
    const hasRunId = !isNil(runId);
    const isPublic = /^public\//.test(artifact.name);

    // We don't want to build signed URLs for public artifacts,
    // even when credentials are present -- users often
    // copy/paste artifact URLs, and this would likely lead to
    // people copy/pasting time-limited, signed URLs which would
    // (a) have a long ?bewit=.. argument and
    // (b) probably not work after that bewit expires.
    // We could use queue.buildUrl, but this creates URLs where the artifact
    // name has slashes encoded. For artifacts we specifically allow slashes
    // in the name unencoded, as this make things like `wget ${URL}` create
    // files with nice names.
    if (isPublic) {
      return {
github taskcluster / taskcluster / clients / client-web / src / Client.js View on Github external
if (args[arity]) {
      Object.keys(args[arity]).forEach(key => {
        if (!optionKeys.includes(key)) {
          throw new Error(
            `Method \`${entry.name}\` expected options ${optionKeys.join(
              ', ',
            )} but received ${key}`,
          );
        }
      });
    }

    const queryArgs = args[arity] && stringify(args[arity]);
    const query = queryArgs ? `?${queryArgs}` : '';

    return withRootUrl(this.options.rootUrl).api(
      this.options.serviceName,
      this.options.serviceVersion,
      `${endpoint}${query}`,
    );
  }
github taskcluster / taskcluster / clients / client-web / src / Client.js View on Github external
if (args[arity]) {
      Object.keys(args[arity]).forEach(key => {
        if (!optionKeys.includes(key)) {
          throw new Error(
            `Method \`${entry.name}\` expected options ${optionKeys.join(
              ', '
            )} but received ${key}`
          );
        }
      });
    }

    const queryArgs = args[arity] && stringify(args[arity]);
    const query = queryArgs ? `?${queryArgs}` : '';

    return withRootUrl(this.options.rootUrl).api(
      this.options.serviceName,
      this.options.serviceVersion,
      `${endpoint}${query}`
    );
  }
github taskcluster / taskcluster / src / utils / urls.js View on Github external
import { withRootUrl } from 'taskcluster-lib-urls';

export default withRootUrl(process.env.TASKCLUSTER_ROOT_URL);
github taskcluster / taskcluster / clients / client-web / src / Client.js View on Github external
async request(entry, args) {
    const expectedArity = this.getMethodExpectedArity(entry);
    const endpoint = this.buildEndpoint(entry, args);
    const query = args[expectedArity]
      ? `?${stringify(args[expectedArity])}`
      : '';
    const url = withRootUrl(this.options.rootUrl).api(
      this.options.serviceName,
      this.options.serviceVersion,
      `${endpoint}${query}`
    );
    const options = { method: entry.method };
    const credentials = this.options.credentialAgent
      ? await this.options.credentialAgent.getCredentials()
      : this.options.credentials;

    if (entry.input) {
      options.body = JSON.stringify(args[expectedArity - 1]);
    }

    if (credentials) {
      options.credentials = credentials;
      options.extra = this.buildExtraData(credentials);
github taskcluster / taskcluster / ui / src / utils / urls.js View on Github external
import { withRootUrl } from 'taskcluster-lib-urls';

export default withRootUrl(window.env.TASKCLUSTER_ROOT_URL);
github taskcluster / taskcluster-tools / src / utils.js View on Github external
exception: 'warning'
};

export const stabilityColors = {
  experimental: 'default',
  stable: 'success',
  deprecated: 'danger'
};

export const loadable = loader =>
  Loadable({
    loading: Loading,
    loader
  });

export const urls = withRootUrl(process.env.TASKCLUSTER_ROOT_URL);

export const createListener = options => {
  const bindings =
    options.bindings ||
    options.exchanges.map(exchange =>
      (({ exchange, routingKeyPattern }) => ({
        exchange,
        routingKeyPattern
      }))(options.queueEvents[exchange](options.routingKey))
    );

  return new EventSource(
    urls.api(
      'events',
      'v1',
      `connect/?bindings=${encodeURIComponent(JSON.stringify({ bindings }))}`
github taskcluster / taskcluster / clients / client-web / src / Client.js View on Github external
async request(entry, args) {
    const expectedArity = this.getMethodExpectedArity(entry);
    const endpoint = this.buildEndpoint(entry, args);
    const query = args[expectedArity]
      ? `?${stringify(args[expectedArity])}`
      : '';
    const url = withRootUrl(this.options.rootUrl).api(
      this.options.serviceName,
      this.options.serviceVersion,
      `${endpoint}${query}`,
    );
    const options = { method: entry.method };
    const credentials = this.options.credentialAgent
      ? await this.options.credentialAgent.getCredentials()
      : this.options.credentials;

    if (entry.input) {
      options.body = JSON.stringify(args[expectedArity - 1]);
    }

    if (credentials) {
      options.credentials = credentials;
      options.extra = this.buildExtraData(credentials);

taskcluster-lib-urls

Build urls for taskcluster resources.

MPL-2.0
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages