Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds IAM get/set for binding members and roles #996

Merged
merged 6 commits into from
Feb 6, 2018
Merged

Adds IAM get/set for binding members and roles #996

merged 6 commits into from
Feb 6, 2018

Conversation

gguuss
Copy link
Contributor

@gguuss gguuss commented Jan 18, 2018

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 18, 2018
Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to import and use what ever you want, no need to do com.xxx.xx.xx

@@ -93,15 +93,16 @@ public static Topic createIotTopic(String projectId, String topicId) throws Exce

try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
final Topic topic = topicAdminClient.createTopic(topicName);
Policy policy = topicAdminClient.getIamPolicy(topicName.toString());
com.google.iam.v1.Policy policy = topicAdminClient.getIamPolicy(topicName.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this -- is it required?

// add role -> members binding
Binding binding =
Binding.newBuilder()
.addMembers("serviceAccount:cloud-iot@system.gserviceaccount.com")
.setRole(Role.owner().toString())
.build();
// create updated policy
Policy updatedPolicy = Policy.newBuilder(policy).addBindings(binding).build();
com.google.iam.v1.Policy updatedPolicy =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, not a fan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the code that does not appear in documentation, it's necessary for testing the API and is a convenient helper if someone is using this to automate device provisioning.

final String registryPath = String.format("projects/%s/locations/%s/registries/%s",
projectId, cloudRegion, registryName);

com.google.api.services.cloudiot.v1.model.Policy policy =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugly

Copy link
Contributor Author

@gguuss gguuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ugly long-path names are used here because there are IAM policy types that need to be used to configure the Pub/Sub topic as well as the IAM types to get/set policy bindings on device registries.

I think the right thing to do is remove the long-name convention from the IOT examples and instead use that for pub/sub. The Pub/Sub IAM is just required for testing / convenience and should not appear in the IoT documentation.

@lesv
Copy link
Contributor

lesv commented Feb 5, 2018

@gguuss What do i need to enable?

 Change detected. Running tests. 
 
[ERROR] Tests run: 17, Failures: 0, Errors: 7, Skipped: 0, Time elapsed: 570.949 s <<< FAILURE! - in com.example.cloud.iot.examples.ManagerIT
[ERROR] testHttpDeviceEvent(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 3.196 s  <<< ERROR!
com.google.api.client.http.HttpResponseException: 
403 Forbidden
{
  "error": {
    "code": 403,
    "message": "User not authorized to perform this action.",
    "errors": [
      {
        "message": "User not authorized to perform this action.",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}

	at com.example.cloud.iot.examples.ManagerIT.testHttpDeviceEvent(ManagerIT.java:321)

[ERROR] testHttpDeviceState(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 0.591 s  <<< ERROR!
com.google.api.gax.rpc.AlreadyExistsException: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).

[ERROR] testGetIam(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 1.58 s  <<< ERROR!
com.google.api.gax.rpc.AlreadyExistsException: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).

[ERROR] testCreateDeleteRsaDevice(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 1.504 s  <<< ERROR!
com.google.api.gax.rpc.AlreadyExistsException: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).

[ERROR] testCreateDeleteUnauthDevice(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 0.694 s  <<< ERROR!
com.google.api.gax.rpc.AlreadyExistsException: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).

[ERROR] testSetIam(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 0.74 s  <<< ERROR!
com.google.api.gax.rpc.AlreadyExistsException: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).

[ERROR] testPatchRsa(com.example.cloud.iot.examples.ManagerIT)  Time elapsed: 0.852 s  <<< ERROR!
com.google.api.gax.rpc.AlreadyExistsException: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Resource already exists in the project (resource=java-pst-1517852041).

[ERROR] Errors: 
[ERROR]   ManagerIT.testCreateDeleteRsaDevice ? AlreadyExists io.grpc.StatusRuntimeExcep...
[ERROR]   ManagerIT.testCreateDeleteUnauthDevice ? AlreadyExists io.grpc.StatusRuntimeEx...
[ERROR]   ManagerIT.testGetIam ? AlreadyExists io.grpc.StatusRuntimeException: ALREADY_E...
[ERROR]   ManagerIT.testHttpDeviceEvent:321 ? HttpResponse 403 Forbidden
{
  "error": {
...
[ERROR]   ManagerIT.testHttpDeviceState ? AlreadyExists io.grpc.StatusRuntimeException: ...
[ERROR]   ManagerIT.testPatchRsa ? AlreadyExists io.grpc.StatusRuntimeException: ALREADY...
[ERROR]   ManagerIT.testSetIam ? AlreadyExists io.grpc.StatusRuntimeException: ALREADY_E...
[ERROR] Tests run: 17, Failures: 0, Errors: 7, Skipped: 0
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.20.1:verify (default) on project cloudiot-manager-demo: There are test failures.
[ERROR] 
[ERROR] Please refer to /tmpfs/src/github/java-docs-samples/iot/api-client/manager/target/failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException


[ID: 6350789] Build finished after 673 secs, exit value: 1


Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Build script failed with exit code: 1

@lesv lesv added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 5, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 5, 2018
@gguuss gguuss merged commit 76bcb8b into master Feb 6, 2018
@gguuss gguuss deleted the iot-iam branch February 6, 2018 17:34
minherz pushed a commit that referenced this pull request Nov 9, 2022
minherz pushed a commit that referenced this pull request Nov 10, 2022
minherz pushed a commit that referenced this pull request Nov 10, 2022
minherz pushed a commit that referenced this pull request Nov 16, 2022
…996)

* chore(deps): update dependency com.google.cloud:libraries-bom to v24

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
minherz pushed a commit that referenced this pull request Nov 17, 2022
…996)

* chore(deps): update dependency com.google.cloud:libraries-bom to v24

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Shabirmean pushed a commit that referenced this pull request Nov 17, 2022
…3.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://github.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.2.0` -> `25.3.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/compatibility-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/confidence-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-translate).
Shabirmean pushed a commit that referenced this pull request Nov 17, 2022
…1.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://github.com/GoogleCloudPlatform/cloud-opensource-java) | `24.0.0` -> `24.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/compatibility-slim/24.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/confidence-slim/24.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
Shabirmean pushed a commit that referenced this pull request Nov 18, 2022
…3.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://github.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.2.0` -> `25.3.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/compatibility-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/confidence-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-translate).
Shabirmean pushed a commit that referenced this pull request Nov 18, 2022
…3.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://github.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.2.0` -> `25.3.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/compatibility-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/confidence-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-translate).
Shabirmean pushed a commit that referenced this pull request Nov 18, 2022
…1.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://github.com/GoogleCloudPlatform/cloud-opensource-java) | `24.0.0` -> `24.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/compatibility-slim/24.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/confidence-slim/24.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
anguillanneuf pushed a commit that referenced this pull request Dec 5, 2022
…996)

* chore(deps): update dependency com.google.cloud:libraries-bom to v24

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
anguillanneuf pushed a commit that referenced this pull request Dec 5, 2022
…3.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://github.com/GoogleCloudPlatform/cloud-opensource-java)) | `25.2.0` -> `25.3.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/compatibility-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/25.3.0/confidence-slim/25.2.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-translate).
anguillanneuf pushed a commit that referenced this pull request Dec 5, 2022
…1.0 (#996)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:libraries-bom](https://github.com/GoogleCloudPlatform/cloud-opensource-java) | `24.0.0` -> `24.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/compatibility-slim/24.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.1.0/confidence-slim/24.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
Sita04 pushed a commit that referenced this pull request Feb 7, 2023
🤖 I have created a release *beep* *boop*
---


## [3.7.3](googleapis/java-dlp@v3.7.2...v3.7.3) (2022-09-22)


### Dependencies

* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.18 ([#995](googleapis/java-dlp#995)) ([0b3796d](googleapis/java-dlp@0b3796d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants