Skip to content

Commit 78ad5b8

Browse files
authored
DOCS-374 Change Metrika to Metrica (#107)
1 parent 10e8328 commit 78ad5b8

4 files changed

Lines changed: 40 additions & 40 deletions

File tree

docs/resources/transfer_endpoint.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,15 +930,15 @@ Optional:
930930
Optional:
931931

932932
- `counter_ids` (List of Number) List of counter IDs
933-
- `metrica_stream` (Block List) Configuration for Metrika streams (see [below for nested schema](#nestedblock--settings--metrica_source--metrica_stream))
933+
- `metrica_stream` (Block List) Configuration for Metrica streams (see [below for nested schema](#nestedblock--settings--metrica_source--metrica_stream))
934934
- `token` (String, Sensitive) Access token
935935

936936
<a id="nestedblock--settings--metrica_source--metrica_stream"></a>
937937
### Nested Schema for `settings.metrica_source.metrica_stream`
938938

939939
Optional:
940940

941-
- `stream_type` (String) The type of the Metrika stream
941+
- `stream_type` (String) The type of the Metrica stream
942942

943943

944944

internal/provider/transfer_endpoint_metrica.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@ import (
88
"github.com/hashicorp/terraform-plugin-framework/types"
99
)
1010

11-
type endpointMetrikaSourceSettings struct {
11+
type endpointMetricaSourceSettings struct {
1212
CounterIDs []types.Int64 `tfsdk:"counter_ids"`
1313
Token types.String `tfsdk:"token"`
14-
MetrikaStreams []*endpointMetrikaStream `tfsdk:"metrica_stream"`
14+
MetricaStreams []*endpointMetricaStream `tfsdk:"metrica_stream"`
1515
}
1616

17-
type endpointMetrikaStream struct {
17+
type endpointMetricaStream struct {
1818
StreamType types.String `tfsdk:"stream_type"`
1919
}
2020

21-
func transferEndpointMetrikaStreamSchema() schema.Block {
21+
func transferEndpointMetricaStreamSchema() schema.Block {
2222
return schema.ListNestedBlock{
2323
NestedObject: schema.NestedBlockObject{
2424
Attributes: map[string]schema.Attribute{
2525
"stream_type": schema.StringAttribute{
2626
Optional: true,
27-
Description: "The type of the Metrika stream",
27+
Description: "The type of the Metrica stream",
2828
},
2929
},
3030
},
31-
Description: "Configuration for Metrika streams",
31+
Description: "Configuration for Metrica streams",
3232
}
3333
}
34-
func transferEndpointMetrikaSourceSchema() schema.Block {
34+
func transferEndpointMetricaSourceSchema() schema.Block {
3535
return schema.SingleNestedBlock{
3636
Attributes: map[string]schema.Attribute{
3737
"counter_ids": schema.ListAttribute{
@@ -46,12 +46,12 @@ func transferEndpointMetrikaSourceSchema() schema.Block {
4646
},
4747
},
4848
Blocks: map[string]schema.Block{
49-
"metrica_stream": transferEndpointMetrikaStreamSchema(),
49+
"metrica_stream": transferEndpointMetricaStreamSchema(),
5050
},
5151
}
5252
}
5353

54-
func (m *endpointMetrikaSourceSettings) parse(e *endpoint.MetricaSource) diag.Diagnostics {
54+
func (m *endpointMetricaSourceSettings) parse(e *endpoint.MetricaSource) diag.Diagnostics {
5555
var diags diag.Diagnostics
5656
if len(e.GetCounterIds()) > 0 {
5757
counterIDs := make([]types.Int64, len(e.CounterIds))
@@ -64,21 +64,21 @@ func (m *endpointMetrikaSourceSettings) parse(e *endpoint.MetricaSource) diag.Di
6464
}
6565

6666
if len(e.GetStreams()) > 0 {
67-
metrikaStreams := make([]*endpointMetrikaStream, len(e.GetStreams()))
67+
metricaStreams := make([]*endpointMetricaStream, len(e.GetStreams()))
6868
for i, stream := range e.GetStreams() {
69-
parsedStream := &endpointMetrikaStream{}
69+
parsedStream := &endpointMetricaStream{}
7070
diags = append(diags, parsedStream.parse(stream)...)
71-
metrikaStreams[i] = parsedStream
71+
metricaStreams[i] = parsedStream
7272
}
73-
m.MetrikaStreams = metrikaStreams
73+
m.MetricaStreams = metricaStreams
7474
} else {
75-
m.MetrikaStreams = []*endpointMetrikaStream{}
75+
m.MetricaStreams = []*endpointMetricaStream{}
7676
}
7777

7878
return diags
7979
}
8080

81-
func (m *endpointMetrikaStream) parse(e *endpoint.MetricaStream) diag.Diagnostics {
81+
func (m *endpointMetricaStream) parse(e *endpoint.MetricaStream) diag.Diagnostics {
8282
var diags diag.Diagnostics
8383
if e == nil {
8484
m = nil
@@ -91,36 +91,36 @@ func (m *endpointMetrikaStream) parse(e *endpoint.MetricaStream) diag.Diagnostic
9191
return diags
9292
}
9393

94-
func (m *endpointMetrikaSourceSettings) convert() (*transfer.EndpointSettings_MetricaSource, diag.Diagnostics) {
94+
func (m *endpointMetricaSourceSettings) convert() (*transfer.EndpointSettings_MetricaSource, diag.Diagnostics) {
9595
var diags diag.Diagnostics
96-
metrikaSource := endpoint.MetricaSource{}
96+
metricaSource := endpoint.MetricaSource{}
9797
if len(m.CounterIDs) > 0 {
9898
counterIDs := make([]int64, len(m.CounterIDs))
9999
for i, id := range m.CounterIDs {
100100
counterIDs[i] = id.ValueInt64()
101101
}
102-
metrikaSource.CounterIds = counterIDs
102+
metricaSource.CounterIds = counterIDs
103103
} else {
104-
metrikaSource.CounterIds = []int64{}
104+
metricaSource.CounterIds = []int64{}
105105
}
106106

107-
metrikaSource.Token = &endpoint.Secret{Value: &endpoint.Secret_Raw{Raw: m.Token.ValueString()}}
107+
metricaSource.Token = &endpoint.Secret{Value: &endpoint.Secret_Raw{Raw: m.Token.ValueString()}}
108108

109-
if len(m.MetrikaStreams) > 0 {
110-
metrikaStreams := make([]*endpoint.MetricaStream, len(m.MetrikaStreams))
111-
for i, stream := range m.MetrikaStreams {
109+
if len(m.MetricaStreams) > 0 {
110+
metricaStreams := make([]*endpoint.MetricaStream, len(m.MetricaStreams))
111+
for i, stream := range m.MetricaStreams {
112112
convertedStream, diag := stream.convert()
113113
diags = append(diags, diag...)
114-
metrikaStreams[i] = convertedStream
114+
metricaStreams[i] = convertedStream
115115
}
116-
metrikaSource.Streams = metrikaStreams
116+
metricaSource.Streams = metricaStreams
117117
} else {
118-
metrikaSource.Streams = []*endpoint.MetricaStream{}
118+
metricaSource.Streams = []*endpoint.MetricaStream{}
119119
}
120120

121-
return &transfer.EndpointSettings_MetricaSource{MetricaSource: &metrikaSource}, diags
121+
return &transfer.EndpointSettings_MetricaSource{MetricaSource: &metricaSource}, diags
122122
}
123123

124-
func (m *endpointMetrikaStream) convert() (*endpoint.MetricaStream, diag.Diagnostics) {
124+
func (m *endpointMetricaStream) convert() (*endpoint.MetricaStream, diag.Diagnostics) {
125125
return &endpoint.MetricaStream{Type: endpoint.MetricaStreamType(endpoint.MetricaStreamType_value[m.StreamType.ValueString()])}, diag.Diagnostics{}
126126
}

internal/provider/transfer_endpoint_metrica_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var (
1111
testEMetricaSourceID string = fmt.Sprintf("doublecloud_transfer_endpoint.%v", testEMetricaSourceName)
1212
)
1313

14-
func TestAccTransferEndpointMetrikaSource(t *testing.T) {
14+
func TestAccTransferEndpointMetricaSource(t *testing.T) {
1515
t.Parallel()
1616

1717
resource.Test(t, resource.TestCase{
@@ -20,7 +20,7 @@ func TestAccTransferEndpointMetrikaSource(t *testing.T) {
2020
Steps: []resource.TestStep{
2121
// Create and Read Testing
2222
{
23-
Config: testAccTransferEndpointMetrikaConfig(),
23+
Config: testAccTransferEndpointMetricaConfig(),
2424
Check: resource.ComposeAggregateTestCheckFunc(
2525
resource.TestCheckResourceAttr(testEMetricaSourceID, "name", testEMetricaSourceName),
2626
resource.TestCheckResourceAttr(testEMetricaSourceID, "settings.metrica_source.counter_ids.#", "2"),
@@ -37,7 +37,7 @@ func TestAccTransferEndpointMetrikaSource(t *testing.T) {
3737

3838
}
3939

40-
func testAccTransferEndpointMetrikaConfig() string {
40+
func testAccTransferEndpointMetricaConfig() string {
4141
return fmt.Sprintf(`
4242
resource "doublecloud_transfer_endpoint" %[1]q {
4343
project_id = %[2]q

internal/provider/transfer_endpoint_resource.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type endpointSettings struct {
4848
KafkaSource *endpointKafkaSourceSettings `tfsdk:"kafka_source"`
4949
KinesisSource *endpointKinesisSourceSettings `tfsdk:"kinesis_source"`
5050
PostgresSource *endpointPostgresSourceSettings `tfsdk:"postgres_source"`
51-
MetrikaSource *endpointMetrikaSourceSettings `tfsdk:"metrica_source"`
51+
MetricaSource *endpointMetricaSourceSettings `tfsdk:"metrica_source"`
5252
MysqlSource *endpointMysqlSourceSettings `tfsdk:"mysql_source"`
5353
MongoSource *endpointMongoSourceSettings `tfsdk:"mongo_source"`
5454
ObjectStorageSource *endpointObjectStorageSourceSettings `tfsdk:"object_storage_source"`
@@ -123,7 +123,7 @@ func (r *TransferEndpointResource) Schema(ctx context.Context, req resource.Sche
123123
"postgres_source": transferEndpointPostgresSourceSchema(),
124124
"mysql_source": transferEndpointMysqlSourceSchema(),
125125
"mongo_source": transferEndpointMongoSourceSchema(),
126-
"metrica_source": transferEndpointMetrikaSourceSchema(),
126+
"metrica_source": transferEndpointMetricaSourceSchema(),
127127
"object_storage_source": transferEndpointObjectStorageSourceSchema(),
128128
"s3_source": transferEndpointS3SourceSchema(),
129129
"linkedinads_source": endpointLinkedinAdsSourceSettingsSchema(),
@@ -372,8 +372,8 @@ func transferEndpointSettings(m *TransferEndpointModel) (*transfer.EndpointSetti
372372
}
373373
return &transfer.EndpointSettings{Settings: s}, diag
374374
}
375-
if m.Settings.MetrikaSource != nil {
376-
s, d := m.Settings.MetrikaSource.convert()
375+
if m.Settings.MetricaSource != nil {
376+
s, d := m.Settings.MetricaSource.convert()
377377
if d.HasError() {
378378
diag.Append(d...)
379379
}
@@ -612,10 +612,10 @@ func (data *TransferEndpointModel) parseTransferEndpoint(ctx context.Context, e
612612
diag.Append(parseTransferEndpointPostgresTarget(ctx, settings, data.Settings.PostgresTarget)...)
613613
}
614614
if settings := e.Settings.GetMetricaSource(); settings != nil {
615-
if data.Settings.MetrikaSource == nil {
616-
data.Settings.MetrikaSource = &endpointMetrikaSourceSettings{}
615+
if data.Settings.MetricaSource == nil {
616+
data.Settings.MetricaSource = &endpointMetricaSourceSettings{}
617617
}
618-
diag.Append(data.Settings.MetrikaSource.parse(settings)...)
618+
diag.Append(data.Settings.MetricaSource.parse(settings)...)
619619
}
620620
if settings := e.Settings.GetMysqlSource(); settings != nil {
621621
if data.Settings.MysqlSource == nil {

0 commit comments

Comments
 (0)