Skip to content

Commit

Permalink
Added monitoring metrics scope and monitored project resources. (#5218)
Browse files Browse the repository at this point in the history
* Added monitoring metrics scope and monitored project resources.

* Ran make upgrade-dcl

* Fixed indentation

* Copied tpgtools go.sum lines into mmv1 go.sum.

* Apply suggestions from code review

Co-authored-by: Scott Suarez <[email protected]>

* Attempted to fix strange downstream change in iam.go.

* Added missing custom serializer to GA version, upgraded DCL again.

* Update ID format so import is possible.

Co-authored-by: Scott Suarez <[email protected]>
Co-authored-by: Nathan Mckinley <[email protected]>
  • Loading branch information
3 people committed Sep 24, 2021
1 parent 126a23f commit 95ec371
Show file tree
Hide file tree
Showing 25 changed files with 750 additions and 21 deletions.
1 change: 1 addition & 0 deletions mmv1/third_party/terraform/utils/iam.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"log"
"reflect"
"sort"
"strings"
"time"

Expand Down
4 changes: 3 additions & 1 deletion mmv1/third_party/terraform/utils/provider.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ end # products.each do
"google_gke_hub_feature": resourceGkeHubFeature(),
"google_gke_hub_feature_membership": resourceGkeHubFeatureMembership(),
<% end -%>
"google_org_policy_policy": resourceOrgPolicyPolicy(),
"google_monitoring_metrics_scope": resourceMonitoringMetricsScope(),
"google_monitoring_monitored_project": resourceMonitoringMonitoredProject(),
"google_org_policy_policy": resourceOrgPolicyPolicy(),
"google_privateca_certificate_template": resourcePrivatecaCertificateTemplate(),
},
// ------------------------------------
Expand Down
94 changes: 94 additions & 0 deletions tpgtools/api/monitoring/beta/metrics_scope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
info:
title: Monitoring/MetricsScope
description: DCL Specification for the Monitoring MetricsScope resource
x-dcl-has-iam: false
paths:
get:
description: The function used to get information about a MetricsScope
parameters:
- name: MetricsScope
required: true
description: A full instance of a MetricsScope
apply:
description: The function used to apply information about a MetricsScope
parameters:
- name: MetricsScope
required: true
description: A full instance of a MetricsScope
components:
schemas:
MetricsScope:
title: MetricsScope
x-dcl-id: locations/global/metricsScopes/{{name}}
x-dcl-locations:
- global
type: object
required:
- name
properties:
createTime:
type: string
format: date-time
x-dcl-go-name: CreateTime
readOnly: true
description: Output only. The time when this `Metrics Scope` was created.
x-kubernetes-immutable: true
monitoredProjects:
type: array
x-dcl-go-name: MonitoredProjects
readOnly: true
description: Output only. The list of projects monitored by this `Metrics
Scope`.
x-kubernetes-immutable: true
x-dcl-send-empty: true
x-dcl-list-type: list
items:
type: object
x-dcl-go-type: MetricsScopeMonitoredProjects
properties:
createTime:
type: string
format: date-time
x-dcl-go-name: CreateTime
readOnly: true
description: Output only. The time when this `MonitoredProject` was
created.
x-kubernetes-immutable: true
name:
type: string
x-dcl-go-name: Name
readOnly: true
description: 'Immutable. The resource name of the `MonitoredProject`.
On input, the resource name includes the scoping project ID and
monitored project ID. On output, it contains the equivalent project
numbers. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`'
x-kubernetes-immutable: true
name:
type: string
x-dcl-go-name: Name
description: 'Immutable. The resource name of the Monitoring Metrics Scope.
On input, the resource name can be specified with the scoping project
ID or number. On output, the resource name is specified with the scoping
project number. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`'
x-kubernetes-immutable: true
updateTime:
type: string
format: date-time
x-dcl-go-name: UpdateTime
readOnly: true
description: Output only. The time when this `Metrics Scope` record was
last updated.
x-kubernetes-immutable: true
86 changes: 86 additions & 0 deletions tpgtools/api/monitoring/beta/monitored_project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
info:
title: Monitoring/MonitoredProject
description: DCL Specification for the Monitoring MonitoredProject resource
x-dcl-has-iam: false
paths:
get:
description: The function used to get information about a MonitoredProject
parameters:
- name: MonitoredProject
required: true
description: A full instance of a MonitoredProject
apply:
description: The function used to apply information about a MonitoredProject
parameters:
- name: MonitoredProject
required: true
description: A full instance of a MonitoredProject
delete:
description: The function used to delete a MonitoredProject
parameters:
- name: MonitoredProject
required: true
description: A full instance of a MonitoredProject
deleteAll:
description: The function used to delete all MonitoredProject
parameters:
- name: metricsscope
required: true
schema:
type: string
list:
description: The function used to list information about many MonitoredProject
parameters:
- name: metricsscope
required: true
schema:
type: string
components:
schemas:
MonitoredProject:
title: MonitoredProject
x-dcl-id: locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}}
x-dcl-locations:
- global
type: object
required:
- name
- metricsScope
properties:
createTime:
type: string
format: date-time
x-dcl-go-name: CreateTime
readOnly: true
description: Output only. The time when this `MonitoredProject` was created.
x-kubernetes-immutable: true
metricsScope:
type: string
x-dcl-go-name: MetricsScope
description: 'Required. The resource name of the existing Metrics Scope
that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}'
x-kubernetes-immutable: true
x-dcl-references:
- resource: Monitoring/MetricsScope
field: name
name:
type: string
x-dcl-go-name: Name
description: 'Immutable. The resource name of the `MonitoredProject`. On
input, the resource name includes the scoping project ID and monitored
project ID. On output, it contains the equivalent project numbers. Example:
`locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`'
x-kubernetes-immutable: true
94 changes: 94 additions & 0 deletions tpgtools/api/monitoring/metrics_scope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
info:
title: Monitoring/MetricsScope
description: DCL Specification for the Monitoring MetricsScope resource
x-dcl-has-iam: false
paths:
get:
description: The function used to get information about a MetricsScope
parameters:
- name: MetricsScope
required: true
description: A full instance of a MetricsScope
apply:
description: The function used to apply information about a MetricsScope
parameters:
- name: MetricsScope
required: true
description: A full instance of a MetricsScope
components:
schemas:
MetricsScope:
title: MetricsScope
x-dcl-id: locations/global/metricsScopes/{{name}}
x-dcl-locations:
- global
type: object
required:
- name
properties:
createTime:
type: string
format: date-time
x-dcl-go-name: CreateTime
readOnly: true
description: Output only. The time when this `Metrics Scope` was created.
x-kubernetes-immutable: true
monitoredProjects:
type: array
x-dcl-go-name: MonitoredProjects
readOnly: true
description: Output only. The list of projects monitored by this `Metrics
Scope`.
x-kubernetes-immutable: true
x-dcl-send-empty: true
x-dcl-list-type: list
items:
type: object
x-dcl-go-type: MetricsScopeMonitoredProjects
properties:
createTime:
type: string
format: date-time
x-dcl-go-name: CreateTime
readOnly: true
description: Output only. The time when this `MonitoredProject` was
created.
x-kubernetes-immutable: true
name:
type: string
x-dcl-go-name: Name
readOnly: true
description: 'Immutable. The resource name of the `MonitoredProject`.
On input, the resource name includes the scoping project ID and
monitored project ID. On output, it contains the equivalent project
numbers. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`'
x-kubernetes-immutable: true
name:
type: string
x-dcl-go-name: Name
description: 'Immutable. The resource name of the Monitoring Metrics Scope.
On input, the resource name can be specified with the scoping project
ID or number. On output, the resource name is specified with the scoping
project number. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`'
x-kubernetes-immutable: true
updateTime:
type: string
format: date-time
x-dcl-go-name: UpdateTime
readOnly: true
description: Output only. The time when this `Metrics Scope` record was
last updated.
x-kubernetes-immutable: true
86 changes: 86 additions & 0 deletions tpgtools/api/monitoring/monitored_project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
info:
title: Monitoring/MonitoredProject
description: DCL Specification for the Monitoring MonitoredProject resource
x-dcl-has-iam: false
paths:
get:
description: The function used to get information about a MonitoredProject
parameters:
- name: MonitoredProject
required: true
description: A full instance of a MonitoredProject
apply:
description: The function used to apply information about a MonitoredProject
parameters:
- name: MonitoredProject
required: true
description: A full instance of a MonitoredProject
delete:
description: The function used to delete a MonitoredProject
parameters:
- name: MonitoredProject
required: true
description: A full instance of a MonitoredProject
deleteAll:
description: The function used to delete all MonitoredProject
parameters:
- name: metricsscope
required: true
schema:
type: string
list:
description: The function used to list information about many MonitoredProject
parameters:
- name: metricsscope
required: true
schema:
type: string
components:
schemas:
MonitoredProject:
title: MonitoredProject
x-dcl-id: locations/global/metricsScopes/{{metrics_scope}}/projects/{{name}}
x-dcl-locations:
- global
type: object
required:
- name
- metricsScope
properties:
createTime:
type: string
format: date-time
x-dcl-go-name: CreateTime
readOnly: true
description: Output only. The time when this `MonitoredProject` was created.
x-kubernetes-immutable: true
metricsScope:
type: string
x-dcl-go-name: MetricsScope
description: 'Required. The resource name of the existing Metrics Scope
that will monitor this project. Example: locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}'
x-kubernetes-immutable: true
x-dcl-references:
- resource: Monitoring/MetricsScope
field: name
name:
type: string
x-dcl-go-name: Name
description: 'Immutable. The resource name of the `MonitoredProject`. On
input, the resource name includes the scoping project ID and monitored
project ID. On output, it contains the equivalent project numbers. Example:
`locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`'
x-kubernetes-immutable: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "{{id}}",
"parent": "organizations/{{org_id}}"
}
3 changes: 3 additions & 0 deletions tpgtools/api/monitoring/samples/basic.metrics_scope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "{{project}}"
}
4 changes: 4 additions & 0 deletions tpgtools/api/monitoring/samples/basic.monitored_project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "{{ref:basic.cloudresourcemanager.project.json:name}}",
"metricsScope": "{{ref:basic.metrics_scope.json:name}}"
}
Loading

0 comments on commit 95ec371

Please sign in to comment.