Skip to content

Commit 7c0c906

Browse files
committed
more complete examples
1 parent df95eac commit 7c0c906

96 files changed

Lines changed: 2880 additions & 426 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/examples/aggregate/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ func AggregateExtended() *diode.Aggregate {
6363
Slug: diode.String("example-slug"),
6464
Metadata: diode.Metadata{"source": "example"},
6565
},
66-
Metadata: diode.Metadata{"source": "example"},
66+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
6767
Description: diode.String("Example description"),
68+
Comments: diode.String("Example comments"),
6869
}
6970
}
7071

@@ -77,14 +78,22 @@ func AggregateExplicit() *diode.Aggregate {
7778
Slug: diode.String("example-slug"),
7879
Metadata: diode.Metadata{"source": "example"},
7980
},
80-
Metadata: diode.Metadata{"source": "example"},
81+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
8182
Description: diode.String("Example description"),
8283
Comments: diode.String("Example comments"),
8384
Tenant: &diode.Tenant{
8485
Name: diode.String("Example Name"),
8586
Slug: diode.String("example-slug"),
8687
Metadata: diode.Metadata{"source": "example"},
8788
},
89+
Owner: &diode.Owner{
90+
Name: diode.String("Example Name"),
91+
Group: &diode.OwnerGroup{
92+
Name: diode.String("Example Name"),
93+
Metadata: diode.Metadata{"source": "example"},
94+
},
95+
Metadata: diode.Metadata{"source": "example"},
96+
},
8897
Tags: []*diode.Tag{{Name: diode.String("production")}},
8998
}
9099
}

docs/examples/asn/main.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,37 @@ func ASNMinimal() *diode.ASN {
5353
func ASNExtended() *diode.ASN {
5454
return &diode.ASN{
5555
Asn: diode.Int64(64512),
56-
Metadata: diode.Metadata{"source": "example"},
56+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
5757
Description: diode.String("Example description"),
58+
Comments: diode.String("Example comments"),
5859
}
5960
}
6061

6162
// ASNExplicit Creates a ASN with fully nested objects and all common fields.
6263
func ASNExplicit() *diode.ASN {
6364
return &diode.ASN{
6465
Asn: diode.Int64(64512),
65-
Metadata: diode.Metadata{"source": "example"},
66+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
6667
Description: diode.String("Example description"),
6768
Comments: diode.String("Example comments"),
69+
Rir: &diode.RIR{
70+
Name: diode.String("Example Name"),
71+
Slug: diode.String("example-slug"),
72+
Metadata: diode.Metadata{"source": "example"},
73+
},
6874
Tenant: &diode.Tenant{
6975
Name: diode.String("Example Name"),
7076
Slug: diode.String("example-slug"),
7177
Metadata: diode.Metadata{"source": "example"},
7278
},
79+
Owner: &diode.Owner{
80+
Name: diode.String("Example Name"),
81+
Group: &diode.OwnerGroup{
82+
Name: diode.String("Example Name"),
83+
Metadata: diode.Metadata{"source": "example"},
84+
},
85+
Metadata: diode.Metadata{"source": "example"},
86+
},
7387
Tags: []*diode.Tag{{Name: diode.String("production")}},
7488
}
7589
}

docs/examples/asn_range/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ func ASNRangeExtended() *diode.ASNRange {
6969
},
7070
Start: diode.Int64(1),
7171
End: diode.Int64(1),
72-
Metadata: diode.Metadata{"source": "example"},
72+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
7373
Description: diode.String("Example description"),
74+
Comments: diode.String("Example comments"),
7475
}
7576
}
7677

@@ -86,14 +87,22 @@ func ASNRangeExplicit() *diode.ASNRange {
8687
},
8788
Start: diode.Int64(1),
8889
End: diode.Int64(1),
89-
Metadata: diode.Metadata{"source": "example"},
90+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
9091
Description: diode.String("Example description"),
9192
Comments: diode.String("Example comments"),
9293
Tenant: &diode.Tenant{
9394
Name: diode.String("Example Name"),
9495
Slug: diode.String("example-slug"),
9596
Metadata: diode.Metadata{"source": "example"},
9697
},
98+
Owner: &diode.Owner{
99+
Name: diode.String("Example Name"),
100+
Group: &diode.OwnerGroup{
101+
Name: diode.String("Example Name"),
102+
Metadata: diode.Metadata{"source": "example"},
103+
},
104+
Metadata: diode.Metadata{"source": "example"},
105+
},
97106
Tags: []*diode.Tag{{Name: diode.String("production")}},
98107
}
99108
}

docs/examples/cable/main.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,45 @@ func CableMinimal() *diode.Cable {
5151
// CableExtended Creates a Cable with common optional fields.
5252
func CableExtended() *diode.Cable {
5353
return &diode.Cable{
54-
Metadata: diode.Metadata{"source": "example"},
54+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
5555
Status: diode.String("connected"),
56-
Color: diode.String("0000ff"),
5756
Description: diode.String("Example description"),
57+
Color: diode.String("0000ff"),
58+
Type: diode.String("aoc"),
59+
Label: diode.String("Example Label"),
60+
Length: diode.Float64(1.0),
61+
LengthUnit: diode.String("cm"),
62+
Comments: diode.String("Example comments"),
63+
Profile: diode.String("breakout-1c4p-4c1p"),
5864
}
5965
}
6066

6167
// CableExplicit Creates a Cable with fully nested objects and all common fields.
6268
func CableExplicit() *diode.Cable {
6369
return &diode.Cable{
64-
Metadata: diode.Metadata{"source": "example"},
70+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
6571
Status: diode.String("connected"),
66-
Color: diode.String("0000ff"),
6772
Description: diode.String("Example description"),
73+
Color: diode.String("0000ff"),
6874
Comments: diode.String("Example comments"),
75+
Type: diode.String("aoc"),
76+
Label: diode.String("Example Label"),
77+
Length: diode.Float64(1.0),
78+
LengthUnit: diode.String("cm"),
79+
Profile: diode.String("breakout-1c4p-4c1p"),
6980
Tenant: &diode.Tenant{
7081
Name: diode.String("Example Name"),
7182
Slug: diode.String("example-slug"),
7283
Metadata: diode.Metadata{"source": "example"},
7384
},
85+
Owner: &diode.Owner{
86+
Name: diode.String("Example Name"),
87+
Group: &diode.OwnerGroup{
88+
Name: diode.String("Example Name"),
89+
Metadata: diode.Metadata{"source": "example"},
90+
},
91+
Metadata: diode.Metadata{"source": "example"},
92+
},
7493
Tags: []*diode.Tag{{Name: diode.String("production")}},
7594
}
7695
}

docs/examples/cable_path/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,19 @@ func CablePathMinimal() *diode.CablePath {
5151
// CablePathExtended Creates a CablePath with common optional fields.
5252
func CablePathExtended() *diode.CablePath {
5353
return &diode.CablePath{
54-
Metadata: diode.Metadata{"source": "example"},
54+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
55+
IsActive: diode.Bool(true),
56+
IsComplete: diode.Bool(true),
57+
IsSplit: diode.Bool(true),
5558
}
5659
}
5760

5861
// CablePathExplicit Creates a CablePath with fully nested objects and all common fields.
5962
func CablePathExplicit() *diode.CablePath {
6063
return &diode.CablePath{
61-
Metadata: diode.Metadata{"source": "example"},
64+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
65+
IsActive: diode.Bool(true),
66+
IsComplete: diode.Bool(true),
67+
IsSplit: diode.Bool(true),
6268
}
6369
}

docs/examples/cable_termination/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func CableTerminationExtended() *diode.CableTermination {
5959
Metadata: diode.Metadata{"source": "example"},
6060
},
6161
CableEnd: diode.String("A"),
62-
Metadata: diode.Metadata{"source": "example"},
62+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
6363
}
6464
}
6565

@@ -72,6 +72,6 @@ func CableTerminationExplicit() *diode.CableTermination {
7272
Metadata: diode.Metadata{"source": "example"},
7373
},
7474
CableEnd: diode.String("A"),
75-
Metadata: diode.Metadata{"source": "example"},
75+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
7676
}
7777
}

docs/examples/circuit/main.go

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@ func CircuitExtended() *diode.Circuit {
7373
Slug: diode.String("example-slug"),
7474
Metadata: diode.Metadata{"source": "example"},
7575
},
76-
Metadata: diode.Metadata{"source": "example"},
77-
Status: diode.String("active"),
78-
Description: diode.String("Example description"),
76+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
77+
Status: diode.String("active"),
78+
Description: diode.String("Example description"),
79+
CommitRate: diode.Int64(1),
80+
Distance: diode.Float64(1.0),
81+
DistanceUnit: diode.String("ft"),
82+
Comments: diode.String("Example comments"),
7983
}
8084
}
8185

@@ -94,15 +98,35 @@ func CircuitExplicit() *diode.Circuit {
9498
Color: diode.String("0000ff"),
9599
Metadata: diode.Metadata{"source": "example"},
96100
},
97-
Metadata: diode.Metadata{"source": "example"},
98-
Status: diode.String("active"),
99-
Description: diode.String("Example description"),
100-
Comments: diode.String("Example comments"),
101+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
102+
Status: diode.String("active"),
103+
Description: diode.String("Example description"),
104+
Comments: diode.String("Example comments"),
105+
CommitRate: diode.Int64(1),
106+
Distance: diode.Float64(1.0),
107+
DistanceUnit: diode.String("ft"),
108+
ProviderAccount: &diode.ProviderAccount{
109+
Provider: &diode.Provider{
110+
Name: diode.String("Example Name"),
111+
Slug: diode.String("example-slug"),
112+
Metadata: diode.Metadata{"source": "example"},
113+
},
114+
Account: diode.String("Example Account"),
115+
Metadata: diode.Metadata{"source": "example"},
116+
},
101117
Tenant: &diode.Tenant{
102118
Name: diode.String("Example Name"),
103119
Slug: diode.String("example-slug"),
104120
Metadata: diode.Metadata{"source": "example"},
105121
},
122+
Owner: &diode.Owner{
123+
Name: diode.String("Example Name"),
124+
Group: &diode.OwnerGroup{
125+
Name: diode.String("Example Name"),
126+
Metadata: diode.Metadata{"source": "example"},
127+
},
128+
Metadata: diode.Metadata{"source": "example"},
129+
},
106130
Tags: []*diode.Tag{{Name: diode.String("production")}},
107131
}
108132
}

docs/examples/circuit_group/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ func CircuitGroupExtended() *diode.CircuitGroup {
5555
return &diode.CircuitGroup{
5656
Name: diode.String("Example Name"),
5757
Slug: diode.String("example-slug"),
58-
Metadata: diode.Metadata{"source": "example"},
58+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
5959
Description: diode.String("Example description"),
60+
Comments: diode.String("Example comments"),
6061
}
6162
}
6263

@@ -65,14 +66,22 @@ func CircuitGroupExplicit() *diode.CircuitGroup {
6566
return &diode.CircuitGroup{
6667
Name: diode.String("Example Name"),
6768
Slug: diode.String("example-slug"),
68-
Metadata: diode.Metadata{"source": "example"},
69+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
6970
Description: diode.String("Example description"),
7071
Comments: diode.String("Example comments"),
7172
Tenant: &diode.Tenant{
7273
Name: diode.String("Example Name"),
7374
Slug: diode.String("example-slug"),
7475
Metadata: diode.Metadata{"source": "example"},
7576
},
77+
Owner: &diode.Owner{
78+
Name: diode.String("Example Name"),
79+
Group: &diode.OwnerGroup{
80+
Name: diode.String("Example Name"),
81+
Metadata: diode.Metadata{"source": "example"},
82+
},
83+
Metadata: diode.Metadata{"source": "example"},
84+
},
7685
Tags: []*diode.Tag{{Name: diode.String("production")}},
7786
}
7887
}

docs/examples/circuit_group_assignment/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ func CircuitGroupAssignmentExtended() *diode.CircuitGroupAssignment {
6161
Slug: diode.String("example-slug"),
6262
Metadata: diode.Metadata{"source": "example"},
6363
},
64-
Metadata: diode.Metadata{"source": "example"},
64+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
65+
Priority: diode.String("inactive"),
6566
}
6667
}
6768

@@ -73,7 +74,8 @@ func CircuitGroupAssignmentExplicit() *diode.CircuitGroupAssignment {
7374
Slug: diode.String("example-slug"),
7475
Metadata: diode.Metadata{"source": "example"},
7576
},
76-
Metadata: diode.Metadata{"source": "example"},
77+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
78+
Priority: diode.String("inactive"),
7779
Tags: []*diode.Tag{{Name: diode.String("production")}},
7880
}
7981
}

docs/examples/circuit_termination/main.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,14 @@ func CircuitTerminationExtended() *diode.CircuitTermination {
8080
},
8181
Metadata: diode.Metadata{"source": "example"},
8282
},
83-
TermSide: diode.String("A"),
84-
Metadata: diode.Metadata{"source": "example"},
85-
Description: diode.String("Example description"),
83+
TermSide: diode.String("A"),
84+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value"},
85+
Description: diode.String("Example description"),
86+
PortSpeed: diode.Int64(1),
87+
UpstreamSpeed: diode.Int64(1),
88+
XconnectId: diode.String("Example XconnectId"),
89+
PpInfo: diode.String("Example PpInfo"),
90+
MarkConnected: diode.Bool(true),
8691
}
8792
}
8893

@@ -105,9 +110,14 @@ func CircuitTerminationExplicit() *diode.CircuitTermination {
105110
Status: diode.String("active"),
106111
Metadata: diode.Metadata{"source": "example"},
107112
},
108-
TermSide: diode.String("A"),
109-
Metadata: diode.Metadata{"source": "example"},
110-
Description: diode.String("Example description"),
111-
Tags: []*diode.Tag{{Name: diode.String("production")}},
113+
TermSide: diode.String("A"),
114+
Metadata: diode.Metadata{"source": "example", "custom_key": "custom_value", "collected_at": "2024-01-15T10:30:00Z"},
115+
Description: diode.String("Example description"),
116+
PortSpeed: diode.Int64(1),
117+
UpstreamSpeed: diode.Int64(1),
118+
XconnectId: diode.String("Example XconnectId"),
119+
PpInfo: diode.String("Example PpInfo"),
120+
MarkConnected: diode.Bool(true),
121+
Tags: []*diode.Tag{{Name: diode.String("production")}},
112122
}
113123
}

0 commit comments

Comments
 (0)