-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add AttachedDisk class, subclasses and tests #928
Conversation
Did you mean |
Yes sorry I meant: Operation attachDisk(InstanceId instance, PersistentAttachedDisk attachedDisk, OperationOptions... options); Fixing it now. |
Isn't that the same for getting the configuration from an AttachedDisk in #917 ? Also, given your example above |
Yes you still need casting, however in this case it's explicit.
Yes |
switch (Type.valueOf(diskPb.getType())) { | ||
case PERSISTENT: | ||
if (diskPb.getSource() == null) { | ||
return (T) CreateAttachedDisk.fromPb(diskPb); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Added a comment in #917 regarding the set of types that can be passed to attachDisk. Also, I do wonder if CreateAttachedDisk should be a subclass of an AttachedDisk considering that For these reasons and for the one you mentioned I think I prefer #917. I think the cost of being |
I think it's quite clear: {
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid value for field 'resource.disks[0]': ''. Boot disk must be the first disk attached to the instance."
}
],
"code": 400,
"message": "Invalid value for field 'resource.disks[0]': ''. Boot disk must be the first disk attached to the instance."
}
} |
which makes my preference to even stronger #917. Also, per comment in the other PR, would be worth to know if that is a doc error (suggesting more possibilities) and/or plans to support it at some point. |
Closing this as we decided to go with #917 |
🤖 I have created a release *beep* *boop* --- ## [2.1.4](googleapis/java-vision@v2.1.3...v2.1.4) (2022-06-27) ### Dependencies * update spring.version to v2.7.1 ([googleapis#925](googleapis/java-vision#925)) ([e52efbd](googleapis/java-vision@e52efbd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…plugin to v3 (#928) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.apache.maven.plugins:maven-deploy-plugin](https://maven.apache.org/plugins/) | `2.8.2` -> `3.0.0` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-deploy-plugin/3.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-deploy-plugin/3.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-deploy-plugin/3.0.0/compatibility-slim/2.8.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-deploy-plugin/3.0.0/confidence-slim/2.8.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - 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 [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-dlp). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMTcuNCIsInVwZGF0ZWRJblZlciI6IjMyLjExNy40In0=-->
…onfig to v1.5.3 (#928) [![Mend 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:google-cloud-shared-config](https://github.com/googleapis/java-shared-config) | `1.5.1` -> `1.5.3` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.3/compatibility-slim/1.5.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.3/confidence-slim/1.5.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-shared-config</summary> ### [`v1.5.3`](https://github.com/googleapis/java-shared-config/blob/HEAD/CHANGELOG.md#​153-httpsgithubcomgoogleapisjava-shared-configcomparev152v153-2022-07-27) [Compare Source](https://github.com/googleapis/java-shared-config/compare/v1.5.2...v1.5.3) ##### Dependencies - update dependency org.junit.vintage:junit-vintage-engine to v5.9.0 ([#​497](https://github.com/googleapis/java-shared-config/issues/497)) ([1fc6ab4](https://github.com/googleapis/java-shared-config/commit/1fc6ab445624cd4f9c8b161d109f346a9e5ed09a)) - Update doclet to latest version 1.6.0 ([38fb7c3](https://github.com/googleapis/java-shared-config/commit/38fb7c3957fb6c9b2da10f9e463cc93a8b80a3a4)) ### [`v1.5.2`](https://github.com/googleapis/java-shared-config/blob/HEAD/CHANGELOG.md#​152-httpsgithubcomgoogleapisjava-shared-configcomparev151v152-2022-07-25) [Compare Source](https://github.com/googleapis/java-shared-config/compare/v1.5.1...v1.5.2) ##### Dependencies - update dependency com.puppycrawl.tools:checkstyle to v10 ([#​435](https://github.com/googleapis/java-shared-config/issues/435)) ([bfc8ce1](https://github.com/googleapis/java-shared-config/commit/bfc8ce1deca6292147d002d3afe22a09840aa5d6)) - update dependency org.graalvm.buildtools:junit-platform-native to v0.9.13 ([#​488](https://github.com/googleapis/java-shared-config/issues/488)) ([39b91ee](https://github.com/googleapis/java-shared-config/commit/39b91ee1283f0a5fbbe63e8bfd1ec97ab4ab377e)) - update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.13 ([#​489](https://github.com/googleapis/java-shared-config/issues/489)) ([cc3bcfa](https://github.com/googleapis/java-shared-config/commit/cc3bcfa2d6717441a8d5b5048fa78c2cf7aabf2b)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - 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 [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-speech). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMzUuMSIsInVwZGF0ZWRJblZlciI6IjMyLjEzNS4xIn0=-->
…orting to v0.124.4-beta (#928) * chore(deps): update dependency com.google.cloud:google-cloud-errorreporting to v0.124.4-beta * 🦉 Updates from OwlBot post-processor 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>
🤖 I have created a release *beep* *boop* --- ## [2.4.4](googleapis/java-containeranalysis@v2.4.3...v2.4.4) (2022-09-09) ### Dependencies * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#927](googleapis/java-containeranalysis#927)) ([9570ece](googleapis/java-containeranalysis@9570ece)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
* chore(main): release 3.4.4 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 477955264 Source-Link: https://github.com/googleapis/googleapis/commit/a724450af76d0001f23602684c49cd6a4b3a5654 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4abcbcaec855e74a0b22a4988cf9e0eb61a83094 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGFiY2JjYWVjODU1ZTc0YTBiMjJhNDk4OGNmOWUwZWI2MWE4MzA5NCJ9
🤖 I have created a release *beep* *boop* --- ## [2.11.0](https://github.com/googleapis/java-securitycenter/compare/v2.10.0...v2.11.0) (2022-10-03) ### Features * Added parent display name i.e. source display name for a finding as one of the finding attributes ([#915](https://github.com/googleapis/java-securitycenter/issues/915)) ([034d25a](https://github.com/googleapis/java-securitycenter/commit/034d25a3191ccc82dd4e9fe69124af3c24b1029f)) ### Dependencies * Update dependency cachetools to v5 ([#933](https://github.com/googleapis/java-securitycenter/issues/933)) ([5b2b39d](https://github.com/googleapis/java-securitycenter/commit/5b2b39dabf51c323316033c558efce77c2c19bf9)) * Update dependency com.google.cloud:google-cloud-bigquery to v2.16.1 ([#917](https://github.com/googleapis/java-securitycenter/issues/917)) ([58ed894](https://github.com/googleapis/java-securitycenter/commit/58ed8942ca8012cf0456bfe431d21e7d553f1fd0)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.16 ([#913](https://github.com/googleapis/java-securitycenter/issues/913)) ([1eaf4b3](https://github.com/googleapis/java-securitycenter/commit/1eaf4b3b295ba7e248f88ef14a377d1e865ac5c3)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.17 ([#923](https://github.com/googleapis/java-securitycenter/issues/923)) ([60d65d3](https://github.com/googleapis/java-securitycenter/commit/60d65d35a3c50f8cedeb8ef9b4db0480d667a976)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.18 ([#924](https://github.com/googleapis/java-securitycenter/issues/924)) ([f94db64](https://github.com/googleapis/java-securitycenter/commit/f94db64c37b4e0c734ee8bd42a6d174feb2251ba)) * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#937](https://github.com/googleapis/java-securitycenter/issues/937)) ([001091d](https://github.com/googleapis/java-securitycenter/commit/001091d1d178d81e3cec06f3847687c8905be49a)) * Update dependency com.google.protobuf:protobuf-java-util to v3.21.6 ([#914](https://github.com/googleapis/java-securitycenter/issues/914)) ([992d37a](https://github.com/googleapis/java-securitycenter/commit/992d37a4fe95b598b638d159aa86e41e324a63ff)) * Update dependency com.google.protobuf:protobuf-java-util to v3.21.7 ([#935](https://github.com/googleapis/java-securitycenter/issues/935)) ([2353016](https://github.com/googleapis/java-securitycenter/commit/23530169d5c988e30c9a1c43a0405243dd6614ad)) * Update dependency markupsafe to v2.1.1 ([#927](https://github.com/googleapis/java-securitycenter/issues/927)) ([2c42b32](https://github.com/googleapis/java-securitycenter/commit/2c42b32a1831e08a8f0f5e4e600e18ca075d5c10)) * Update dependency protobuf to v3.20.2 ([#928](https://github.com/googleapis/java-securitycenter/issues/928)) ([faf7200](https://github.com/googleapis/java-securitycenter/commit/faf72009d3deea9bd869cc6e93a08d28325f2ace)) * Update dependency protobuf to v4 ([#934](https://github.com/googleapis/java-securitycenter/issues/934)) ([19f8da3](https://github.com/googleapis/java-securitycenter/commit/19f8da31814ae8f957b142655c45cdcb5254c696)) * Update dependency pyjwt to v2.5.0 ([#929](https://github.com/googleapis/java-securitycenter/issues/929)) ([a5b8ae2](https://github.com/googleapis/java-securitycenter/commit/a5b8ae2802dfaea8745eab65fa7c4ac83ebd973e)) * Update dependency requests to v2.28.1 ([#930](https://github.com/googleapis/java-securitycenter/issues/930)) ([ca80e91](https://github.com/googleapis/java-securitycenter/commit/ca80e911c33af260892a95998d15c1dd024c67d4)) * Update dependency typing-extensions to v4.3.0 ([#931](https://github.com/googleapis/java-securitycenter/issues/931)) ([12fda13](https://github.com/googleapis/java-securitycenter/commit/12fda1317eb93337827ee03918b91d0c3cbe1a15)) * Update dependency zipp to v3.8.1 ([#932](https://github.com/googleapis/java-securitycenter/issues/932)) ([15a6c7f](https://github.com/googleapis/java-securitycenter/commit/15a6c7f01f4e6da74e037852857af1e0cceaad11)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…1.3 (googleapis#928) [![Mend 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/googleapis/java-cloud-bom)) | `26.1.2` -> `26.1.3` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/26.1.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/26.1.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/26.1.3/compatibility-slim/26.1.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/26.1.3/confidence-slim/26.1.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - 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 these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-recaptchaenterprise). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMTkuMSIsInVwZGF0ZWRJblZlciI6IjMyLjIxOS4xIn0=-->
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
[![Mend 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.api.grpc:grpc-google-iam-v1](https://github.com/googleapis/java-iam/grpc-google-iam-v1) ([source](https://github.com/googleapis/java-iam)) | `1.6.19` -> `1.6.20` | [![age](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:grpc-google-iam-v1/1.6.20/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:grpc-google-iam-v1/1.6.20/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:grpc-google-iam-v1/1.6.20/compatibility-slim/1.6.19)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:grpc-google-iam-v1/1.6.20/confidence-slim/1.6.19)](https://docs.renovatebot.com/merge-confidence/) | | [com.google.api.grpc:proto-google-iam-v1](https://github.com/googleapis/java-iam/proto-google-iam-v1) ([source](https://github.com/googleapis/java-iam)) | `1.6.19` -> `1.6.20` | [![age](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:proto-google-iam-v1/1.6.20/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:proto-google-iam-v1/1.6.20/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:proto-google-iam-v1/1.6.20/compatibility-slim/1.6.19)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.api.grpc:proto-google-iam-v1/1.6.20/confidence-slim/1.6.19)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-iam</summary> ### [`v1.6.20`](https://github.com/googleapis/java-iam/blob/HEAD/CHANGELOG.md#​1620-httpsgithubcomgoogleapisjava-iamcomparev1619v1620-2022-11-22) [Compare Source](https://github.com/googleapis/java-iam/compare/v1.6.19...v1.6.20) ##### Dependencies - Update dependency com.google.cloud:google-iam-policy to v1.6.19 ([#​551](https://github.com/googleapis/java-iam/issues/551)) ([cd4a411](https://github.com/googleapis/java-iam/commit/cd4a411647e67ebe88c690d6ca4532d4011b4029)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - 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 these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-shared-dependencies). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4zMC4yIiwidXBkYXRlZEluVmVyIjoiMzQuMzAuMiJ9-->
This is an alternative PR to #917 for the sake of discussion.
Instead of having a single
AttachedDisk
class and 3 configuration objects this class moves the hierarchy toAttachedDisk
, creating 3 subclassesPersistentAttachedDisk
,CreateAttachedDisk
andScratchAttachedDisk
.PROs of this approach with respect to #917 is that we can write
attachDisk
method as:Operation attachDisk(InstanceId instance, PersistentDiskConfiguration configuration, OperationOption... options);
And the
InstanceInfo.of
methods will become:Thus capturing the fact that an instance cannot be created with only one scratch disk.
CONS of this approach is that once we get an instance getting all information on it's attached disks requires casting:
Any thoughts would be appreciated :) /cc @mderka @aozarov @ajkannan