Coder Social home page Coder Social logo

gcp-project-id's Introduction

gcp-project-id

Go Reference Go Report Card Go Coverage

Access your Google Cloud project ID and related configuration.

Works in the cloud and local development environments, as it can retrieve the project ID configured within the gcloud CLI.

Installation

To use this package in your Go project, you can install it using go get:

go get github.com/lucmq/gcp-project-id

Usage

Here's how you can use the project package to retrieve a Google Cloud project ID:

package main

import (
	"fmt"

	"github.com/lucmq/gcp-project-id/project"
)

func main() {
	// Retrieve the default project ID with default options
	projectID := project.ID()

	fmt.Println("Default Project ID:", projectID)
}

With custom options:

package main

import (
	"fmt"
	"time"
	
	"github.com/lucmq/gcp-project-id/project"
)

func main() {
	// Customize options (e.g., timeout, scopes, strict mode)
	options := project.Options{
		Timeout: 10 * time.Second,
		Scopes:  []string{"https://www.googleapis.com/auth/compute"},
		Strict:  true,
	}

	// Retrieve the project ID with custom options
	projectID := project.ID(options)

	fmt.Println("Default Project ID:", projectID)
}

Contributing

Contributions to this package are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

gcp-project-id's People

Contributors

lucmq avatar deepsource-io[bot] avatar

Stargazers

Pedro Tavares avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.