Skip to content

Commit

Permalink
[DM] interconnect: refactoring (#196)
Browse files Browse the repository at this point in the history
#182

- Added version, links to docs
- Switched to using type provider
- Added support for cross-project resource creation
- Fixed resource names
- Updateed/added fields: "linkType", "requestedLinkCount",
"interconnectType"
  • Loading branch information
bohdanyurov-gl authored and ocsig committed Jul 11, 2019
1 parent 2dfa182 commit 3552b32
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
14 changes: 10 additions & 4 deletions dm/templates/interconnect/interconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@

def generate_config(context):
""" Entry point for the deployment resources. """

properties = context.properties
name = properties.get('name', context.env['name'])
project_id = properties.get('project', context.env['project'])

resources = []
intercon = {
'name': context.env['name'],
'type': 'compute.v1.interconnects',
# https://cloud.google.com/compute/docs/reference/rest/v1/interconnects
'type': 'gcp-types/compute-v1:interconnects',
'properties':
{
'name':
context.properties.get('name', context.env['name']),
'project': project_id,
'name': name,
'customerName':
context.properties['customerName'],
'interconnectType':
Expand Down Expand Up @@ -56,7 +62,7 @@ def generate_config(context):
[
{
'name': 'name',
'value': context.env['name']
'value': name
},
{
'name': 'selfLink',
Expand Down
24 changes: 16 additions & 8 deletions dm/templates/interconnect/interconnect.py.schema
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
info:
title: Interconnect (Dedicated)
author: Sourced Group Inc.
version: 1.0.0
description: |
Supports creation of an Interconnect resource.
For more information on this resource:
https://cloud.google.com/compute/docs/reference/rest/v1/interconnects.

APIs endpoints used by this template:
- gcp-types/compute-v1:interconnects =>
https://cloud.google.com/compute/docs/reference/rest/v1/interconnects

imports:
- path: interconnect.py

Expand All @@ -32,6 +37,13 @@ required:
- requestedLinkCount

properties:
name:
type: string
description: The name of the Interconnect resource. Resource name would be used if omitted.
project:
type: string
description: |
The project ID of the project containing the instance.
adminEnabled:
type: boolean
description: |
Expand All @@ -55,7 +67,6 @@ properties:
enum:
- DEDICATED
- PARTNER
- PARTNER_PROVIDER
linkType:
type: string
description: |
Expand All @@ -64,14 +75,11 @@ properties:
allowed for a dedicated Interconnect. Options: Ethernet_10G_LR.
enum:
- LINK_TYPE_ETHERNET_10G_LR
location:
type: string
- LINK_TYPE_ETHERNET_100G_LR
requestedLinkCount:
type: number
description: |
The URL of the InterconnectLocation object that defines where the
connection is to be provisioned.
name:
type: string
description: The Interconnect name.
Target number of physical links in the link bundle, as requested by the customer.
location:
type: string
description: |
Expand Down

0 comments on commit 3552b32

Please sign in to comment.