Skip to content

Compute API v1: xxxResourceName.parse throws ValidationException #3604

Description

@dtretyakov

Currently all parse() methods in xxxResourceName classes expect that input string will be formatted like projects/{project}/..., but data returned from APIs contains URL prefixes like https://www.googleapis.com/compute/v1/projects/... and as result parsing fails with ValidationException.

Example

Receive instance details where:

instance.zone = https://www.googleapis.com/compute/v1/projects/project-123/zones/europe-west3-c

Then when trying to parse it with ProjectZoneName.parse(instance.zone) will cause the following exception:

ProjectZoneName.parse: formattedString not in valid format: Parameter "https://www.googleapis.com/compute/v1/projects/project-123/zones/europe-west3-c" must be in the form "projects/{project=*}/zones/{zone=*}"

Activity

  1. self-assigned this
    on Aug 24, 2018
  2. added
    api: computeIssues related to the Compute Engine API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Aug 24, 2018
  3. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Aug 27, 2018
  4. yihanzhen commented on Aug 27, 2018

    @yihanzhen
    Contributor

    @andreamlin I added priotity: p2 to remove the triage me label. Feel free to bump to p1 if you find it necessary.

  5. added a commit that references this issue on Dec 13, 2018
    8818cce
  6. added a commit that references this issue on Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: computeIssues related to the Compute Engine API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions