Skip to content

Commit 4c0b1d7

Browse files
authored
[CDTOOL-1070] feat(logging): Add support for 'processing region' attribute. (#1491)
All logging commands (create/describe/list/update) now support the 'processing region' attribute. All Submissions: * [X] Have you followed the guidelines in our Contributing document? * [X] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change? <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### New Feature Submissions: * [X] Does your submission pass tests? ### Changes to Core Features: * [ ] Have you added an explanation of what your changes do and why you'd like us to include them? * [ ] Have you written new tests for your core changes, as applicable? * [ ] Have you successfully run tests with your changes locally? ### User Impact * [ ] What is the user impact of this change? ### Are there any considerations that need to be addressed for release? <!-- Any breaking changes, etc -->
1 parent 3fcc56b commit 4c0b1d7

160 files changed

Lines changed: 774 additions & 163 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.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- feat(config-store): Allow for dynamic limits on Config Store entry lengths [#1485](https://github.com/fastly/cli/pull/1485)
1010
- feat(backend): Add support for 'prefer IPv6' attribute. ([#1487](https://github.com/fastly/cli/pull/1487))
1111
- feat(tools/domain): add `suggest` and `status` domain tools endpoints ([#1482](https://github.com/fastly/cli/pull/1482))
12+
- feat(logging): Add support for 'processing region' attribute. ([#1491](https://github.com/fastly/cli/pull/1491))
1213

1314
### Bug fixes:
1415
- fix(sso): Don't display the token after authentication. ([#1490](https://github.com/fastly/cli/pull/1490))

pkg/commands/logging/azureblob/azureblob_integration_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ func listBlobStoragesOK(i *fastly.ListBlobStoragesInput) ([]*fastly.BlobStorage,
327327
Placement: fastly.ToPointer("none"),
328328
ResponseCondition: fastly.ToPointer("Prevent default logging"),
329329
CompressionCodec: fastly.ToPointer("zstd"),
330+
ProcessingRegion: fastly.ToPointer("us"),
330331
},
331332
{
332333
ServiceID: fastly.ToPointer(i.ServiceID),
@@ -345,6 +346,7 @@ func listBlobStoragesOK(i *fastly.ListBlobStoragesInput) ([]*fastly.BlobStorage,
345346
Placement: fastly.ToPointer("none"),
346347
PublicKey: fastly.ToPointer(pgpPublicKey()),
347348
CompressionCodec: fastly.ToPointer("zstd"),
349+
ProcessingRegion: fastly.ToPointer("us"),
348350
},
349351
}, nil
350352
}
@@ -385,6 +387,7 @@ Version: 1
385387
Public key: `+pgpPublicKey()+`
386388
File max bytes: 0
387389
Compression codec: zstd
390+
Processing region: us
388391
BlobStorage 2/2
389392
Service ID: 123
390393
Version: 1
@@ -404,6 +407,7 @@ Version: 1
404407
Public key: `+pgpPublicKey()+`
405408
File max bytes: 0
406409
Compression codec: zstd
410+
Processing region: us
407411
`) + "\n\n"
408412

409413
func getBlobStorageOK(i *fastly.GetBlobStorageInput) (*fastly.BlobStorage, error) {
@@ -423,6 +427,7 @@ func getBlobStorageOK(i *fastly.GetBlobStorageInput) (*fastly.BlobStorage, error
423427
MessageType: fastly.ToPointer("classic"),
424428
TimestampFormat: fastly.ToPointer("%Y-%m-%dT%H:%M:%S.000"),
425429
Placement: fastly.ToPointer("none"),
430+
ProcessingRegion: fastly.ToPointer("us"),
426431
PublicKey: fastly.ToPointer(pgpPublicKey()),
427432
CompressionCodec: fastly.ToPointer("zstd"),
428433
}, nil
@@ -445,6 +450,7 @@ Name: logs
445450
Path: /logs
446451
Period: 3600
447452
Placement: none
453+
Processing region: us
448454
Public key: `+pgpPublicKey()+`
449455
Response condition: Prevent default logging
450456
SAS token: token

pkg/commands/logging/azureblob/azureblob_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestCreateBlobStorageInput(t *testing.T) {
5353
ResponseCondition: fastly.ToPointer("Prevent default logging"),
5454
TimestampFormat: fastly.ToPointer("%Y-%m-%dT%H:%M:%S.000"),
5555
Placement: fastly.ToPointer("none"),
56+
ProcessingRegion: fastly.ToPointer("eu"),
5657
PublicKey: fastly.ToPointer(pgpPublicKey()),
5758
CompressionCodec: fastly.ToPointer("zstd"),
5859
},
@@ -129,6 +130,7 @@ func TestUpdateBlobStorageInput(t *testing.T) {
129130
MessageType: fastly.ToPointer("new8"),
130131
TimestampFormat: fastly.ToPointer("new9"),
131132
Placement: fastly.ToPointer("new10"),
133+
ProcessingRegion: fastly.ToPointer("eu"),
132134
PublicKey: fastly.ToPointer("new11"),
133135
CompressionCodec: fastly.ToPointer("new12"),
134136
},
@@ -276,6 +278,7 @@ func createCommandAll() *azureblob.CreateCommand {
276278
ResponseCondition: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "Prevent default logging"},
277279
TimestampFormat: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "%Y-%m-%dT%H:%M:%S.000"},
278280
Placement: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "none"},
281+
ProcessingRegion: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "eu"},
279282
MessageType: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "classic"},
280283
PublicKey: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: pgpPublicKey()},
281284
CompressionCodec: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "zstd"},
@@ -364,6 +367,7 @@ func updateCommandAll() *azureblob.UpdateCommand {
364367
MessageType: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new8"},
365368
TimestampFormat: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new9"},
366369
Placement: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new10"},
370+
ProcessingRegion: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "eu"},
367371
PublicKey: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new11"},
368372
CompressionCodec: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new12"},
369373
}

pkg/commands/logging/azureblob/create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type CreateCommand struct {
4040
ResponseCondition argparser.OptionalString
4141
TimestampFormat argparser.OptionalString
4242
Placement argparser.OptionalString
43+
ProcessingRegion argparser.OptionalString
4344
PublicKey argparser.OptionalString
4445
FileMaxBytes argparser.OptionalInt
4546
CompressionCodec argparser.OptionalString
@@ -79,6 +80,7 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman
7980
common.Path(c.CmdClause, &c.Path)
8081
common.Period(c.CmdClause, &c.Period)
8182
common.Placement(c.CmdClause, &c.Placement)
83+
common.ProcessingRegion(c.CmdClause, &c.ProcessingRegion, "Azure Blob Storage")
8284
common.PublicKey(c.CmdClause, &c.PublicKey)
8385
common.ResponseCondition(c.CmdClause, &c.ResponseCondition)
8486
c.CmdClause.Flag("sas-token", "The Azure shared access signature providing write access to the blob service objects. Be sure to update your token before it expires or the logging functionality will not work").Action(c.SASToken.Set).StringVar(&c.SASToken.Value)
@@ -151,6 +153,9 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f
151153
if c.Placement.WasSet {
152154
input.Placement = &c.Placement.Value
153155
}
156+
if c.ProcessingRegion.WasSet {
157+
input.ProcessingRegion = &c.ProcessingRegion.Value
158+
}
154159
if c.PublicKey.WasSet {
155160
input.PublicKey = &c.PublicKey.Value
156161
}

pkg/commands/logging/azureblob/describe.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error {
107107
"Path": fastly.ToValue(o.Path),
108108
"Period": fastly.ToValue(o.Period),
109109
"Placement": fastly.ToValue(o.Placement),
110+
"Processing region": fastly.ToValue(o.ProcessingRegion),
110111
"Public key": fastly.ToValue(o.PublicKey),
111112
"Response condition": fastly.ToValue(o.ResponseCondition),
112113
"SAS token": fastly.ToValue(o.SASToken),

pkg/commands/logging/azureblob/list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error {
129129
fmt.Fprintf(out, "\t\tPublic key: %s\n", fastly.ToValue(azureblob.PublicKey))
130130
fmt.Fprintf(out, "\t\tFile max bytes: %d\n", fastly.ToValue(azureblob.FileMaxBytes))
131131
fmt.Fprintf(out, "\t\tCompression codec: %s\n", fastly.ToValue(azureblob.CompressionCodec))
132+
fmt.Fprintf(out, "\t\tProcessing region: %s\n", fastly.ToValue(azureblob.ProcessingRegion))
132133
}
133134
fmt.Fprintln(out)
134135

pkg/commands/logging/azureblob/update.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type UpdateCommand struct {
4040
ResponseCondition argparser.OptionalString
4141
TimestampFormat argparser.OptionalString
4242
Placement argparser.OptionalString
43+
ProcessingRegion argparser.OptionalString
4344
PublicKey argparser.OptionalString
4445
FileMaxBytes argparser.OptionalInt
4546
CompressionCodec argparser.OptionalString
@@ -82,6 +83,7 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman
8283
common.Path(c.CmdClause, &c.Path)
8384
common.Period(c.CmdClause, &c.Period)
8485
common.Placement(c.CmdClause, &c.Placement)
86+
common.ProcessingRegion(c.CmdClause, &c.ProcessingRegion, "Azure Blob Storage")
8587
common.PublicKey(c.CmdClause, &c.PublicKey)
8688
common.ResponseCondition(c.CmdClause, &c.ResponseCondition)
8789
c.CmdClause.Flag("sas-token", "The Azure shared access signature providing write access to the blob service objects. Be sure to update your token before it expires or the logging functionality will not work").Action(c.SASToken.Set).StringVar(&c.SASToken.Value)
@@ -149,6 +151,9 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f
149151
if c.Placement.WasSet {
150152
input.Placement = &c.Placement.Value
151153
}
154+
if c.ProcessingRegion.WasSet {
155+
input.ProcessingRegion = &c.ProcessingRegion.Value
156+
}
152157
if c.PublicKey.WasSet {
153158
input.PublicKey = &c.PublicKey.Value
154159
}

pkg/commands/logging/bigquery/bigquery_integration_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ func listBigQueriesOK(i *fastly.ListBigQueriesInput) ([]*fastly.BigQuery, error)
300300
Template: fastly.ToPointer("%Y%m%d"),
301301
Placement: fastly.ToPointer("none"),
302302
ResponseCondition: fastly.ToPointer("Prevent default logging"),
303+
ProcessingRegion: fastly.ToPointer("us"),
303304
},
304305
{
305306
ServiceID: fastly.ToPointer(i.ServiceID),
@@ -315,6 +316,7 @@ func listBigQueriesOK(i *fastly.ListBigQueriesInput) ([]*fastly.BigQuery, error)
315316
Template: fastly.ToPointer("%Y%m%d"),
316317
Placement: fastly.ToPointer("none"),
317318
ResponseCondition: fastly.ToPointer("Prevent default logging"),
319+
ProcessingRegion: fastly.ToPointer("us"),
318320
},
319321
}, nil
320322
}
@@ -351,6 +353,7 @@ Version: 1
351353
Response condition: Prevent default logging
352354
Placement: none
353355
Format version: 0
356+
Processing region: us
354357
BigQuery 2/2
355358
Service ID: 123
356359
Version: 1
@@ -366,6 +369,7 @@ Version: 1
366369
Response condition: Prevent default logging
367370
Placement: none
368371
Format version: 0
372+
Processing region: us
369373
`) + "\n\n"
370374

371375
func getBigQueryOK(i *fastly.GetBigQueryInput) (*fastly.BigQuery, error) {
@@ -383,6 +387,7 @@ func getBigQueryOK(i *fastly.GetBigQueryInput) (*fastly.BigQuery, error) {
383387
Template: fastly.ToPointer("%Y%m%d"),
384388
Placement: fastly.ToPointer("none"),
385389
ResponseCondition: fastly.ToPointer("Prevent default logging"),
390+
ProcessingRegion: fastly.ToPointer("us"),
386391
}, nil
387392
}
388393

@@ -397,6 +402,7 @@ Format: %h %l %u %t "%r" %>s %b
397402
Format version: 0
398403
Name: logs
399404
Placement: none
405+
Processing region: us
400406
Project ID: my-project
401407
Response condition: Prevent default logging
402408
Secret key: -----BEGIN RSA PRIVATE KEY-----MIIEogIBAAKCA

pkg/commands/logging/bigquery/bigquery_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestCreateBigQueryInput(t *testing.T) {
5353
Format: fastly.ToPointer(`%h %l %u %t "%r" %>s %b`),
5454
ResponseCondition: fastly.ToPointer("Prevent default logging"),
5555
Placement: fastly.ToPointer("none"),
56+
ProcessingRegion: fastly.ToPointer("eu"),
5657
FormatVersion: fastly.ToPointer(2),
5758
},
5859
},
@@ -138,6 +139,7 @@ func TestUpdateBigQueryInput(t *testing.T) {
138139
Template: fastly.ToPointer("new7"),
139140
ResponseCondition: fastly.ToPointer("new8"),
140141
Placement: fastly.ToPointer("new9"),
142+
ProcessingRegion: fastly.ToPointer("eu"),
141143
Format: fastly.ToPointer("new10"),
142144
FormatVersion: fastly.ToPointer(3),
143145
},
@@ -269,6 +271,7 @@ func createCommandAll() *bigquery.CreateCommand {
269271
Template: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "template"},
270272
ResponseCondition: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "Prevent default logging"},
271273
Placement: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "none"},
274+
ProcessingRegion: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "eu"},
272275
Format: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: `%h %l %u %t "%r" %>s %b`},
273276
FormatVersion: argparser.OptionalInt{Optional: argparser.Optional{WasSet: true}, Value: 2},
274277
}
@@ -352,6 +355,7 @@ func updateCommandAll() *bigquery.UpdateCommand {
352355
Template: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new7"},
353356
ResponseCondition: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new8"},
354357
Placement: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new9"},
358+
ProcessingRegion: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "eu"},
355359
Format: argparser.OptionalString{Optional: argparser.Optional{WasSet: true}, Value: "new10"},
356360
FormatVersion: argparser.OptionalInt{Optional: argparser.Optional{WasSet: true}, Value: 3},
357361
}

pkg/commands/logging/bigquery/create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type CreateCommand struct {
3232
Format argparser.OptionalString
3333
FormatVersion argparser.OptionalInt
3434
Placement argparser.OptionalString
35+
ProcessingRegion argparser.OptionalString
3536
ProjectID argparser.OptionalString
3637
ResponseCondition argparser.OptionalString
3738
SecretKey argparser.OptionalString
@@ -68,6 +69,7 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman
6869
common.FormatVersion(c.CmdClause, &c.FormatVersion)
6970
c.CmdClause.Flag("name", "The name of the BigQuery logging object. Used as a primary key for API access").Short('n').Action(c.EndpointName.Set).StringVar(&c.EndpointName.Value)
7071
common.Placement(c.CmdClause, &c.Placement)
72+
common.ProcessingRegion(c.CmdClause, &c.ProcessingRegion, "BigQuery")
7173
c.CmdClause.Flag("project-id", "Your Google Cloud Platform project ID").Action(c.ProjectID.Set).StringVar(&c.ProjectID.Value)
7274
common.ResponseCondition(c.CmdClause, &c.ResponseCondition)
7375
c.CmdClause.Flag("secret-key", "Your Google Cloud Platform account secret key. The private_key field in your service account authentication JSON.").Action(c.SecretKey.Set).StringVar(&c.SecretKey.Value)
@@ -114,6 +116,9 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f
114116
if c.Placement.WasSet {
115117
input.Placement = &c.Placement.Value
116118
}
119+
if c.ProcessingRegion.WasSet {
120+
input.ProcessingRegion = &c.ProcessingRegion.Value
121+
}
117122
if c.ProjectID.WasSet {
118123
input.ProjectID = &c.ProjectID.Value
119124
}

0 commit comments

Comments
 (0)