google-cloud-resource_manager 0.30.1 → 0.30.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd0b1f48311db4574904ff3a47c9837ea0d566a51feca6689cfe93f557385f01
4
- data.tar.gz: c4765b14fa28b1f08de397ae14cce5be61b6f97cf52e961e149a29323b75b313
3
+ metadata.gz: a6ddc95d421b5e0d6204586477a6ea0dc42a77ff49bc88810c12df6204f93ce9
4
+ data.tar.gz: a1cf6fd6c7adf263cd00e20a3d061c16c140c2b849bede8e1662397cd4443d46
5
5
  SHA512:
6
- metadata.gz: db337590de2584a3f25ee8520bd4805fe549074e4452cdf8e7c138584839f9c602deeef9ee766ca4089c9b7e160ee53c00db375f9e67131b056e47db45752237
7
- data.tar.gz: 63830bf855958324c46cc9e99ce340bf7e89421ea37d8092dde767bca23f6936ec223e5c7d969220fdcc2f7b5453c31a41bfedbd9442c1b74539495cb6062260
6
+ metadata.gz: beb1518df7c97fa7b947de796964c874951ed1af65f075e404198d7545e8049b58fa223fcdcef98ee6f771e335ee765c4f641ae26d5f64c89be4fd447ed1ebe3
7
+ data.tar.gz: 17e82ea3fcaaebd9d9843f90415a783dfab859d1cb7df90ea7f50ac968ada33002740d83a19b0e6b2bb4b35252fdb2f0af7a7f774a538f3bda06a1cde74b1cd2
@@ -0,0 +1,179 @@
1
+ # Authentication
2
+
3
+ In general, the google-cloud-resource_manager library uses [Service
4
+ Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
+ credentials to connect to Google Cloud services. When running on Compute Engine
6
+ the credentials will be discovered automatically. When running on other
7
+ environments, the Service Account credentials can be specified by providing the
8
+ path to the [JSON
9
+ keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
10
+ the account (or the JSON itself) in environment variables. Additionally, Cloud
11
+ SDK credentials can also be discovered automatically, but this is only
12
+ recommended during development.
13
+
14
+ ## Project and Credential Lookup
15
+
16
+ The google-cloud-resource_manager library aims to make authentication as simple
17
+ as possible, and provides several mechanisms to configure your system without
18
+ providing **Project ID** and **Service Account Credentials** directly in code.
19
+
20
+ **Project ID** is discovered in the following order:
21
+
22
+ 1. Specify project ID in method arguments
23
+ 2. Specify project ID in configuration
24
+ 3. Discover project ID in environment variables
25
+ 4. Discover GCE project ID
26
+
27
+ **Credentials** are discovered in the following order:
28
+
29
+ 1. Specify credentials in method arguments
30
+ 2. Specify credentials in configuration
31
+ 3. Discover credentials path in environment variables
32
+ 4. Discover credentials JSON in environment variables
33
+ 5. Discover credentials file in the Cloud SDK's path
34
+ 6. Discover GCE credentials
35
+
36
+ ### Google Cloud Platform environments
37
+
38
+ While running on Google Cloud Platform environments such as Google Compute
39
+ Engine, Google App Engine and Google Kubernetes Engine, no extra work is needed.
40
+ The **Project ID** and **Credentials** and are discovered automatically. Code
41
+ should be written as if already authenticated. Just be sure when you [set up the
42
+ GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
43
+ access. For example:
44
+
45
+ * **All APIs**
46
+ * `https://www.googleapis.com/auth/cloud-platform`
47
+ * `https://www.googleapis.com/auth/cloud-platform.read-only`
48
+ * **BigQuery**
49
+ * `https://www.googleapis.com/auth/bigquery`
50
+ * `https://www.googleapis.com/auth/bigquery.insertdata`
51
+ * **Compute Engine**
52
+ * `https://www.googleapis.com/auth/compute`
53
+ * **Datastore**
54
+ * `https://www.googleapis.com/auth/datastore`
55
+ * `https://www.googleapis.com/auth/userinfo.email`
56
+ * **DNS**
57
+ * `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
58
+ * **Pub/Sub**
59
+ * `https://www.googleapis.com/auth/pubsub`
60
+ * **Storage**
61
+ * `https://www.googleapis.com/auth/devstorage.full_control`
62
+ * `https://www.googleapis.com/auth/devstorage.read_only`
63
+ * `https://www.googleapis.com/auth/devstorage.read_write`
64
+
65
+ ### Environment Variables
66
+
67
+ The **Project ID** and **Credentials JSON** can be placed in environment
68
+ variables instead of declaring them directly in code. Each service has its own
69
+ environment variable, allowing for different service accounts to be used for
70
+ different services. (See the READMEs for the individual service gems for
71
+ details.) The path to the **Credentials JSON** file can be stored in the
72
+ environment variable, or the **Credentials JSON** itself can be stored for
73
+ environments such as Docker containers where writing files is difficult or not
74
+ encouraged.
75
+
76
+ The environment variables that Resource Manager checks for project ID are:
77
+
78
+ 1. `RESOURCE_MANAGER_PROJECT`
79
+ 2. `GOOGLE_CLOUD_PROJECT`
80
+
81
+ The environment variables that Resource Manager checks for credentials are
82
+ configured on {Google::Cloud::ResourceManager::Credentials}:
83
+
84
+ 1. `RESOURCE_MANAGER_CREDENTIALS` - Path to JSON file, or JSON contents
85
+ 2. `RESOURCE_MANAGER_KEYFILE` - Path to JSON file, or JSON contents
86
+ 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
87
+ 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
88
+ 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
89
+
90
+ ```ruby
91
+ require "google/cloud/resource_manager"
92
+
93
+ ENV["RESOURCE_MANAGER_PROJECT"] = "my-project-id"
94
+ ENV["RESOURCE_MANAGER_CREDENTIALS"] = "path/to/keyfile.json"
95
+
96
+ resource_manager = Google::Cloud::ResourceManager.new
97
+ ```
98
+
99
+ ### Configuration
100
+
101
+ The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
102
+
103
+ ```ruby
104
+ require "google/cloud/resource_manager"
105
+
106
+ Google::Cloud::ResourceManager.configure do |config|
107
+ config.project_id = "my-project-id"
108
+ config.credentials = "path/to/keyfile.json"
109
+ end
110
+
111
+ resource_manager = Google::Cloud::ResourceManager.new
112
+ ```
113
+
114
+ ### Cloud SDK
115
+
116
+ This option allows for an easy way to authenticate during development. If
117
+ credentials are not provided in code or in environment variables, then Cloud SDK
118
+ credentials are discovered.
119
+
120
+ To configure your system for this, simply:
121
+
122
+ 1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
123
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
124
+ 3. Write code as if already authenticated.
125
+
126
+ **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
127
+ *should* only be used during development.
128
+
129
+ [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
130
+ [dev-console]: https://console.cloud.google.com/project
131
+
132
+ [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
133
+
134
+ [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
135
+ [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
136
+ [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
137
+
138
+ ## Creating a Service Account
139
+
140
+ Google Cloud requires a **Project ID** and **Service Account Credentials** to
141
+ connect to the APIs. You will use the **Project ID** and **JSON key file** to
142
+ connect to most services with google-cloud-resource_manager.
143
+
144
+ If you are not running this client on Google Compute Engine, you need a Google
145
+ Developers service account.
146
+
147
+ 1. Visit the [Google Developers Console][dev-console].
148
+ 1. Create a new project or click on an existing project.
149
+ 1. Activate the slide-out navigation tray and select **API Manager**. From
150
+ here, you will enable the APIs that your application requires.
151
+
152
+ ![Enable the APIs that your application requires][enable-apis]
153
+
154
+ *Note: You may need to enable billing in order to use these services.*
155
+
156
+ 1. Select **Credentials** from the side navigation.
157
+
158
+ You should see a screen like one of the following.
159
+
160
+ ![Create a new service account][create-new-service-account]
161
+
162
+ ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
163
+
164
+ Find the "Add credentials" drop down and select "Service account" to be
165
+ guided through downloading a new JSON key file.
166
+
167
+ If you want to re-use an existing service account, you can easily generate a
168
+ new key file. Just select the account you wish to re-use, and click "Generate
169
+ new JSON key":
170
+
171
+ ![Re-use an existing service account][reuse-service-account]
172
+
173
+ The key file you download will be used by this library to authenticate API
174
+ requests and should be stored in a secure location.
175
+
176
+ ## Troubleshooting
177
+
178
+ If you're having trouble authenticating you can ask for help by following the
179
+ {file:TROUBLESHOOTING.md Troubleshooting Guide}.
@@ -0,0 +1,75 @@
1
+ # Release History
2
+
3
+ ### 0.30.2 / 2018-09-12
4
+
5
+ * Add missing documentation files to package.
6
+
7
+ ### 0.30.1 / 2018-09-10
8
+
9
+ * Update documentation.
10
+
11
+ ### 0.30.0 / 2018-06-22
12
+
13
+ * Update Policy, protect from role duplication.
14
+ * Updated dependencies.
15
+
16
+ ### 0.29.0 / 2018-02-27
17
+
18
+ * Support Shared Configuration.
19
+ * Fix issue with IAM Policy not refreshing properly.
20
+ * Update Google API Client dependency.
21
+
22
+ ### 0.28.0 / 2017-11-14
23
+
24
+ * Add `Google::Cloud::ResourceManager::Credentials` class.
25
+ * Rename constructor arguments to `project_id` and `credentials`.
26
+ (The previous arguments `project` and `keyfile` are still supported.)
27
+ * Document `Google::Auth::Credentials` as `credentials` value.
28
+ * Updated `google-api-client`, `googleauth` dependencies.
29
+
30
+ ### 0.27.0 / 2017-09-28
31
+
32
+ * Update Google API Client dependency to 0.14.x.
33
+
34
+ ### 0.26.0 / 2017-06-27
35
+
36
+ * Upgrade dependency on Google API Client
37
+
38
+ ### 0.25.0 / 2017-06-01
39
+
40
+ * Fix apiary client argument case.
41
+ * Update gem spec homepage links.
42
+ * Remove memoization of Policy.
43
+ * Remove force parameter from Project#policy.
44
+ * Remove Policy#deep_dup.
45
+
46
+ ### 0.24.1 / 2017-04-06
47
+
48
+ * Fix error due to missing require.
49
+
50
+ ### 0.24.0 / 2017-04-05
51
+
52
+ * Upgrade dependency on Google API Client
53
+
54
+ ### 0.23.0 / 2017-03-31
55
+
56
+ * Updated documentation
57
+
58
+ ### 0.22.0 / 2017-03-03
59
+
60
+ * Dependency on Google API Client has been updated to 0.10.x.
61
+
62
+ ### 0.21.0 / 2016-10-20
63
+
64
+ * New service constructor Google::Cloud::ResourceManager.new
65
+
66
+ ### 0.20.1 / 2016-09-02
67
+
68
+ * Fix for timeout on uploads.
69
+
70
+ ### 0.20.0 / 2016-08-26
71
+
72
+ This gem contains the Google Cloud Resource Manager service implementation for the `google-cloud` gem. The `google-cloud` gem replaces the old `gcloud` gem. Legacy code can continue to use the `gcloud` gem.
73
+
74
+ * Namespace is now `Google::Cloud`
75
+ * The `google-cloud` gem is now an umbrella package for individual gems
@@ -0,0 +1,40 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct.
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or reject
24
+ comments, commits, code, wiki edits, issues, and other contributions that are
25
+ not aligned to this Code of Conduct. By adopting this Code of Conduct, project
26
+ maintainers commit themselves to fairly and consistently applying these
27
+ principles to every aspect of managing this project. Project maintainers who do
28
+ not follow or enforce the Code of Conduct may be permanently removed from the
29
+ project team.
30
+
31
+ This code of conduct applies both within project spaces and in public spaces
32
+ when an individual is representing the project or its community.
33
+
34
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
35
+ reported by opening an issue or contacting one or more of the project
36
+ maintainers.
37
+
38
+ This Code of Conduct is adapted from the [Contributor
39
+ Covenant](http://contributor-covenant.org), version 1.2.0, available at
40
+ [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
@@ -0,0 +1,190 @@
1
+ # Contributing to Google Cloud Resource Manager
2
+
3
+ 1. **Sign one of the contributor license agreements below.**
4
+ 2. Fork the repo, develop and test your code changes.
5
+ 3. Send a pull request.
6
+
7
+ ## Contributor License Agreements
8
+
9
+ Before we can accept your pull requests you'll need to sign a Contributor
10
+ License Agreement (CLA):
11
+
12
+ - **If you are an individual writing original source code** and **you own the
13
+ intellectual property**, then you'll need to sign an [individual
14
+ CLA](https://developers.google.com/open-source/cla/individual).
15
+ - **If you work for a company that wants to allow you to contribute your work**,
16
+ then you'll need to sign a [corporate
17
+ CLA](https://developers.google.com/open-source/cla/corporate).
18
+
19
+ You can sign these electronically (just scroll to the bottom). After that, we'll
20
+ be able to accept your pull requests.
21
+
22
+ ## Setup
23
+
24
+ In order to use the google-cloud-resource_manager console and run the project's
25
+ tests, there is a small amount of setup:
26
+
27
+ 1. Install Ruby. google-cloud-resource_manager requires Ruby 2.3+. You may
28
+ choose to manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
+ [rbenv](https://github.com/rbenv/rbenv), or
30
+ [chruby](https://github.com/postmodern/chruby).
31
+
32
+ 2. Install [Bundler](http://bundler.io/).
33
+
34
+ ```sh
35
+ $ gem install bundler
36
+ ```
37
+
38
+ 3. Install the top-level project dependencies.
39
+
40
+ ```sh
41
+ $ bundle install
42
+ ```
43
+
44
+ 4. Install the Resource Manager dependencies.
45
+
46
+ ```sh
47
+ $ cd google-cloud-resource_manager/
48
+ $ bundle exec rake bundleupdate
49
+ ```
50
+
51
+ ## Console
52
+
53
+ In order to run code interactively, you can automatically load
54
+ google-cloud-resource_manager and its dependencies in IRB. This requires that
55
+ your developer environment has already been configured by following the steps
56
+ described in the {file:AUTHENTICATION.md Authentication Guide}. An IRB console
57
+ can be created with:
58
+
59
+ ```sh
60
+ $ cd google-cloud-resource_manager/
61
+ $ bundle exec rake console
62
+ ```
63
+
64
+ ## Resource Manager Tests
65
+
66
+ Tests are very important part of google-cloud-resource_manager. All
67
+ contributions should include tests that ensure the contributed code behaves as
68
+ expected.
69
+
70
+ To run the unit tests, documentation tests, and code style checks together for a
71
+ package:
72
+
73
+ ``` sh
74
+ $ cd google-cloud-resource_manager/
75
+ $ bundle exec rake ci
76
+ ```
77
+
78
+ To run the command above, plus all acceptance tests, use `rake ci:acceptance` or
79
+ its handy alias, `rake ci:a`.
80
+
81
+ ### Resource Manager Unit Tests
82
+
83
+
84
+ The project uses the [minitest](https://github.com/seattlerb/minitest) library,
85
+ including [specs](https://github.com/seattlerb/minitest#specs),
86
+ [mocks](https://github.com/seattlerb/minitest#mocks) and
87
+ [minitest-autotest](https://github.com/seattlerb/minitest-autotest).
88
+
89
+ To run the Resource Manager unit tests:
90
+
91
+ ``` sh
92
+ $ cd google-cloud-resource_manager/
93
+ $ bundle exec rake test
94
+ ```
95
+
96
+ ### Resource Manager Documentation Tests
97
+
98
+ The project tests the code examples in the gem's
99
+ [YARD](https://github.com/lsegal/yard)-based documentation.
100
+
101
+ The example testing functions in a way that is very similar to unit testing, and
102
+ in fact the library providing it,
103
+ [yard-doctest](https://github.com/p0deje/yard-doctest), is based on the
104
+ project's unit test library, [minitest](https://github.com/seattlerb/minitest).
105
+
106
+ To run the Resource Manager documentation tests:
107
+
108
+ ``` sh
109
+ $ cd google-cloud-resource_manager/
110
+ $ bundle exec rake doctest
111
+ ```
112
+
113
+ If you add, remove or modify documentation examples when working on a pull
114
+ request, you may need to update the setup for the tests. The stubs and mocks
115
+ required to run the tests are located in `support/doctest_helper.rb`. Please
116
+ note that much of the setup is matched by the title of the
117
+ [`@example`](http://www.rubydoc.info/gems/yard/file/docs/Tags.md#example) tag.
118
+ If you alter an example's title, you may encounter breaking tests.
119
+
120
+ ### Resource Manager Acceptance Tests
121
+
122
+ The Resource Manager acceptance tests interact with the live service API. Follow
123
+ the instructions in the {file:AUTHENTICATION.md Authentication guide} for
124
+ enabling the Resource Manager API. Occasionally, some API features may not yet
125
+ be generally available, making it difficult for some contributors to
126
+ successfully run the entire acceptance test suite. However, please ensure that
127
+ you do successfully run acceptance tests for any code areas covered by your pull
128
+ request.
129
+
130
+ To run the acceptance tests, first create and configure a project in the Google
131
+ Developers Console, as described in the {file:AUTHENTICATION.md Authentication
132
+ guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
133
+ the KEYFILE location on your system.
134
+
135
+ Before you can run the Resource Manager acceptance tests, you must first create
136
+ indexes used in the tests.
137
+
138
+ #### Running the Resource Manager acceptance tests
139
+
140
+ To run the Resource Manager acceptance tests:
141
+
142
+ ``` sh
143
+ $ cd google-cloud-resource_manager/
144
+ $ bundle exec rake acceptance[\\{my-project-id},\\{/path/to/keyfile.json}]
145
+ ```
146
+
147
+ Or, if you prefer you can store the values in the `GCLOUD_TEST_PROJECT` and
148
+ `GCLOUD_TEST_KEYFILE` environment variables:
149
+
150
+ ``` sh
151
+ $ cd google-cloud-resource_manager/
152
+ $ export GCLOUD_TEST_PROJECT=\\{my-project-id}
153
+ $ export GCLOUD_TEST_KEYFILE=\\{/path/to/keyfile.json}
154
+ $ bundle exec rake acceptance
155
+ ```
156
+
157
+ If you want to use a different project and credentials for acceptance tests, you
158
+ can use the more specific `BIGTABLE_TEST_PROJECT` and `BIGTABLE_TEST_KEYFILE`
159
+ environment variables:
160
+
161
+ ``` sh
162
+ $ cd google-cloud-resource_manager/
163
+ $ export BIGTABLE_TEST_PROJECT=\\{my-project-id}
164
+ $ export BIGTABLE_TEST_KEYFILE=\\{/path/to/keyfile.json}
165
+ $ bundle exec rake acceptance
166
+ ```
167
+
168
+ ## Coding Style
169
+
170
+ Please follow the established coding style in the library. The style is is
171
+ largely based on [The Ruby Style
172
+ Guide](https://github.com/bbatsov/ruby-style-guide) with a few exceptions based
173
+ on seattle-style:
174
+
175
+ * Avoid parenthesis when possible, including in method definitions.
176
+ * Always use double quotes strings. ([Option
177
+ B](https://github.com/bbatsov/ruby-style-guide#strings))
178
+
179
+ You can check your code against these rules by running Rubocop like so:
180
+
181
+ ```sh
182
+ $ cd google-cloud-resource_manager/
183
+ $ bundle exec rake rubocop
184
+ ```
185
+
186
+ ## Code of Conduct
187
+
188
+ Please note that this project is released with a Contributor Code of Conduct. By
189
+ participating in this project you agree to abide by its terms. See
190
+ {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
@@ -0,0 +1,27 @@
1
+ # Enabling Logging
2
+
3
+ To enable logging for this library, set the logger for the underlying [Google
4
+ API
5
+ Client](https://github.com/google/google-api-ruby-client/blob/master/README.md#logging)
6
+ library. The logger that you set may be a Ruby stdlib
7
+ [`Logger`](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) as
8
+ shown below, or a
9
+ [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/Google/Cloud/Logging/Logger)
10
+ that will write logs to [Stackdriver
11
+ Logging](https://cloud.google.com/logging/).
12
+
13
+ If you do not set the logger explicitly and your application is running in a
14
+ Rails environment, it will default to `Rails.logger`. Otherwise, if you do not
15
+ set the logger and you are not using Rails, logging is disabled by default.
16
+
17
+ Configuring a Ruby stdlib logger:
18
+
19
+ ```ruby
20
+ require "logger"
21
+
22
+ my_logger = Logger.new $stderr
23
+ my_logger.level = Logger::WARN
24
+
25
+ # Set the Google API Client logger
26
+ Google::Apis.logger = my_logger
27
+ ```
@@ -0,0 +1,188 @@
1
+ # Google Cloud Resource Manager
2
+
3
+ The Resource Manager API provides methods that you can use to programmatically
4
+ manage your projects in the Google Cloud Platform. You may be familiar with
5
+ managing projects in the [Developers
6
+ Console](https://developers.google.com/console/help/new/). With this API you can
7
+ do the following:
8
+
9
+ * Get a list of all projects associated with an account
10
+ * Create new projects
11
+ * Update existing projects
12
+ * Delete projects
13
+ * Undelete, or recover, projects that you don't want to delete
14
+
15
+ The goal of google-cloud is to provide an API that is comfortable to Rubyists.
16
+ Your authentication credentials are detected automatically in Google Cloud
17
+ Platform environments such as Google Compute Engine, Google App Engine and
18
+ Google Kubernetes Engine. In other environments you can configure authentication
19
+ easily, either directly in your code or via environment variables. Read more
20
+ about the options for connecting in the {file:AUTHENTICATION.md Authentication
21
+ Guide}.
22
+
23
+ ## Listing Projects
24
+
25
+ Project is a collection of settings, credentials, and metadata about the
26
+ application or applications you're working on. You can retrieve and
27
+ inspect all projects that you have permissions to. (See
28
+ {Google::Cloud::ResourceManager::Manager#projects Manager#projects})
29
+
30
+ ```ruby
31
+ require "google/cloud/resource_manager"
32
+
33
+ resource_manager = Google::Cloud::ResourceManager.new
34
+ resource_manager.projects.each do |project|
35
+ puts projects.project_id
36
+ end
37
+ ```
38
+
39
+ ## Managing Projects with Labels
40
+
41
+ Labels can be added to or removed from projects. (See
42
+ {Google::Cloud::ResourceManager::Project#labels Project#labels})
43
+
44
+ ```ruby
45
+ require "google/cloud/resource_manager"
46
+
47
+ resource_manager = Google::Cloud::ResourceManager.new
48
+ project = resource_manager.project "tokyo-rain-123"
49
+ # Label the project as production
50
+ project.update do |p|
51
+ p.labels["env"] = "production"
52
+ end
53
+ ```
54
+
55
+ Projects can then be filtered by labels. (See
56
+ {Google::Cloud::ResourceManager::Manager#projects Manager#projects})
57
+
58
+ ```ruby
59
+ require "google/cloud/resource_manager"
60
+
61
+ resource_manager = Google::Cloud::ResourceManager.new
62
+ # Find only the productions projects
63
+ projects = resource_manager.projects filter: "labels.env:production"
64
+ projects.each do |project|
65
+ puts project.project_id
66
+ end
67
+ ```
68
+
69
+ ## Creating a Project
70
+
71
+ You can also use the API to create new projects. (See
72
+ {Google::Cloud::ResourceManager::Manager#create_project Manager#create_project})
73
+
74
+ ```ruby
75
+ require "google/cloud/resource_manager"
76
+
77
+ resource_manager = Google::Cloud::ResourceManager.new
78
+ project = resource_manager.create_project "tokyo-rain-123",
79
+ name: "Todos Development",
80
+ labels: {env: :development}
81
+ ```
82
+
83
+ ## Deleting a Project
84
+
85
+ You can delete projects when they are no longer needed. (See
86
+ {Google::Cloud::ResourceManager::Manager#delete Manager#delete} and
87
+ {Google::Cloud::ResourceManager::Project#delete Project#delete})
88
+
89
+ ```ruby
90
+ require "google/cloud/resource_manager"
91
+
92
+ resource_manager = Google::Cloud::ResourceManager.new
93
+ resource_manager.delete "tokyo-rain-123"
94
+ ```
95
+
96
+ ## Undeleting a Project
97
+
98
+ You can also restore a deleted project within the waiting period that
99
+ starts when the project was deleted. Restoring a project returns it to the
100
+ state it was in prior to being deleted. (See
101
+ {Google::Cloud::ResourceManager::Manager#undelete Manager#undelete} and
102
+ {Google::Cloud::ResourceManager::Project#undelete Project#undelete})
103
+
104
+ ```ruby
105
+ require "google/cloud/resource_manager"
106
+
107
+ resource_manager = Google::Cloud::ResourceManager.new
108
+ resource_manager.undelete "tokyo-rain-123"
109
+ ```
110
+
111
+ ## Configuring retries and timeout
112
+
113
+ You can configure how many times API requests may be automatically retried. When
114
+ an API request fails, the response will be inspected to see if the request meets
115
+ criteria indicating that it may succeed on retry, such as `500` and `503` status
116
+ codes or a specific internal error code such as `rateLimitExceeded`. If it meets
117
+ the criteria, the request will be retried after a delay. If another error
118
+ occurs, the delay will be increased before a subsequent attempt, until the
119
+ `retries` limit is reached.
120
+
121
+ You can also set the request `timeout` value in seconds.
122
+
123
+ ```ruby
124
+ require "google/cloud/resource_manager"
125
+
126
+ resource_manager = Google::Cloud::ResourceManager.new retries: 10,
127
+ timeout: 120
128
+ ```
129
+
130
+ See the [Resource Manager error
131
+ messages](https://cloud.google.com/resource-manager/docs/core_errors)
132
+ for a list of error conditions.
133
+
134
+ ## Managing IAM Policies
135
+
136
+ Google Cloud Identity and Access Management ([Cloud
137
+ IAM](https://cloud.google.com/iam/)) access control policies can be managed on
138
+ projects. These policies allow project owners to manage _who_ (identity) has
139
+ access to _what_ (role). See [Cloud IAM
140
+ Overview](https://cloud.google.com/iam/docs/overview) for more information.
141
+
142
+ A project's access control policy can be retrieved. (See
143
+ {Google::Cloud::ResourceManager::Project#policy Project#policy} and
144
+ {Google::Cloud::ResourceManager::Policy Policy}.)
145
+
146
+ ```ruby
147
+ require "google/cloud/resource_manager"
148
+
149
+ resource_manager = Google::Cloud::ResourceManager.new
150
+ project = resource_manager.project "tokyo-rain-123"
151
+ policy = project.policy
152
+ ```
153
+
154
+ A project's access control policy can also be updated:
155
+
156
+ ```ruby
157
+ require "google/cloud/resource_manager"
158
+
159
+ resource_manager = Google::Cloud::ResourceManager.new
160
+ project = resource_manager.project "tokyo-rain-123"
161
+
162
+ policy = project.policy do |p|
163
+ p.add "roles/viewer", "serviceAccount:your-service-account"
164
+ end
165
+ ```
166
+
167
+ And permissions can be tested on a project. (See
168
+ {Google::Cloud::ResourceManager::Project#test_permissions
169
+ Project#test_permissions})
170
+
171
+ ```ruby
172
+ require "google/cloud/resource_manager"
173
+
174
+ resource_manager = Google::Cloud::ResourceManager.new
175
+ project = resource_manager.project "tokyo-rain-123"
176
+ perms = project.test_permissions "resourcemanager.projects.get",
177
+ "resourcemanager.projects.delete"
178
+ perms.include? "resourcemanager.projects.get" #=> true
179
+ perms.include? "resourcemanager.projects.delete" #=> false
180
+ ```
181
+
182
+ For more information about using access control policies see [Managing
183
+ Policies](https://cloud.google.com/iam/docs/managing-policies).
184
+
185
+ ## Additional information
186
+
187
+ Resource Manager can be configured to use logging. To learn more, see the
188
+ {file:LOGGING.md Logging guide}.
@@ -0,0 +1,37 @@
1
+ # Troubleshooting
2
+
3
+ ## Where can I get more help?
4
+
5
+ ### Ask the Community
6
+
7
+ If you have a question about how to use a Google Cloud client library in your
8
+ project or are stuck in the Developer's console and don't know where to turn,
9
+ it's possible your questions have already been addressed by the community.
10
+
11
+ First, check out the appropriate tags on StackOverflow:
12
+ - [`google-cloud-platform+ruby+resource+manager`][so-ruby]
13
+
14
+ Next, try searching through the issues on GitHub:
15
+
16
+ - [`api:resource manager` issues][gh-search-ruby]
17
+
18
+ Still nothing?
19
+
20
+ ### Ask the Developers
21
+
22
+ If you're experiencing a bug with the code, or have an idea for how it can be
23
+ improved, *please* create a new issue on GitHub so we can talk about it.
24
+
25
+ - [New issue][gh-ruby]
26
+
27
+ Or, you can ask questions on the [Google Cloud Platform Slack][slack-ruby]. You
28
+ can use the "ruby" channel for general Ruby questions, or use the
29
+ "google-cloud-ruby" channel if you have questions about this gem in particular.
30
+
31
+ [so-ruby]: http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby+resourcemanager
32
+
33
+ [gh-search-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues?q=label%3A%22api%3A+resource+manager%22
34
+
35
+ [gh-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues/new
36
+
37
+ [slack-ruby]: https://gcp-slack.appspot.com/
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module ResourceManager
19
- VERSION = "0.30.1".freeze
19
+ VERSION = "0.30.2".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-resource_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.1
4
+ version: 0.30.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-10 00:00:00.000000000 Z
12
+ date: 2018-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -203,8 +203,14 @@ extensions: []
203
203
  extra_rdoc_files: []
204
204
  files:
205
205
  - ".yardopts"
206
+ - AUTHENTICATION.md
207
+ - CHANGELOG.md
208
+ - CODE_OF_CONDUCT.md
209
+ - CONTRIBUTING.md
206
210
  - LICENSE
207
- - README.md
211
+ - LOGGING.md
212
+ - OVERVIEW.md
213
+ - TROUBLESHOOTING.md
208
214
  - lib/google-cloud-resource_manager.rb
209
215
  - lib/google/cloud/resource_manager.rb
210
216
  - lib/google/cloud/resource_manager/credentials.rb
data/README.md DELETED
@@ -1,123 +0,0 @@
1
- # google-cloud-resource_manager
2
-
3
- [Google Cloud Resource Manager](https://cloud.google.com/resource-manager/) ([docs](https://cloud.google.com/resource-manager/reference/rest/)) enables you to
4
- programmatically manage container resources such as Organizations and Projects, that allow you to group and hierarchically organize other Cloud Platform resources. This hierarchical organization lets you easily manage common aspects of your resources such as access control and configuration settings. You may be familiar with managing projects in the [Developers Console](https://developers.google.com/console/help/new/). With this API you can do the following:
5
-
6
- * Get a list of all projects associated with an account
7
- * Create new projects
8
- * Update existing projects
9
- * Delete projects
10
- * Undelete, or recover, projects that you don't want to delete
11
-
12
- - [google-cloud-resource_manager API documentation](http://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-resource_manager/latest)
13
- - [google-cloud-resource_manager on RubyGems](https://rubygems.org/gems/google-cloud-resource_manager)
14
- - [Google Cloud Resource Manager documentation](https://cloud.google.com/resource-manager/)
15
-
16
- ## Quick Start
17
-
18
- ```sh
19
- $ gem install google-cloud-resource_manager
20
- ```
21
-
22
- ## Authentication
23
-
24
- The Resource Manager API currently requires authentication of a [User
25
- Account](https://developers.google.com/identity/protocols/OAuth2), and
26
- cannot currently be accessed with a [Service
27
- Account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount).
28
- To use a User Account install the [Google Cloud
29
- SDK](http://cloud.google.com/sdk) and authenticate with the following:
30
-
31
- ```
32
- $ gcloud auth login
33
- ```
34
-
35
- Also make sure all environment variables are cleared of any
36
- service account credentials. Then google-cloud-resource_manager will be able to detect the user
37
- authentication and connect with those credentials.
38
-
39
- Instructions and configuration options are covered in the [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-resource_manager/latest/file.AUTHENTICATION).
40
-
41
- ## Example
42
-
43
- ```ruby
44
- require "google/cloud/resource_manager"
45
-
46
- resource_manager = Google::Cloud::ResourceManager.new
47
-
48
- # List all projects
49
- resource_manager.projects.each do |project|
50
- puts projects.project_id
51
- end
52
-
53
- # Label a project as production
54
- project = resource_manager.project "tokyo-rain-123"
55
- project.update do |p|
56
- p.labels["env"] = "production"
57
- end
58
-
59
- # List only projects with the "production" label
60
- projects = resource_manager.projects filter: "labels.env:production"
61
- ```
62
-
63
- ## Enabling Logging
64
-
65
- To enable logging for this library, set the logger for the underlying [Google API Client](https://github.com/google/google-api-ruby-client/blob/master/README.md#logging) library. The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) as shown below, or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/Google/Cloud/Logging/Logger) that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/).
66
-
67
- If you do not set the logger explicitly and your application is running in a Rails environment, it will default to `Rails.logger`. Otherwise, if you do not set the logger and you are not using Rails, logging is disabled by default.
68
-
69
- Configuring a Ruby stdlib logger:
70
-
71
- ```ruby
72
- require "logger"
73
-
74
- my_logger = Logger.new $stderr
75
- my_logger.level = Logger::WARN
76
-
77
- # Set the Google API Client logger
78
- Google::Apis.logger = my_logger
79
- ```
80
-
81
- ## Supported Ruby Versions
82
-
83
- This library is supported on Ruby 2.3+.
84
-
85
- Google provides official support for Ruby versions that are actively supported
86
- by Ruby Core—that is, Ruby versions that are either in normal maintenance or in
87
- security maintenance, and not end of life. Currently, this means Ruby 2.3 and
88
- later. Older versions of Ruby _may_ still work, but are unsupported and not
89
- recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
90
- about the Ruby support schedule.
91
-
92
- ## Versioning
93
-
94
- This library follows [Semantic Versioning](http://semver.org/).
95
-
96
- It is currently in major version zero (0.y.z), which means that anything may
97
- change at any time and the public API should not be considered stable.
98
-
99
- ## Contributing
100
-
101
- Contributions to this library are always welcome and highly encouraged.
102
-
103
- See the [Contributing
104
- Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-resource_manager/latest/file.CONTRIBUTING)
105
- for more information on how to get started.
106
-
107
- Please note that this project is released with a Contributor Code of Conduct. By
108
- participating in this project you agree to abide by its terms. See [Code of
109
- Conduct](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-resource_manager/latest/file.CODE_OF_CONDUCT)
110
- for more information.
111
-
112
- ## License
113
-
114
- This library is licensed under Apache 2.0. Full license text is available in
115
- [LICENSE](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-resource_manager/latest/file.LICENSE).
116
-
117
- ## Support
118
-
119
- Please [report bugs at the project on
120
- Github](https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues). Don't
121
- hesitate to [ask
122
- questions](http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby)
123
- about the client or APIs on [StackOverflow](http://stackoverflow.com).