How to use the @azure/core-http.operationOptionsToRequestOptionsBase function in @azure/core-http

To help you get started, we’ve selected a few @azure/core-http 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 Azure / azure-sdk-for-js / sdk / keyvault / keyvault-secrets / src / index.ts View on Github external
public async getDeletedSecret(
    secretName: string,
    options: GetDeletedSecretOptions = {}
  ): Promise {
    const requestOptions = operationOptionsToRequestOptionsBase(options);
    const span = this.createSpan("getDeletedSecret", requestOptions);

    let response: GetDeletedSecretResponse;

    try {
      response = await this.client.getDeletedSecret(
        this.vaultUrl,
        secretName,
        this.setParentSpan(span, requestOptions)
      );
    } finally {
      span.end();
    }

    return this.getSecretFromSecretBundle(response);
  }
github Azure / azure-sdk-for-js / sdk / keyvault / keyvault-keys / src / cryptographyClient.ts View on Github external
public async signData(
    algorithm: SignatureAlgorithm,
    data: Uint8Array,
    options: SignOptions = {}
  ): Promise {
    const requestOptions = operationOptionsToRequestOptionsBase(options);
    const span = this.createSpan("signData", requestOptions);

    let digest;
    switch (algorithm) {
      case "ES256":
      case "ES256K":
      case "PS256":
      case "RS256":
        {
          digest = await createHash("sha256", data);
        }
        break;
      case "ES384":
      case "PS384":
      case "RS384":
        {
github Azure / azure-sdk-for-js / sdk / keyvault / keyvault-keys / src / index.ts View on Github external
private async recoverDeletedKey(
    name: string,
    options: RecoverDeletedKeyOptions = {}
  ): Promise {
    const requestOptions = operationOptionsToRequestOptionsBase(options);
    const span = this.createSpan("recoverDeletedKey", requestOptions);

    let response: RecoverDeletedKeyResponse;
    try {
      response = await this.client.recoverDeletedKey(
        this.vaultUrl,
        name,
        this.setParentSpan(span, requestOptions)
      );
    } finally {
      span.end();
    }

    return this.getKeyFromKeyBundle(response);
  }
github Azure / azure-sdk-for-js / sdk / appconfiguration / app-configuration / src / appConfigurationClient.ts View on Github external
private async *listRevisionsByPage(
    options: ListRevisionsOptions = {}
  ): AsyncIterableIterator {
    const opts = operationOptionsToRequestOptionsBase(options);
    let currentResponse = await this.spanner.trace("listRevisions", opts, (newOptions) => {
      return this.client.getRevisions({
        ...newOptions,
        ...formatAcceptDateTime(options),
        ...formatWildcards(newOptions)
      });
    });

    yield {
      ...currentResponse,
      items: currentResponse.items != null ? currentResponse.items.map(transformKeyValue) : []
    };

    while (currentResponse.nextLink) {
      currentResponse = await this.spanner.trace("listRevisions", opts, (newOptions) => {
        return this.client.getRevisions({
github Azure / azure-sdk-for-js / sdk / keyvault / keyvault-keys / src / index.ts View on Github external
public async createRsaKey(name: string, options?: CreateRsaKeyOptions): Promise {
    if (options) {
      const requestOptions = operationOptionsToRequestOptionsBase(options);
      const { enabled, notBefore, expiresOn: expires, ...remainingOptions } = requestOptions;
      const unflattenedOptions = {
        ...remainingOptions,
        keyAttributes: {
          enabled,
          notBefore,
          expires
        }
      };

      const span = this.createSpan("createRsaKey", unflattenedOptions);

      let response: CreateKeyResponse;
      try {
        response = await this.client.createKey(
          this.vaultUrl,
github Azure / azure-sdk-for-js / sdk / appconfiguration / app-configuration / src / appConfigurationClient.ts View on Github external
deleteConfigurationSetting(
    id: ConfigurationSettingId,
    options: DeleteConfigurationSettingOptions = {}
  ): Promise {
    const opts = operationOptionsToRequestOptionsBase(options);
    return this.spanner.trace("deleteConfigurationSetting", opts, async (newOptions) => {
      const originalResponse = await this.client.deleteKeyValue(id.key, {
        label: id.label,
        ...newOptions,
        ...checkAndFormatIfAndIfNoneMatch(id, options)
      });

      return transformKeyValueResponseWithStatusCode(originalResponse);
    });
  }
github Azure / azure-sdk-for-js / sdk / appconfiguration / app-configuration / src / appConfigurationClient.ts View on Github external
private async *listConfigurationSettingsByPage(
    options: ListConfigurationSettingsOptions = {}
  ): AsyncIterableIterator {
    const opts = operationOptionsToRequestOptionsBase(options);
    let currentResponse = await this.spanner.trace(
      "listConfigurationSettings",
      opts,
      (newOptions) => {
        return this.client.getKeyValues({
          ...newOptions,
          ...formatAcceptDateTime(options),
          ...formatWildcards(newOptions)
        });
      }
    );

    yield* this.createListConfigurationPageFromResponse(currentResponse);

    while (currentResponse.nextLink) {
      currentResponse = await this.spanner.trace(
github Azure / azure-sdk-for-js / sdk / keyvault / keyvault-secrets / src / index.ts View on Github external
public listDeletedSecrets(
    options: ListDeletedSecretsOptions = {}
  ): PagedAsyncIterableIterator {
    const requestOptions = operationOptionsToRequestOptionsBase(options);
    const span = this.createSpan("listDeletedSecrets", requestOptions);
    const updatedOptions: ListDeletedSecretsOptions = {
      ...requestOptions,
      ...this.setParentSpan(span, requestOptions)
    };

    const iter = this.listDeletedSecretsAll(updatedOptions);

    span.end();
    return {
      next() {
        return iter.next();
      },
      [Symbol.asyncIterator]() {
        return this;
      },