@@ -60,54 +60,117 @@ func (client *AuditClient) ConfigurationProvider() *common.ConfigurationProvider
60
60
61
61
// GetConfiguration Get the configuration
62
62
func (client AuditClient ) GetConfiguration (ctx context.Context , request GetConfigurationRequest ) (response GetConfigurationResponse , err error ) {
63
- httpRequest , err := common .MakeDefaultHTTPRequestWithTaggedStruct (http .MethodGet , "/configuration" , request )
63
+ var ociResponse common.OCIResponse
64
+ policy := common .NoRetryPolicy ()
65
+ if request .RetryPolicy () != nil {
66
+ policy = * request .RetryPolicy ()
67
+ }
68
+ ociResponse , err = common .Retry (ctx , request , client .getConfiguration , policy )
64
69
if err != nil {
65
70
return
66
71
}
72
+ if convertedResponse , ok := ociResponse .(GetConfigurationResponse ); ok {
73
+ response = convertedResponse
74
+ } else {
75
+ err = fmt .Errorf ("failed to convert OCIResponse into GetConfigurationResponse" )
76
+ }
77
+ return
78
+ }
79
+
80
+ // getConfiguration implements the OCIOperation interface (enables retrying operations)
81
+ func (client AuditClient ) getConfiguration (ctx context.Context , request common.OCIRequest ) (common.OCIResponse , error ) {
82
+ httpRequest , err := request .HTTPRequest (http .MethodGet , "/configuration" )
83
+ if err != nil {
84
+ return nil , err
85
+ }
67
86
68
- httpResponse , err := client .Call (ctx , & httpRequest )
87
+ var response GetConfigurationResponse
88
+ var httpResponse * http.Response
89
+ httpResponse , err = client .Call (ctx , & httpRequest )
69
90
defer common .CloseBodyIfValid (httpResponse )
70
91
response .RawResponse = httpResponse
71
92
if err != nil {
72
- return
93
+ return response , err
73
94
}
74
95
75
96
err = common .UnmarshalResponse (httpResponse , & response )
76
- return
97
+ return response , err
77
98
}
78
99
79
100
// ListEvents Returns all audit events for the specified compartment that were processed within the specified time range.
80
101
func (client AuditClient ) ListEvents (ctx context.Context , request ListEventsRequest ) (response ListEventsResponse , err error ) {
81
- httpRequest , err := common .MakeDefaultHTTPRequestWithTaggedStruct (http .MethodGet , "/auditEvents" , request )
102
+ var ociResponse common.OCIResponse
103
+ policy := common .NoRetryPolicy ()
104
+ if request .RetryPolicy () != nil {
105
+ policy = * request .RetryPolicy ()
106
+ }
107
+ ociResponse , err = common .Retry (ctx , request , client .listEvents , policy )
82
108
if err != nil {
83
109
return
84
110
}
111
+ if convertedResponse , ok := ociResponse .(ListEventsResponse ); ok {
112
+ response = convertedResponse
113
+ } else {
114
+ err = fmt .Errorf ("failed to convert OCIResponse into ListEventsResponse" )
115
+ }
116
+ return
117
+ }
85
118
86
- httpResponse , err := client .Call (ctx , & httpRequest )
119
+ // listEvents implements the OCIOperation interface (enables retrying operations)
120
+ func (client AuditClient ) listEvents (ctx context.Context , request common.OCIRequest ) (common.OCIResponse , error ) {
121
+ httpRequest , err := request .HTTPRequest (http .MethodGet , "/auditEvents" )
122
+ if err != nil {
123
+ return nil , err
124
+ }
125
+
126
+ var response ListEventsResponse
127
+ var httpResponse * http.Response
128
+ httpResponse , err = client .Call (ctx , & httpRequest )
87
129
defer common .CloseBodyIfValid (httpResponse )
88
130
response .RawResponse = httpResponse
89
131
if err != nil {
90
- return
132
+ return response , err
91
133
}
92
134
93
135
err = common .UnmarshalResponse (httpResponse , & response )
94
- return
136
+ return response , err
95
137
}
96
138
97
139
// UpdateConfiguration Update the configuration
98
140
func (client AuditClient ) UpdateConfiguration (ctx context.Context , request UpdateConfigurationRequest ) (response UpdateConfigurationResponse , err error ) {
99
- httpRequest , err := common .MakeDefaultHTTPRequestWithTaggedStruct (http .MethodPut , "/configuration" , request )
141
+ var ociResponse common.OCIResponse
142
+ policy := common .NoRetryPolicy ()
143
+ if request .RetryPolicy () != nil {
144
+ policy = * request .RetryPolicy ()
145
+ }
146
+ ociResponse , err = common .Retry (ctx , request , client .updateConfiguration , policy )
100
147
if err != nil {
101
148
return
102
149
}
150
+ if convertedResponse , ok := ociResponse .(UpdateConfigurationResponse ); ok {
151
+ response = convertedResponse
152
+ } else {
153
+ err = fmt .Errorf ("failed to convert OCIResponse into UpdateConfigurationResponse" )
154
+ }
155
+ return
156
+ }
157
+
158
+ // updateConfiguration implements the OCIOperation interface (enables retrying operations)
159
+ func (client AuditClient ) updateConfiguration (ctx context.Context , request common.OCIRequest ) (common.OCIResponse , error ) {
160
+ httpRequest , err := request .HTTPRequest (http .MethodPut , "/configuration" )
161
+ if err != nil {
162
+ return nil , err
163
+ }
103
164
104
- httpResponse , err := client .Call (ctx , & httpRequest )
165
+ var response UpdateConfigurationResponse
166
+ var httpResponse * http.Response
167
+ httpResponse , err = client .Call (ctx , & httpRequest )
105
168
defer common .CloseBodyIfValid (httpResponse )
106
169
response .RawResponse = httpResponse
107
170
if err != nil {
108
- return
171
+ return response , err
109
172
}
110
173
111
174
err = common .UnmarshalResponse (httpResponse , & response )
112
- return
175
+ return response , err
113
176
}
0 commit comments