Skip to content

Commit

Permalink
add fields to note
Browse files Browse the repository at this point in the history
  • Loading branch information
emilymye committed May 25, 2020
1 parent 358e3b8 commit 59f5fc3
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
59 changes: 58 additions & 1 deletion products/containeranalysis/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ objects:
base_url: projects/{{project}}/notes?noteId={{name}}
self_link: projects/{{project}}/notes/{{name}}
update_verb: :PATCH
update_mask: true
description: |
Provides a detailed description of a Note.
A Container Analysis note is a high-level piece of metadata that
describes a type of analysis that can be done for a resource.
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation': 'https://cloud.google.com/container-analysis/'
Expand All @@ -42,6 +44,61 @@ objects:
The name of the note.
required: true
input: true
- !ruby/object:Api::Type::String
name: shortDescription
description: |
A one sentence description of the note.
- !ruby/object:Api::Type::String
name: longDescription
description: |
A detailed description of the note
- !ruby/object:Api::Type::Enum
name: 'kind'
description: |
The type of any
values:
- NOTE_KIND_UNSPECIFIED
- VULNERABILITY
- BUILD
- IMAGE
- PACKAGE
- DEPLOYMENT
- DISCOVERY
- ATTESTATION
- UPGRADE
output: true
- !ruby/object:Api::Type::Array
name: relatedUrl
description: |
URLs associated with this note and related metadata.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: url
description: |
Specific URL associated with the resource.
required: true
- !ruby/object:Api::Type::String
name: label
description: |
Label to describe usage of the URL
- !ruby/object:Api::Type::Time
name: expirationTime
description: |
Time of expiration for this note. Leave empty if note does not expire.
- !ruby/object:Api::Type::Time
name: createTime
description: The time this note was created.
output: true
- !ruby/object:Api::Type::Time
name: updateTime
description: The time this note was last updated.
output: true
- !ruby/object:Api::Type::Array
name: relatedNoteNames
description: |
Names of other notes related to this note.
item_type: Api::Type::String
- !ruby/object:Api::Type::NestedObject
name: attestationAuthority
description: |
Expand Down
13 changes: 11 additions & 2 deletions products/containeranalysis/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,27 @@ overrides: !ruby/object:Overrides::ResourceOverrides
id_format: "projects/{{project}}/notes/{{name}}"
import_format: ["projects/{{project}}/notes/{{name}}"]
custom_code: !ruby/object:Provider::Terraform::CustomCode
pre_update: 'templates/terraform/pre_update/containeranalysis_note.erb'
# pre_update: 'templates/terraform/pre_update/containeranalysis_note.erb'
encoder: templates/terraform/encoders/containeranalysis_attestation_field_name.go.erb
decoder: templates/terraform/decoders/containeranalysis_attestation_field_name.go.erb
examples:
- !ruby/object:Provider::Terraform::Examples
name: "container_analysis_note_basic"
primary_resource_id: "note"
vars:
note_name: "test-attestor-note"
note_name: "attestor-note"
- !ruby/object:Provider::Terraform::Examples
name: "container_analysis_note_attestation_full"
primary_resource_id: "note"
vars:
note_name: "attestor-note"
properties:
name: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
relatedUrl: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true
relatedNoteNames: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true

# This is for copying files over
files: !ruby/object:Provider::Config::Files
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "google_container_analysis_note" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]["note_name"] %>"

short_description = "test note"
long_description = "a longer description of test note"
expiration_time = "2120-10-02T15:01:23.045123456Z"

related_url {
url = "some.url"
label = "foo"
}

related_url {
url = "google.com"
}

attestation_authority {
hint {
human_readable_name = "Attestor Note"
}
}
}

0 comments on commit 59f5fc3

Please sign in to comment.