How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/file.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const file = google.file('v1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/cloud-platform'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await file.projects.locations.backups.patch({
        // Output only. The resource name of the backup, in the format `projects/{project_number\}/locations/{location_id\}/backups/{backup_id\}`.
        name: 'projects/my-project/locations/my-location/backups/my-backup',
        // Required. Mask of fields to update. At least one path must be supplied in this field.
        updateMask: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "capacityGb": "my_capacityGb",
          //   "createTime": "my_createTime",
          //   "description": "my_description",
          //   "downloadBytes": "my_downloadBytes",
          //   "labels": {},
          //   "name": "my_name",
          //   "satisfiesPzs": false,
          //   "sourceFileShare": "my_sourceFileShare",
          //   "sourceInstance": "my_sourceInstance",
          //   "sourceInstanceTier": "my_sourceInstanceTier",
          //   "state": "my_state",
          //   "storageBytes": "my_storageBytes"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "done": false,
      //   "error": {},
      //   "metadata": {},
      //   "name": "my_name",
      //   "response": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/managedidentities.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const managedidentities = google.managedidentities('v1alpha1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/cloud-platform'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res =
        await managedidentities.projects.locations.global.domains.backups.testIamPermissions(
          {
            // REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
            resource:
              'projects/my-project/locations/global/domains/my-domain/backups/my-backup',
    
            // Request body metadata
            requestBody: {
              // request body parameters
              // {
              //   "permissions": []
              // }
            },
          }
        );
      console.log(res.data);
    
      // Example response
      // {
      //   "permissions": []
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/managedidentities.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const managedidentities = google.managedidentities('v1alpha1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/cloud-platform'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res =
        await managedidentities.projects.locations.global.domains.backups.setIamPolicy(
          {
            // REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
            resource:
              'projects/my-project/locations/global/domains/my-domain/backups/my-backup',
    
            // Request body metadata
            requestBody: {
              // request body parameters
              // {
              //   "policy": {}
              // }
            },
          }
        );
      console.log(res.data);
    
      // Example response
      // {
      //   "bindings": [],
      //   "etag": "my_etag",
      //   "version": 0
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/metastore.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const metastore = google.metastore('v1beta');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/cloud-platform'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res =
        await metastore.projects.locations.services.backups.testIamPermissions({
          // REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
          resource:
            'projects/my-project/locations/my-location/services/my-service/backups/my-backup',
    
          // Request body metadata
          requestBody: {
            // request body parameters
            // {
            //   "permissions": []
            // }
          },
        });
      console.log(res.data);
    
      // Example response
      // {
      //   "permissions": []
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/managedidentities.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const managedidentities = google.managedidentities('v1beta1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/cloud-platform'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res =
        await managedidentities.projects.locations.global.domains.backups.setIamPolicy(
          {
            // REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
            resource:
              'projects/my-project/locations/global/domains/my-domain/backups/my-backup',
    
            // Request body metadata
            requestBody: {
              // request body parameters
              // {
              //   "policy": {}
              // }
            },
          }
        );
      console.log(res.data);
    
      // Example response
      // {
      //   "bindings": [],
      //   "etag": "my_etag",
      //   "version": 0
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples