-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotifications-client.go
596 lines (481 loc) · 24.4 KB
/
notifications-client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
// Copyright 2024 Coralogix Ltd.
//
// 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
//
// https://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.
package cxsdk
import (
"context"
"github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/notification_center/common"
commonv1 "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/notification_center/common/v1"
connectores "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/notification_center/connectors/v1"
notifications "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/notification_center/notifications/v1"
presets "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/notification_center/presets/v1"
)
// CreateConnectorRequest represents a request to create a connector.
type CreateConnectorRequest = connectores.CreateConnectorRequest
// CreateConnectorResponse represents a response to create a connector.
type CreateConnectorResponse = connectores.CreateConnectorResponse
// ReplaceConnectorRequest represents a request to replace a connector.
type ReplaceConnectorRequest = connectores.ReplaceConnectorRequest
// ReplaceConnectorResponse represents a response to replace a connector.
type ReplaceConnectorResponse = connectores.ReplaceConnectorResponse
// DeleteConnectorRequest represents a request to delete a connector.
type DeleteConnectorRequest = connectores.DeleteConnectorRequest
// DeleteConnectorResponse represents a response to delete a connector.
type DeleteConnectorResponse = connectores.DeleteConnectorResponse
// GetConnectorRequest represents a request to get a connector.
type GetConnectorRequest = connectores.GetConnectorRequest
// GetConnectorResponse represents a response to get a connector.
type GetConnectorResponse = connectores.GetConnectorResponse
// ListConnectorsRequest represents a request to list connectors.
type ListConnectorsRequest = connectores.ListConnectorsRequest
// ListConnectorsResponse represents a response to list connectors.
type ListConnectorsResponse = connectores.ListConnectorsResponse
// BatchGetConnectorsRequest represents a request to batch get connectors.
type BatchGetConnectorsRequest = connectores.BatchGetConnectorsRequest
// BatchGetConnectorsResponse represents a response to batch get connectors.
type BatchGetConnectorsResponse = connectores.BatchGetConnectorsResponse
// GetConnectorTypeSummariesRequest represents a request to get connector type summaries.
type GetConnectorTypeSummariesRequest = connectores.GetConnectorTypeSummariesRequest
// GetConnectorTypeSummariesResponse represents a response to get connector type summaries.
type GetConnectorTypeSummariesResponse = connectores.GetConnectorTypeSummariesResponse
// Connector represents a connector.
type Connector = connectores.Connector
// ConnectorConfig represents a connector configuration.
type ConnectorConfig = connectores.ConnectorConfig
// EntityTypeConfigOverrides represents a connector configuration overrides.
type EntityTypeConfigOverrides = connectores.EntityTypeConfigOverrides
// ConnectorConfigField represents a connector configuration field.
type ConnectorConfigField = commonv1.ConnectorConfigField
// ConnectorType is a connector type.
type ConnectorType = common.ConnectorType
// PresetIdentifier is a preset identifier.
type PresetIdentifier = presets.PresetIdentifier
// PresetIdentifierIDValue is a preset identifier user id value.
type PresetIdentifierIDValue = presets.PresetIdentifier_UserFacingId
// ConnectorType values.
const (
ConnectorTypeUnSpecified = common.ConnectorType_CONNECTOR_TYPE_UNSPECIFIED
ConnectorTypeSlack = common.ConnectorType_SLACK
ConnectorTypeGenericHTTPS = common.ConnectorType_GENERIC_HTTPS
ConnectorTypePagerDuty = common.ConnectorType_PAGERDUTY
)
// CreateCustomPresetRequest is a request to create a custom preset.
type CreateCustomPresetRequest = presets.CreateCustomPresetRequest
// CreateCustomPresetResponse is a response to create a custom preset.
type CreateCustomPresetResponse = presets.CreateCustomPresetResponse
// ReplaceCustomPresetRequest is a request to replace a custom preset.
type ReplaceCustomPresetRequest = presets.ReplaceCustomPresetRequest
// ReplaceCustomPresetResponse is a response to replace a custom preset.
type ReplaceCustomPresetResponse = presets.ReplaceCustomPresetResponse
// DeleteCustomPresetRequest is a request to delete a custom preset.
type DeleteCustomPresetRequest = presets.DeleteCustomPresetRequest
// DeleteCustomPresetResponse is a response to delete a custom preset.
type DeleteCustomPresetResponse = presets.DeleteCustomPresetResponse
// SetCustomPresetAsDefaultRequest is a request to set a custom preset as default.
type SetCustomPresetAsDefaultRequest = presets.SetCustomPresetAsDefaultRequest
// SetCustomPresetAsDefaultResponse is a response to set a custom preset as default.
type SetCustomPresetAsDefaultResponse = presets.SetCustomPresetAsDefaultResponse
// GetPresetRequest is a request to get a preset.
type GetPresetRequest = presets.GetPresetRequest
// GetPresetResponse is a response to get a preset.
type GetPresetResponse = presets.GetPresetResponse
// ListPresetSummariesRequest is a request to list preset summaries.
type ListPresetSummariesRequest = presets.ListPresetSummariesRequest
// ListPresetSummariesResponse is a response to list preset summaries.
type ListPresetSummariesResponse = presets.ListPresetSummariesResponse
// BatchGetPresetsRequest is a request to batch get presets.
type BatchGetPresetsRequest = presets.BatchGetPresetsRequest
// BatchGetPresetsResponse is a response to batch get presets.
type BatchGetPresetsResponse = presets.BatchGetPresetsResponse
// GetDefaultPresetSummaryRequest is a request to get the default preset summary.
type GetDefaultPresetSummaryRequest = presets.GetDefaultPresetSummaryRequest
// GetDefaultPresetSummaryResponse is a response to get the default preset summary.
type GetDefaultPresetSummaryResponse = presets.GetDefaultPresetSummaryResponse
// GetSystemDefaultPresetSummaryRequest is a request to get the system default preset summary.
type GetSystemDefaultPresetSummaryRequest = presets.GetSystemDefaultPresetSummaryRequest
// GetSystemDefaultPresetSummaryResponse is a response to get the system default preset summary.
type GetSystemDefaultPresetSummaryResponse = presets.GetSystemDefaultPresetSummaryResponse
// Preset represents a preset.
type Preset = presets.Preset
// ConfigOverrides is a configuration override.
type ConfigOverrides = common.ConfigOverrides
// ConditionType is a condition type.
type ConditionType = common.ConditionType
// ConditionTypeMatchEntityType is a match entity type condition type.
type ConditionTypeMatchEntityType = common.ConditionType_MatchEntityType
// MatchEntityTypeCondition is a match entity type condition.
type MatchEntityTypeCondition = common.MatchEntityTypeCondition
// ConditionTypeMatchEntityTypeAndSubType is a match entity type and sub-type condition type.
type ConditionTypeMatchEntityTypeAndSubType = common.ConditionType_MatchEntityTypeAndSubType
// MatchEntityTypeAndSubTypeCondition is a match entity type and sub-type condition.
type MatchEntityTypeAndSubTypeCondition = common.MatchEntityTypeAndSubTypeCondition
// PresetType is a preset type.
type PresetType = presets.PresetType
// PresetType values.
const (
PresetTypeUnspecified = presets.PresetType_PRESET_TYPE_UNSPECIFIED
PresetTypeSystem = presets.PresetType_SYSTEM
PresetTypeCustom = presets.PresetType_CUSTOM
)
// MessageConfig is a message configuration.
type MessageConfig = common.MessageConfig
// MessageConfigField is a message configuration field.
type MessageConfigField = commonv1.MessageConfigField
// TestConnectorConfigRequest is a request to test a connector configuration.
type TestConnectorConfigRequest = notifications.TestConnectorConfigRequest
// TestConnectorConfigResponse is a response to test a connector configuration.
type TestConnectorConfigResponse = notifications.TestConnectorConfigResponse
// TestExistingConnectorRequest is a request to test an existing connector.
type TestExistingConnectorRequest = notifications.TestExistingConnectorRequest
// TestExistingConnectorResponse is a response to test an existing connector.
type TestExistingConnectorResponse = notifications.TestExistingConnectorResponse
// TestPresetConfigRequest is a request to test a preset configuration.
type TestPresetConfigRequest = notifications.TestPresetConfigRequest
// TestPresetConfigResponse is a response to test a preset configuration.
type TestPresetConfigResponse = notifications.TestPresetConfigResponse
// TestTemplateRenderRequest is a request to test a template rendering.
type TestTemplateRenderRequest = notifications.TestTemplateRenderRequest
// TestTemplateRenderResponse is a response to test a template rendering.
type TestTemplateRenderResponse = notifications.TestTemplateRenderResponse
const notificationsFeatureGroupID = "notifications"
// RPC names.
const (
ConnectorsCreateRPC = connectores.ConnectorsService_CreateConnector_FullMethodName
ConnectorsReplaceRPC = connectores.ConnectorsService_ReplaceConnector_FullMethodName
ConnectorsDeleteRPC = connectores.ConnectorsService_DeleteConnector_FullMethodName
ConnectorsGetRPC = connectores.ConnectorsService_GetConnector_FullMethodName
ConnectorsListRPC = connectores.ConnectorsService_ListConnectors_FullMethodName
ConnectorsBatchGetRPC = connectores.ConnectorsService_BatchGetConnectors_FullMethodName
ConnectorsGetConnectorTypeSummariesRPC = connectores.ConnectorsService_GetConnectorTypeSummaries_FullMethodName
PresetsCreateRPC = presets.PresetsService_CreateCustomPreset_FullMethodName
PresetsReplaceRPC = presets.PresetsService_ReplaceCustomPreset_FullMethodName
PresetsDeleteRPC = presets.PresetsService_DeleteCustomPreset_FullMethodName
PresetsSetAsDefaultRPC = presets.PresetsService_SetCustomPresetAsDefault_FullMethodName
PresetsGetRPC = presets.PresetsService_GetPreset_FullMethodName
PresetsListRPC = presets.PresetsService_ListPresetSummaries_FullMethodName
PresetsBatchGetRPC = presets.PresetsService_BatchGetPresets_FullMethodName
PresetsGetDefaultRPC = presets.PresetsService_GetDefaultPresetSummary_FullMethodName
PresetsGetSystemDefaultRPC = presets.PresetsService_GetSystemDefaultPresetSummary_FullMethodName
TestingTestConnectorConfigRPC = notifications.TestingService_TestConnectorConfig_FullMethodName
TestingTestExistingConnectorRPC = notifications.TestingService_TestExistingConnector_FullMethodName
TestingTestPresetConfigRPC = notifications.TestingService_TestPresetConfig_FullMethodName
TestingTestTemplateRenderRPC = notifications.TestingService_TestTemplateRender_FullMethodName
)
// NotificationsClient is a client for the Coralogix Notifications API.
type NotificationsClient struct {
callPropertiesCreator *CallPropertiesCreator
}
// CreateConnector creates a new connector.
func (c NotificationsClient) CreateConnector(ctx context.Context, req *CreateConnectorRequest) (*CreateConnectorResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.CreateConnector(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsCreateRPC, notificationsFeatureGroupID)
}
return response, nil
}
// ReplaceConnector replaces a connector.
func (c NotificationsClient) ReplaceConnector(ctx context.Context, req *ReplaceConnectorRequest) (*ReplaceConnectorResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.ReplaceConnector(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsReplaceRPC, notificationsFeatureGroupID)
}
return response, nil
}
// DeleteConnector deletes a connector.
func (c NotificationsClient) DeleteConnector(ctx context.Context, req *DeleteConnectorRequest) (*DeleteConnectorResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.DeleteConnector(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsDeleteRPC, notificationsFeatureGroupID)
}
return response, nil
}
// GetConnector retrieves a connector by ID.
func (c NotificationsClient) GetConnector(ctx context.Context, req *GetConnectorRequest) (*GetConnectorResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.GetConnector(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsGetRPC, notificationsFeatureGroupID)
}
return response, nil
}
// ListConnectors lists connectors.
func (c NotificationsClient) ListConnectors(ctx context.Context, req *ListConnectorsRequest) (*ListConnectorsResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.ListConnectors(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsListRPC, notificationsFeatureGroupID)
}
return response, nil
}
// BatchGetConnectors retrieves connectors by IDs.
func (c NotificationsClient) BatchGetConnectors(ctx context.Context, req *BatchGetConnectorsRequest) (*BatchGetConnectorsResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.BatchGetConnectors(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsBatchGetRPC, notificationsFeatureGroupID)
}
return response, nil
}
// GetConnectorTypeSummaries retrieves connector type summaries.
func (c NotificationsClient) GetConnectorTypeSummaries(ctx context.Context, req *GetConnectorTypeSummariesRequest) (*GetConnectorTypeSummariesResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := connectores.NewConnectorsServiceClient(conn)
response, err := client.GetConnectorTypeSummaries(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, ConnectorsGetConnectorTypeSummariesRPC, notificationsFeatureGroupID)
}
return response, nil
}
// CreateCustomPreset creates a new custom preset.
func (c NotificationsClient) CreateCustomPreset(ctx context.Context, req *CreateCustomPresetRequest) (*CreateCustomPresetResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.CreateCustomPreset(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsCreateRPC, notificationsFeatureGroupID)
}
return response, nil
}
// ReplaceCustomPreset replaces a custom preset.
func (c NotificationsClient) ReplaceCustomPreset(ctx context.Context, req *ReplaceCustomPresetRequest) (*ReplaceCustomPresetResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.ReplaceCustomPreset(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsReplaceRPC, notificationsFeatureGroupID)
}
return response, nil
}
// DeleteCustomPreset deletes a custom preset.
func (c NotificationsClient) DeleteCustomPreset(ctx context.Context, req *DeleteCustomPresetRequest) (*DeleteCustomPresetResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.DeleteCustomPreset(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsDeleteRPC, notificationsFeatureGroupID)
}
return response, nil
}
// SetCustomPresetAsDefault sets a custom preset as default.
func (c NotificationsClient) SetCustomPresetAsDefault(ctx context.Context, req *SetCustomPresetAsDefaultRequest) (*SetCustomPresetAsDefaultResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.SetCustomPresetAsDefault(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsSetAsDefaultRPC, notificationsFeatureGroupID)
}
return response, nil
}
// GetPreset retrieves a preset.
func (c NotificationsClient) GetPreset(ctx context.Context, req *GetPresetRequest) (*GetPresetResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.GetPreset(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsGetRPC, notificationsFeatureGroupID)
}
return response, nil
}
// ListPresetSummaries lists preset summaries.
func (c NotificationsClient) ListPresetSummaries(ctx context.Context, req *ListPresetSummariesRequest) (*ListPresetSummariesResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.ListPresetSummaries(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsListRPC, notificationsFeatureGroupID)
}
return response, nil
}
// BatchGetPresets retrieves a group of presets.
func (c NotificationsClient) BatchGetPresets(ctx context.Context, req *BatchGetPresetsRequest) (*BatchGetPresetsResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.BatchGetPresets(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsBatchGetRPC, notificationsFeatureGroupID)
}
return response, nil
}
// GetDefaultPresetSummary retrieves the default preset summary.
func (c NotificationsClient) GetDefaultPresetSummary(ctx context.Context, req *GetDefaultPresetSummaryRequest) (*GetDefaultPresetSummaryResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.GetDefaultPresetSummary(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsGetDefaultRPC, notificationsFeatureGroupID)
}
return response, nil
}
// GetSystemDefaultPresetSummary retrieves the system default preset summary.
func (c NotificationsClient) GetSystemDefaultPresetSummary(ctx context.Context, req *GetSystemDefaultPresetSummaryRequest) (*GetSystemDefaultPresetSummaryResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := presets.NewPresetsServiceClient(conn)
response, err := client.GetSystemDefaultPresetSummary(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, PresetsGetSystemDefaultRPC, notificationsFeatureGroupID)
}
return response, nil
}
// TestConnectorConfig tests a connector configuration.
func (c NotificationsClient) TestConnectorConfig(ctx context.Context, req *TestConnectorConfigRequest) (*TestConnectorConfigResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := notifications.NewTestingServiceClient(conn)
response, err := client.TestConnectorConfig(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, TestingTestConnectorConfigRPC, notificationsFeatureGroupID)
}
return response, nil
}
// TestExistingConnector tests an existing connector.
func (c NotificationsClient) TestExistingConnector(ctx context.Context, req *TestExistingConnectorRequest) (*TestExistingConnectorResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := notifications.NewTestingServiceClient(conn)
response, err := client.TestExistingConnector(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, TestingTestExistingConnectorRPC, notificationsFeatureGroupID)
}
return response, nil
}
// TestPresetConfig tests a preset configuration.
func (c NotificationsClient) TestPresetConfig(ctx context.Context, req *TestPresetConfigRequest) (*TestPresetConfigResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := notifications.NewTestingServiceClient(conn)
response, err := client.TestPresetConfig(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, TestingTestPresetConfigRPC, notificationsFeatureGroupID)
}
return response, nil
}
// TestTemplateRender tests a template rendering.
func (c NotificationsClient) TestTemplateRender(ctx context.Context, req *TestTemplateRenderRequest) (*TestTemplateRenderResponse, error) {
callProperties, err := c.callPropertiesCreator.GetTeamsLevelCallProperties(ctx)
if err != nil {
return nil, err
}
conn := callProperties.Connection
defer conn.Close()
client := notifications.NewTestingServiceClient(conn)
response, err := client.TestTemplateRender(callProperties.Ctx, req, callProperties.CallOptions...)
if err != nil {
return nil, NewSdkAPIError(err, TestingTestTemplateRenderRPC, notificationsFeatureGroupID)
}
return response, nil
}
// NewNotificationsClient creates a new notifications' client.
func NewNotificationsClient(c *CallPropertiesCreator) *NotificationsClient {
return &NotificationsClient{callPropertiesCreator: c}
}