@@ -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}
0 commit comments