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.instances.restore({
        // Required. The resource name of the instance, in the format `projects/{project_number\}/locations/{location_id\}/instances/{instance_id\}`.
        name: 'projects/my-project/locations/my-location/instances/my-instance',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "fileShare": "my_fileShare",
          //   "sourceBackup": "my_sourceBackup"
          // }
        },
      });
      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/notebooks.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 notebooks = google.notebooks('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 notebooks.projects.locations.instances.isUpgradeable({
        // Required. Format: `projects/{project_id\}/locations/{location\}/instances/{instance_id\}`
        notebookInstance:
          'projects/my-project/locations/my-location/instances/my-instance',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "upgradeImage": "my_upgradeImage",
      //   "upgradeInfo": "my_upgradeInfo",
      //   "upgradeVersion": "my_upgradeVersion",
      //   "upgradeable": false
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/notebooks.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 notebooks = google.notebooks('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 notebooks.projects.locations.instances.updateShieldedInstanceConfig({
          // Required. Format: `projects/{project_id\}/locations/{location\}/instances/{instance_id\}`
          name: 'projects/my-project/locations/my-location/instances/my-instance',
    
          // Request body metadata
          requestBody: {
            // request body parameters
            // {
            //   "shieldedInstanceConfig": {}
            // }
          },
        });
      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/notebooks.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 notebooks = google.notebooks('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 notebooks.projects.locations.instances.getInstanceHealth({
        // Required. Format: `projects/{project_id\}/locations/{location\}/instances/{instance_id\}`
        name: 'projects/my-project/locations/my-location/instances/my-instance',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "healthInfo": {},
      //   "healthState": "my_healthState"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // 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('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 file.projects.locations.instances.list({
        // List filter.
        filter: 'placeholder-value',
        // Sort results. Supported values are "name", "name desc" or "" (unsorted).
        orderBy: 'placeholder-value',
        // The maximum number of items to return.
        pageSize: 'placeholder-value',
        // The next_page_token value to use if there are additional results to retrieve for this list request.
        pageToken: 'placeholder-value',
        // Required. The project and location for which to retrieve instance information, in the format `projects/{project_id\}/locations/{location\}`. In Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To retrieve instance information for all locations, use "-" for the `{location\}` value.
        parent: 'projects/my-project/locations/my-location',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "instances": [],
      //   "nextPageToken": "my_nextPageToken",
      //   "unreachable": []
      // }
    }
    
    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